Interpolate for the remaining longitudes!

1 次查看(过去 30 天)
**How to interpolate values for the missing longitudes** (See the png file attached)
ncid1 = netcdf.open('uwnd.mon.mean.nc','NC_NOWRITE');
uwind = netcdf.getVar(ncid1,3,[0 0 0],[144 73 1],'double');
ncid2 = netcdf.open('vwnd.mon.mean.nc','NC_NOWRITE');
vwind = netcdf.getVar(ncid2,3,[0 0 0],[144 73 1],'double');
lon1 = netcdf.getVar(ncid1,1,0,144); %longitude values are 0 to 357.5
lat1 = netcdf.getVar(ncid1,0,0,73); %latitude values are -90 to 90
for p = 1:144
for q = 1:73
map1(q,p) = uwind(p,q);
end
end
for p1 = 1:144
for q1 = 1:73
map2(q1,p1) = vwind(p1,q1);
end
end
wnd_spd = sqrt((uwind.*uwind)+(vwind.*vwind))
for p3 = 1:144
for q3 = 1:73
map3(q3,p3) = wnd_spd(p3,q3);
end
end

回答(1 个)

ANKUR KUMAR
ANKUR KUMAR 2017-12-8
Suppose, you have stored all the missing longitudes in the variable lon and the corresponding latitudes in the variable lat. So you can use interp2 to get the wind speed over these lat long.
For example, lon_missing and lat_missing are the set of lon-lats on which you want to find the wind speed. Suppose, LON and LAT are the lon-lats of the main data file. Wind_speed is the wind speed from your main data file.
lon_missing=[69:0.2:71];
lat_missing=[20:0.2:22];
Wind_speed=randi(25,120,250); % wind speed from your main data file. This is just an example.
LAT=linspace(3,35,250);
LON=linspace(65,95,120);
[x y]=meshgrid(lon_missing,lat_missing);
for ii=1:size(x,2)
interpolated_wind_speed(:,ii)=interp2(LON,LAT,Wind_speed',x(:,ii),y(:,ii));
end

类别

Help CenterFile Exchange 中查找有关 Interpolating Gridded Data 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by