1 |
cnh |
1.1 |
function [del] = cube2latlon(x,y,xi,yi,varargin) |
2 |
|
|
% z=cube2latlon(x,y,xi,yi); |
3 |
|
|
% |
4 |
|
|
% Re-grids model output on expanded spherical cube to lat-lon grid. |
5 |
|
|
% x,y are 2-D arrays of the cell-centered coordinates |
6 |
|
|
% c is a 2-D or 3-D scalar field |
7 |
|
|
% xi,yi are vectors of the new regular lat-lon grid to interpolate to. |
8 |
|
|
% z is the interpolated data with dimensions of size(xi) by size(yi). |
9 |
|
|
% |
10 |
|
|
% e.g. |
11 |
|
|
% >> x=rdmds('XC'); |
12 |
|
|
% >> y=rdmds('YC'); |
13 |
|
|
% >> t=rdmds('Ttave.0000513360'); |
14 |
|
|
% >> xi=-179:2:180;yi=-89:2:90; |
15 |
|
|
% >> del=cube2latlon(x,y,xi,yi); |
16 |
|
|
% |
17 |
|
|
% $Header: /u/gcmpack/models/MITgcmUV/utils/matlab/cube2latlon.m,v 1.3 2001/08/28 17:58:03 adcroft Exp $ |
18 |
|
|
|
19 |
|
|
NN=size(x); |
20 |
|
|
[nx ny nz]=size(x); |
21 |
|
|
|
22 |
|
|
X=reshape(x,[1 nx*ny]); |
23 |
|
|
Y=reshape(y,[1 nx*ny]); |
24 |
|
|
ig=find(X>90); |
25 |
|
|
il=find(X<-90); |
26 |
|
|
del=griddata_preprocess([Y Y(il) Y(ig)],[X X(il)+360 X(ig)-360],yi,xi',varargin{:}); |
27 |
|
|
|
28 |
|
|
del.ig=ig; |
29 |
|
|
del.il=il; |