Methods of interpolating onto a different grid?

2 ビュー (過去 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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by