HOW TO MAKE THE nan VALUE DISAPPEAR from my extraction, I also like someone to help me make a dynamic figure representing the evolution of the wind per day.
2 次查看(过去 30 天)
显示 更早的评论
files='wind.nc'
fles='pressure.nc'
%TIME
TIMEP=ncread(fles,'time'); %PRESSURE
TIMEW=ncread(files,'time'); %WIND
Pression=ncread(fles,'pbo');
Wind=ncread(files,'wind_speed');
%LONGITUDE AN LATITUDE
%PRESSURE
LONP=double(ncread(fles,"longitude"));
LATP=double(ncread(fles,"latitude"));
%WIND
LONW=double(ncread(files,"lon"));
LATW=double(ncread(files,"lat"));
%extraction wind
[val,ila]=min(abs(LATW-3.25));
[val1,ilo]=min(abs(LONW-9.25));
W=NaN(1,length(dtw));
for i=1:length(dtw)
ss=Wind(ilo,ila,i);
Sal(i)=ss;
end
%extraction pressure
[val,ila]=min(abs(LATP-3.25));
[val1,ilo]=min(abs(LONP-9.25));
PRS=NaN(1,length(dt));
for i=1:length(dt)
ss=Pression(ilo,ila,i);
Sal(i)=ss;
end
%when I run my script, there is the value nan which appears in W
%I also like someone to help me make a dynamic figure representing the
% evolution of the wind per day, coordinate point Lon 9.325 and lat 3.25
%thank you in advance
0 个评论
回答(1 个)
dpb
2023-10-17
unzip('wind1.zip')
d=dir('w*.nc');
info=ncinfo(d(1).name);
info.Variables(:).Name
t=ncread(d(1).name,'time');
Wind=ncread(d(1).name,'wind_speed');
heatmap(sum(isnan(Wind),3))
It appears the NaN values are concentrated in specific areas around the edge and with a couple of bands and one localized area towards the west-central region (by visual position, not nececessarily actual geographically; didn't look at the coordinates. As such, one presumes there's a reason for so many NaN and it probably isn't wise to do anything about substituting for them, at least not without some additional knowledge of where these data were taken and what they're actually measurements of.
Just for grins, let's see what time traces might look like at some specific points --
W=[squeeze(Wind(1,1,:)) squeeze(Wind(4,7,:)) squeeze(Wind(10,11,:)) squeeze(Wind(16,17,:))];
whos W
N=size(W,2);
for i=1:N, subplot(N,1,i); plot(t,W(:,i));xlim([t(1) t(end)]);nnz(isnan(W(:,i))), end
So, for the first couple, it's mostly there with some holes; the last two are almost or completely lacking any values; it wouldn't be possible to fill in those values from anything reasonable.
The variables in the file make one wonder if maybe there's something else going on -- the directions in the other variable names, specifically. Might the missing wind_speed values be recorded as with direction elsewhere instead? Methinks you probably need to understand more fully just what the dataset actually represents.
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!