필터 지우기
필터 지우기

I want to interpolate onto different grid, how can I do this?

조회 수: 1 (최근 30일)
Michael
Michael 2014년 6월 11일
댓글: Michael 2014년 6월 11일
I want to interpolate a 365 x 3127 x 254 grid onto an 365 x 84 x 180 grid. What is the best way to do this?
I think I should use interp2 (see code below) but I get the error 'Subscript indices must either be real positive integers or logicals.'. I have checked this answer but I can't seem to fix it so I ask if there is an easier way to do this?
clear
clc
load '/work/uo0122/u253082/REF.mat'
weight = cos(REF_lat);
lon = ones(180,84);
lat = ones(84,180);
lat = lat';
for yr = 1993%:2010;
yr
load(['/work/uo0122/u253082/Mat_Time/ssh_',num2str(yr),'.mat']);
ssh = ssh_int;
mask = zeros(size(ssh_int));
mask(find(ssh_int > -9E33)) = 1;
mask = repmat(mask,1,365);
ssh = ssh.*mask
for day = 1:size(ssh,1);
ssh(i,:,:) = interp2(REF_lon,REF_lat,squeeze(ssh(i,:,:)),lon,lat,'linear');
end
end
I tried getting rid of NaN's in SSH with no fix and also converting every variable to logical format with no fix. REF_lat & REF_lon = 3127 x 254 reference long and lat. SSH is a 365 x 3127 x 254 matrix and contains NaN's.
Many thanks for your attention! Michael
  댓글 수: 1
Michael
Michael 2014년 6월 11일
I can't seem to see your answers supersyrena baklad and zcrom...

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

답변 (0개)

카테고리

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