how to regrid MPI-ESM-MR to 0.5*05 degree from 1.87 degree lat*1.87 degree lon

8 views (last 30 days)
I have to billinear interpolate MPI-ESM-MR netcdf file from 1.87*1.87 degree to 0.5*0.5 degree. latitude=-88.572166442871100 to 88.572166442871100 longitude=0 to 358.1250 I see a code in forum by tchu
%Regrid Air relative humidity Example 2004
rhum = ncread('rhum.mon.mean.nc','rhum');
Rhum2004 = squeeze(rhum(:,:,:,301:312));
size(Rhum2004)
Rhum2004(find(Rhum2004==32766|Rhum2004==-32767))=nan;
Rhum2004=[Rhum2004(73:144,:,:);Rhum2004(1:72,:,:)];%-180->180
[OY,OX]=meshgrid(90:-2.5:-90, -180:2.5:177.5);
[NY,NX]=meshgrid(89.875:-0.25:-89.875,-179.875:0.25:179.875);
RH2004=nan(1440,720,12);
for i=1:12
RH2004(:,:,i) = ...
single(interp2(OY,OX,Rhum2004(:,:,i),NY,NX,'bilinear'));
end
but not getting
Rhum2004 = squeeze(rhum(:,:,:,301:312));
size(Rhum2004)
Rhum2004(find(Rhum2004==32766|Rhum2004==-32767))=nan;
Rhum2004=[Rhum2004(73:144,:,:);Rhum2004(1:72,:,:)];%-180->180
RH2004=nan(1440,720,12);
Can anybody help me.I am totally new for this work.

Accepted Answer

Chad Greene
Chad Greene on 30 Aug 2017
I think this:
interp2(OY,OX,Rhum2004(:,:,i),NY,NX,'bilinear')
should be
interp2(OY,OX,Rhum2004(:,:,i),NY,NX,'linear')
which is bilinear, but it's just called linear. That's the default behavior, so you could just as easily do
interp2(OY,OX,Rhum2004(:,:,i),NY,NX)

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!