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

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

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

revision 1.1 by afe, Mon Jul 12 23:24:35 2004 UTC revision 1.3 by afe, Wed Jan 5 20:40:21 2005 UTC
# Line 1  Line 1 
1  function [z] = cart2cyl(c,thetai,rhoi,varargin)  function [z] = cart2cyl(c,thetai,rhoi,varargin)
2  % z=cart2cyl(c,xi,yi);  % z=cart2cyl(c,xi,yi);
3  %  %
 % Re-grids model output in cylindrical coords to cartesian.  
 %  c     is a 2-D or 3-D scalar or z-vector field  
 %  xi,yi are vectors of the new regular lat-lon grid to interpolate to.  
 %  z     is the interpolated data with dimensions of size(xi) by size(yi).  
 %  
 % e.g.  
 % >> t=rdmds('Ttave.0000513360');  
 % >> xi=-179:2:180;yi=-89:2:90;  
 % >> ti=cyl2cart(t,xi,yi);  
 %  
4    
5  NN=size(c);  NN=size(c);
6  %[theta rho nz]=size(c);  %[theta rho nz]=size(c);
7  [x y nz]=size(c);  [x y nz]=size(c);
8  %[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);
9  [Y,X] = meshgrid(-(x-1)/2:(x-1)/2,-(y-1)/2:(y-1)/2);  %[Y,X] = meshgrid(-(x-1)/2:(x-1)/2,-(y-1)/2:(y-1)/2);
10    %stepx=(2*x+1)/(2*x);
11    %stepy=(2*y+1)/(2*y);
12    stepx=(x+1)/(x);
13    stepy=(y+1)/(y);
14    [Y,X] = meshgrid(-(x)/2:stepx:(x)/2,-(y)/2:stepy:(y)/2);
15    %[Y,X] = meshgrid(x,y);
16    %[Y,X] = meshgrid(-(x)/2:stepx:(x)/2+stepx,-(y)/2:stepy:(y)/2+stepy);
17  %[x,y] = pol2cart(THETA,RHO);  %[x,y] = pol2cart(THETA,RHO);
18  [theta,rho] = cart2pol(X,Y);  [theta,rho] = cart2pol(X,Y);
19  theta=(theta./(pi*2)+0.5).*size(thetai,2);  %theta=(theta./(pi*2)+0.5).*size(thetai,2);
20    %theta=theta.*2*((size(thetai,2)+1)/size(thetai,2));
21    %theta=(theta./(pi*2)+0.5).*(size(thetai,2)+1);
22    %theta=(theta./(pi*2)+0.5).*(size(thetai,2));
23    theta=(theta./(pi*2)+0.5).*(size(thetai,2));
24    %theta=(theta./pi).*size(thetai,2);
25    %theta=(theta./(pi*2)).*size(thetai,2);
26    %rho=max(rhoi)*rho/((x-1)/2);
27    rho=max(rhoi)*rho/((x)/2);
28  %theta=rot90(theta.*180./pi,-1);  %theta=rot90(theta.*180./pi,-1);
29  %[nx ny nz]=size(c);  %[nx ny nz]=size(c);
30  %nx=theta;ny=rho;  %nx=theta;ny=rho;

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

  ViewVC Help
Powered by ViewVC 1.1.22