Methods of interpolating onto a different grid?

조회 수: 1 (최근 30일)
Michael
Michael 2014년 8월 15일
편집: Adam 2014년 8월 15일
Hello,
I am currently using Triscatteredinterp to transform a regular grid (659 x 3600 x 1682) to this grid (659 x 3127 x 254). However, my values change considerably. Does anyone know why this happens or whether someone knows a method is better / doesn't involve interpolation?
I exclude high latitude regions in the new grid (+-66) but when I exclude the same high latitudes on the original regular grid, the values are much higher. For example:
Global mean fldmean (time axis left after averaging)
3600x1682 ~ 5cm 3127x254 ~ -2cm
could it be something to do with averaging? I currently use nanmean3d...
Here is my code:
for t = 1:659;
t
tic
a=squeeze(ssh_10d(t,224:1459,:)); %choose between -66 to 66
a=a(:);
bad1=find(isnan(a)==0);
a1 = a(bad1);
lon=lon(:);
lon1 = lon(bad1);
lat=lat(:);
lat1 = lat(bad1);
F1=TriScatteredInterp(lon1,lat1,a1,'natural'); % Could it be due to the 'natural' method
clear a a1
a_m=F1(REF_lon,REF_lat);
if isempty(a_m) == 0;
AM(t,:,:)=a_m;
end
toc
end
This method is also very slow so if anyone knows how to speed this up, it would be great!
thanks, Michael
  댓글 수: 2
Michael
Michael 2014년 8월 15일
Maybe it has something to do with changing all NaN values to be = 0. Perhaps this reduced the overall mean of the values?
is there a way of doing this method including NaN's?
Adam
Adam 2014년 8월 15일
편집: Adam 2014년 8월 15일
I'm afraid I don't have time at the moment to look too deeply into it, but a couple of thoughts:
If you want to eliminate values after doing the regridding then you can use griddedInterpolant to regrid from one regular grid to another.
Certainly changing NaNs to 0s will change the mean. nanmean will ignore the NaN values, but mean will include the zeros. You can use mean( nonzeros( x(:) ) ) though to take the mean of x excluding the zeros.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by