Interpolating global data with geointerp
이전 댓글 표시
Hey folks!
I am working on a project where I need to interpolate data from its native lat/lon grid to a new grid that is compatible with other data that I have. I originally was using interp2() to do this, but I would prefer bilinear interpolation, as used by geointerp(), instead of linear interpolation, used by interp2().
The problem I am having is that the lat/lon grid that I am interpolating to is not square. I am attempting to move from a 180x360 grid to a 72x144 grid, and am using the following code block to do so:
%% Interpolate to a common grid (use the same grid as the kernels)
[a,b,c,d,e]=size(ctl_clisccp);
latlim=[-89.14152 89.14152];
lonlim=[0 358.875];
rastersize=[160 320];
R = maprefcells(latlim,lonlim,rastersize)
avgctl_clisccp_int=nan*ones(nmonth,b,c,72,144);
for M=1:nmonth
for T=1:b
for P=1:c
avgctl_clisccp_int(M,T,P,:,:)=mapinterp(squeeze(ctl_clisccp(M,T,P,:,:)),R,kern_lat,kern_lon);
end
end
end
Where kern_lat and kern_lon are of size 72x1 and 1x144 respectively. This block gives me the following error:
Error using mapinterp (line 50)
xq and yq must have the same size.
I am wondering why xq and yq must be the same size, and how to interpolate data to a global grid that is not square. Any help or guidance would be much appreciated!
Thanks,
Calvin
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Raster Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!