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

Diff of /MITgcm_contrib/osse/utils/cyl2cartuv.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 [u,v] = cyl2cartuv(thetav,rhov, Line 5  function [u,v] = cyl2cartuv(thetav,rhov,
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 22  NN=size(thetav); Line 23  NN=size(thetav);
23  [ntheta nrho nz]=size(thetav);  [ntheta nrho nz]=size(thetav);
24  [RHO,THETA,NZ] = meshgrid(1:nrho,-pi+2*pi/ntheta:2*pi/ntheta:pi,1:nz);  [RHO,THETA,NZ] = meshgrid(1:nrho,-pi+2*pi/ntheta:2*pi/ntheta:pi,1:nz);
25  [x,y] = pol2cart(THETA(:,:,1),RHO(:,:,1));  [x,y] = pol2cart(THETA(:,:,1),RHO(:,:,1));
 %[nx ny nz]=size(c);  
26  nx=ntheta;ny=nrho;  nx=ntheta;ny=nrho;
27    
28  % break out components  % break out components
 %vv=-(thetav.*-cos(THETA)+rhov.*sin(THETA));  
 %uv=-(thetav.*-sin(THETA)+rhov.*cos(THETA));  
29  uv=thetav.*cos(THETA)+rhov.*sin(THETA);  uv=thetav.*cos(THETA)+rhov.*sin(THETA);
30  vv=thetav.*-sin(THETA)+rhov.*cos(THETA);  vv=thetav.*-sin(THETA)+rhov.*cos(THETA);
 %uv=thetav.*cos(THETA); %+rhov.*sin(THETA);  
 %vv=thetav.*-sin(THETA); %+rhov.*cos(THETA);  
 %uv=rhov.*sin(THETA);  
 %vv=rhov.*cos(THETA);  
   
31    
32  X=reshape(x,[1 nx*ny]);  X=reshape(x,[1 nx*ny]);
33  Y=reshape(y,[1 nx*ny]);  Y=reshape(y,[1 nx*ny]);
# Line 45  for k=1:nz; Line 38  for k=1:nz;
38   VV=reshape(vv(:,:,k),[1 nx*ny]);   VV=reshape(vv(:,:,k),[1 nx*ny]);
39  u(:,:,k)=griddata(Y,X,UV,yi,xi',varargin{:});  u(:,:,k)=griddata(Y,X,UV,yi,xi',varargin{:});
40  v(:,:,k)=griddata(Y,X,VV,yi,xi',varargin{:});  v(:,:,k)=griddata(Y,X,VV,yi,xi',varargin{:});
 % z(:,:,k)=griddata_fast(del,[C C(il) C(ig)],varargin{:});  
41  end % k  end % k
42    
43  % 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