Warning, /utils/matlab/cs_grid/cube2latlon_preprocess.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
a33039f58e Alis*0001 function [del] = cube2latlon_preprocess(x,y,xi,yi,varargin)
0002 % del=cube2latlon_preprocess(x,y,xi,yi);
0003 %
0004 % Calculates the data required for fast interpolation from the cube to a
0005 % latitude-longitude grid
0006 % x,y are 2-D arrays of the cell-centered coordinates
0007 % xi,yi are vectors of the new regular lat-lon grid to interpolate to.
0008 % del is the transformation data used by cube2latlon_fast
0009 %
0010 % e.g.
0011 % >> x=rdmds('XC');
0012 % >> y=rdmds('YC');
0013 % >> t=rdmds('Ttave.0000513360');
0014 % >> xi=-179:2:180;yi=-89:2:90;
0015 % >> del=cube2latlon_preprocess(x,y,xi,yi);
0016 % >> ti=cube2latlon_fast(del,t);
0017 %
f8d374081f Jean*0018 % Written by adcroft@.mit.edu, 2004.
a33039f58e Alis*0019 NN=size(x);
0020 [nx ny nz]=size(x);
0021
0022 X=reshape(x,[1 nx*ny]);
0023 Y=reshape(y,[1 nx*ny]);
22701bd31e Jean*0024 xMid=mean(X,2);
0025 ig=find(X>xMid+90);
0026 il=find(X<xMid-90);
a33039f58e Alis*0027 del=griddata_preprocess([Y Y(il) Y(ig)],[X X(il)+360 X(ig)-360],yi,xi',varargin{:});
0028
0029 del.ig=ig;
0030 del.il=il;