/[MITgcm]/MITgcm_contrib/osse/utils/cyl2cart.m
ViewVC logotype

Diff of /MITgcm_contrib/osse/utils/cyl2cart.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by afe, Tue Jun 8 14:14:44 2004 UTC revision 1.3 by afe, Thu Jan 13 15:50:36 2005 UTC
# Line 5  function [z] = cyl2cart(c,xi,yi,varargin Line 5  function [z] = cyl2cart(c,xi,yi,varargin
5  %  c     is a 2-D or 3-D scalar or z-vector field  %  c     is a 2-D or 3-D scalar or z-vector field
6  %  xi,yi are vectors of the new regular lat-lon grid to interpolate to.  %  xi,yi are vectors of the new regular lat-lon grid to interpolate to.
7  %  z     is the interpolated data with dimensions of size(xi) by size(yi).  %  z     is the interpolated data with dimensions of size(xi) by size(yi).
8    %  theta=0 is at 12 o'clock.
9  %  %
10  % e.g.  % e.g.
11  % >> t=rdmds('Ttave.0000513360');  % >> t=rdmds('Ttave.0000513360');
# Line 16  NN=size(c); Line 17  NN=size(c);
17  [theta rho nz]=size(c);  [theta rho nz]=size(c);
18  [RHO,THETA] = meshgrid(1:rho,-pi+2*pi/theta:2*pi/theta:pi);  [RHO,THETA] = meshgrid(1:rho,-pi+2*pi/theta:2*pi/theta:pi);
19  [x,y] = pol2cart(THETA,RHO);  [x,y] = pol2cart(THETA,RHO);
 %[nx ny nz]=size(c);  
20  nx=theta;ny=rho;  nx=theta;ny=rho;
21    
22  X=reshape(x,[1 nx*ny]);  X=reshape(x,[1 nx*ny]);
# Line 26  del=griddata_preprocess(Y,X,yi,xi',varar Line 26  del=griddata_preprocess(Y,X,yi,xi',varar
26  for k=1:nz;  for k=1:nz;
27   C=reshape(c(:,:,k),[1 nx*ny]);   C=reshape(c(:,:,k),[1 nx*ny]);
28  z(:,:,k)=griddata(Y,X,C,yi,xi',varargin{:});  z(:,:,k)=griddata(Y,X,C,yi,xi',varargin{:});
 % z(:,:,k)=griddata_fast(del,[C C(il) C(ig)],varargin{:});  
29  end % k  end % k
30    
31  % Split vertical and time dimensions  % Split vertical and time dimensions

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.22