/[MITgcm]/MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/uvcube2latlon_fast.m
ViewVC logotype

Contents of /MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/uvcube2latlon_fast.m

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


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue Nov 11 18:08:08 2003 UTC (21 years, 8 months ago) by cnh
Branch: MAIN, initial
CVS Tags: baseline, HEAD
Changes since 1.1: +0 -0 lines
Checking in work done with Dimitri on high-resolution cube gridding and parallel 
communications. 
   o code is in a contrib experiment for now so we can continue collaborating
     on it. However most code is general and will be moved into main branch once 
     it is fully hardened.
   o There are README files in the contrib root and in the subdirectories that
     explain the contents

1 function [U,V] = uvcube2latlon_fast(del,u,v)
2 % [ui,vi]=cube2latlon_fast(del,u,v);
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 % $Header: /u/gcmpack/models/MITgcmUV/utils/matlab/uvcube2latlon.m,v 1.4 2001/08/28 18:16:40 adcroft Exp $
19
20 NN=size(u);
21 [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 U=reshape(U,[nnx NN(2:end)]);
55 V=reshape(V,[nnx NN(2:end)]);
56
57 U=cube2latlon_fast(del,U);
58 V=cube2latlon_fast(del,V);

  ViewVC Help
Powered by ViewVC 1.1.22