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

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

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


Revision 1.3 - (hide annotations) (download)
Wed Jan 5 20:40:21 2005 UTC (20 years, 6 months ago) by afe
Branch: MAIN
Changes since 1.2: +17 -13 lines
some tuning to function, removed measleading help, added scalar backtester

1 afe 1.1 function [z] = cart2cyl(c,thetai,rhoi,varargin)
2     % z=cart2cyl(c,xi,yi);
3     %
4    
5     NN=size(c);
6     %[theta rho nz]=size(c);
7     [x y nz]=size(c);
8     %[RHO,THETA] = meshgrid(1:rho,-pi+2*pi/theta:2*pi/theta:pi);
9 afe 1.3 %[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 afe 1.1 %[x,y] = pol2cart(THETA,RHO);
18     [theta,rho] = cart2pol(X,Y);
19 afe 1.3 %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 afe 1.1 %theta=rot90(theta.*180./pi,-1);
29     %[nx ny nz]=size(c);
30     %nx=theta;ny=rho;
31     ntheta=x;nrho=y;
32    
33     %X=reshape(x,[1 nx*ny]);
34     %Y=reshape(y,[1 nx*ny]);
35     THETA=reshape(theta,[1 ntheta*nrho]);
36     RHO=reshape(rho,[1 ntheta*nrho]);
37     %del=griddata_preprocess(Y,X,yi,xi',varargin{:});
38     del=griddata_preprocess(RHO,THETA,rhoi,thetai',varargin{:});
39    
40     for k=1:nz;
41     C=reshape(c(:,:,k),[1 ntheta*nrho]);
42     z(:,:,k)=griddata(RHO,THETA,C,rhoi,thetai',varargin{:});
43     %z(:,:,k)=griddata(Y,X,C,yi,xi',varargin{:});
44     % z(:,:,k)=griddata_fast(del,[C C(il) C(ig)],varargin{:});
45     end % k
46    
47     % Split vertical and time dimensions
48     if size(NN,2)>2
49     z=reshape(z,[size(z,1) size(z,2) NN(3:end)]);
50     end

  ViewVC Help
Powered by ViewVC 1.1.22