/[MITgcm]/MITgcm/utils/matlab/uvcube2latlon.m
ViewVC logotype

Annotation of /MITgcm/utils/matlab/uvcube2latlon.m

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


Revision 1.5 - (hide annotations) (download)
Fri Jun 4 17:03:50 2004 UTC (19 years, 4 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint53f_post, checkpoint54a_pre, checkpoint55c_post, checkpoint57m_post, checkpoint57h_done, checkpoint57g_pre, checkpoint57f_post, checkpoint57j_post, checkpoint57b_post, checkpoint53d_post, checkpoint57f_pre, checkpoint55d_pre, checkpoint57g_post, checkpoint57a_post, checkpoint55j_post, checkpoint56b_post, checkpoint57h_pre, checkpoint54a_post, checkpoint55h_post, checkpoint54b_post, checkpoint57e_post, checkpoint54d_post, checkpoint56c_post, checkpoint54e_post, checkpoint55b_post, checkpoint55, checkpoint55a_post, checkpoint57c_pre, checkpoint57o_post, checkpoint55g_post, checkpoint57r_post, checkpoint57k_post, checkpoint57d_post, checkpoint55f_post, checkpoint57i_post, checkpoint57h_post, checkpoint57a_pre, checkpoint54, checkpoint57, checkpoint56, checkpoint53g_post, checkpoint57n_post, checkpoint57p_post, checkpoint57q_post, checkpoint54f_post, eckpoint57e_pre, checkpoint57c_post, checkpoint55e_post, checkpoint54c_post, checkpoint55i_post, checkpoint57l_post, checkpoint56a_post, checkpoint55d_post
Changes since 1.4: +9 -8 lines
New scripts and M6.5 compatibility issues

1 adcroft 1.5 function [U,V,ub,vb] = uvcube2latlon(LON,LAT,u,v,xc,yc)
2 adcroft 1.2 % [ui,vi]=cube2latlon(x,y,u,v,xi,yi);
3     %
4     % Re-grids model output on expanded spherical cube to lat-lon grid.
5     % x,y are 2-D arrays of the cell-centered coordinates
6     % u,v is a 2-D or 3-D horizontal components of model flow fields.
7     % xi,yi are vectors of the new regular lat-lon grid to interpolate to.
8     % ui,vi are the flow fields with dimensions of size(xi) x size(yi) size(u,3).
9     %
10     % e.g.
11     % >> x=rdmds('XC');
12     % >> y=rdmds('YC');
13     % >> u=rdmds('uVeltave.0000513360');
14     % >> v=rdmds('vVeltave.0000513360');
15     % >> xi=-179:2:180;yi=-89:2:90;
16     % >> [ui,vi]=uvcube2latlon(x,y,u,v,xi,yi);
17     %
18 adcroft 1.5 % $Header: /u/gcmpack/models/MITgcmUV/utils/matlab/uvcube2latlon.m,v 1.4 2001/08/28 18:16:40 adcroft Exp $
19 adcroft 1.2
20 adcroft 1.4 NN=size(u);
21 adcroft 1.2 [nnx ny nz]=size(u);
22    
23     U=reshape(u,[ny 6 ny nz]);
24     V=reshape(v,[ny 6 ny nz]);
25    
26     uu=zeros(ny+1,6,ny,nz);
27     vv=zeros(ny,6,ny+1,nz);
28    
29     for k=1:6;
30     uu(1:ny,k,:,:)=U(:,k,:,:);
31     vv(:,k,1:ny,:)=V(:,k,:,:);
32     end
33    
34     for k=1:nz;
35     uu(ny+1,1:2:6,:,k)=uu(1,2:2:6,:,k);
36     uu(ny+1,2:2:6,:,k)=vv(ny:-1:1,[4:2:6 2:2:3],1,k)';
37     vv(:,2:2:6,ny+1,k)=vv(:,[3:2:6 1],1,k);
38     vv(:,1:2:6,ny+1,k)=squeeze(uu(1,[3:2:6 1],ny:-1:1,k))';
39     end
40    
41     ub=(uu(1:ny,:,:,:)+uu(2:ny+1,:,:,:))/2;
42     vb=(vv(:,:,1:ny,:)+vv(:,:,2:ny+1,:))/2;
43    
44     load TUV
45    
46     clear U V
47     for kk=1:nz;
48     for k=1:6;
49     U(:,k,:,kk)=TUu(:,:,k).*squeeze(ub(:,k,:,kk))+TUv(:,:,k).*squeeze(vb(:,k,:,kk));
50     V(:,k,:,kk)=TVu(:,:,k).*squeeze(ub(:,k,:,kk))+TVv(:,:,k).*squeeze(vb(:,k,:,kk));
51     end
52     end
53    
54 adcroft 1.5 ub=reshape(U,[nnx NN(2:end)]);
55     vb=reshape(V,[nnx NN(2:end)]);
56 adcroft 1.2
57 adcroft 1.5 %U=cube2latlon(LON,LAT,U,xc,yc);
58     %V=cube2latlon(LON,LAT,V,xc,yc);
59     del=cube2latlon_preprocess(LON,LAT,xc,yc);
60     U=cube2latlon_fast(del,ub);
61     V=cube2latlon_fast(del,vb);

  ViewVC Help
Powered by ViewVC 1.1.22