Back to home page

MITgcm

 
 

    


Warning, /utils/matlab/cs_grid/uvcube2latlongrid.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
9d7ae97fe2 Jean*0001 function [U,V] = uvcube2latlongrid(del,u,v,XG,YG,RAC,dxG,dyG)
                0002 % [ui,vi]=cube2latlongrid(del,u,v,xg,yg,rac,dxg,dyg)
                0003 %
                0004 % Re-grids model output on expanded spherical cube to lat-lon grid.
                0005 %  del     pre-processed transformation data
                0006 %  u,v     is a 2-D or 3-D horizontal components of model flow fields.
                0007 %  xg,yg   coordinates of cell corners
                0008 %  rac     grid cell areas
                0009 %  dxg,dyg distances between cell corners
                0010 %  ui,vi are the flow fields with dimensions of size(xi) x size(yi) size(u,3).
                0011 %
                0012 % e.g.
                0013 %
                0014 % Getting the transfer matrix:
                0015 % >> xc=rdmds('XC');
                0016 % >> yc=rdmds('YC');
                0017 % >> xi=-179:2:180;yi=-89:2:90;
                0018 % >> del=cube2latlon_preprocess(xc,yc,xi,yi);
                0019 %
                0020 % Moving u,v:
                0021 % >> XG=rdmds('XG');
                0022 % >> YG=rdmds('YG');
                0023 % >> RAC=rdmds('RAC');
                0024 % >> dxG=rdmds('dxG');
                0025 % >> dyG=rdmds('dyG');
                0026 % >> u=rdmds('uVeltave.0000513360');
                0027 % >> v=rdmds('vVeltave.0000513360');
                0028 % >> [ui,vi]=uvcube2latlongrid(del,u,v,XG,YG,RAC,dxG,dyG);
                0029 
                0030 % Written by gmaze@mit.edu, 2007
                0031 [nnx ny nz]=size(u);
                0032 
                0033 for iz = 1 : nz
                0034   
                0035 % Get the angles:
                0036 [AngleCS,AngleSN] = cubeCalcAngle(YG,RAC,dxG,dyG);
                0037 
                0038 % Rotate vectors:
                0039 [uE,vN] = rotate_uv2uvEN(squeeze(u(:,:,iz)),squeeze(v(:,:,iz)),AngleCS,AngleSN,'C');
                0040 
                0041 % Move to lat/lon:
                0042 U(:,:,iz) = cube2latlon_fast(del,uE);
                0043 V(:,:,iz) = cube2latlon_fast(del,vN);
                0044 
                0045 end %or iz