Azzera filtri
Azzera filtri

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.

4 visualizzazioni (ultimi 30 giorni)
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

Risposte (1)

dpb
dpb il 17 Ott 2023
unzip('wind1.zip')
d=dir('w*.nc');
info=ncinfo(d(1).name);
info.Variables(:).Name
ans = 'se_model_speed'
ans = 'time'
ans = 'lat'
ans = 'lon'
ans = 'wind_to_dir'
ans = 'northward_wind'
ans = 'wind_speed'
ans = 'eastward_wind'
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
Name Size Bytes Class Attributes W 1035x4 33120 double
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
ans = 400
ans = 397
ans = 912
ans = 1035
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 Commenti
Victor Ebolo
Victor Ebolo il 18 Ott 2023
  • thank you @dp this will help me but I want W to be a size variable (1x1026)
  • because I'm going to manipulate it with variables of this shape and size. please how to do it?

Accedi per commentare.

Categorie

Scopri di più su Lighting, Transparency, and Shading in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by