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

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

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


Revision 1.4 - (show annotations) (download)
Thu Jan 13 15:50:36 2005 UTC (20 years, 6 months ago) by afe
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +0 -23 lines
Error occurred while calculating annotation data.
removed commented cruft from m-files, added handy-dandy ready-made test data

1 function [z] = cart2cyl(c,thetai,rhoi,varargin)
2 % z=cart2cyl(c,xi,yi);
3 %
4
5 NN=size(c);
6 [x y nz]=size(c);
7 stepx=(x+1)/(x);
8 stepy=(y+1)/(y);
9 [Y,X] = meshgrid(-(x)/2:stepx:(x)/2,-(y)/2:stepy:(y)/2);
10 [theta,rho] = cart2pol(X,Y);
11 theta=(theta./(pi*2)+0.5).*(size(thetai,2));
12 rho=max(rhoi)*rho/((x)/2);
13 ntheta=x;nrho=y;
14
15 THETA=reshape(theta,[1 ntheta*nrho]);
16 RHO=reshape(rho,[1 ntheta*nrho]);
17 del=griddata_preprocess(RHO,THETA,rhoi,thetai',varargin{:});
18
19 for k=1:nz;
20 C=reshape(c(:,:,k),[1 ntheta*nrho]);
21 z(:,:,k)=griddata(RHO,THETA,C,rhoi,thetai',varargin{:});
22 end % k
23
24 % Split vertical and time dimensions
25 if size(NN,2)>2
26 z=reshape(z,[size(z,1) size(z,2) NN(3:end)]);
27 end

  ViewVC Help
Powered by ViewVC 1.1.22