/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_calc/gcmfaces_lines_zonal.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/gcmfaces_calc/gcmfaces_lines_zonal.m

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


Revision 1.1 - (hide annotations) (download)
Fri Jun 24 17:02:05 2011 UTC (14 years, 1 month ago) by gforget
Branch: MAIN
- add headers to gecmfaces_calc routines
- move line_greatC_TUV_mask.m, line_zonal_TUV_MASKS.m, line_zonal_TUV_mask.m to gcmfaces_legacy
- add replacements gcmfaces_calc/gcmfaces_lines_transp.m and gcmfaces_calc/gcmfaces_lines_zonal.m
- now the zonal and transport 'lines' masks are added to mygrid as LATS_MASKS and LINES_MASKS
- accordingly, the old LATS_MASKS is removed from arguments list in calc_overturn.m etc.
  (calc_transports and basic_diags_display_transport still have LINES_MASKS args. for now)
  and basic_diags_compute_v3_or_v4.m etc. now call gcmfaces_lines_zonal and gcmfaces_lines_transp.
- line_greatC_TUV_MASKS_v3.m and line_greatC_TUV_MASKS_v4.m now are in sample_analysis
  and they simply output the 'lines' definitions (rather than the masks off gcmfaces_lines_transp)

1 gforget 1.1 function []=gcmfaces_lines_zonal(varargin);
2     %object: define the set of quasi longitudinal lines
3     % along which transports will integrated;
4     % LATS_MASKS that will be added to mygrid.
5     %optional input:
6     % LATS_VAL is the latitudes vector ([-89:89]' by default)
7    
8     global mygrid;
9    
10     if nargin>0; LATS_VAL=varargin{1}; else; LATS_VAL=[-89:89]'; end;
11    
12     for iy=1:length(LATS_VAL);
13    
14     %pre-requisites
15     yy=LATS_VAL(iy);
16     y=mygrid.YC;
17     yP1=exch_T_N(y);
18    
19     %T part:
20     mm=yP1<=yy; mm(isnan(mm))=0;
21     for iF=1:y.nFaces;
22     eval(['tmp1=mm.f' num2str(iF) ';']);
23     tmp2=circshift(tmp1,[-1 0])+circshift(tmp1,[1 0])+...
24     circshift(tmp1,[0 -1])+circshift(tmp1,[0 1]);
25     tmp2(tmp1>0)=0; tmp2(tmp2~=0)=1; tmp2(tmp2==0)=NaN;
26     eval(['mm.f' num2str(iF) '=tmp2(2:end-1,2:end-1);']);
27     end;
28     mmt=mm;
29    
30     %UV part:
31     nn=exch_T_N(mmt);
32     mm=yP1<=yy; mm(isnan(mm))=0;
33     mmu=y; mmv=y;
34     for iFace=1:y.nFaces;
35     iF=num2str(iFace);
36     eval(['tmp_u=mm.f' iF '(1:end-1,:)==1&nn.f' iF '(2:end,:)==1;']);
37     eval(['tmp_u2=mm.f' iF '(2:end,:)==1&nn.f' iF '(1:end-1,:)==1;']);
38     tmp_u=1*(tmp_u(1:end-1,2:end-1)-tmp_u2(1:end-1,2:end-1)); eval(['mmu.f' iF '=tmp_u;']);
39     eval(['tmp_v=mm.f' iF '(:,1:end-1)==1&nn.f' iF '(:,2:end)==1;']);
40     eval(['tmp_v2=mm.f' iF '(:,2:end)==1&nn.f' iF '(:,1:end-1)==1;']);
41     tmp_v=1*(tmp_v(2:end-1,1:end-1)-tmp_v2(2:end-1,1:end-1)); eval(['mmv.f' iF '=tmp_v;']);
42     end;
43     mmu(mmu==0)=NaN; mmv(mmv==0)=NaN;
44    
45     %store:
46     if iy==1;
47     LATS_MASKS=struct('mmt',mmt,'mmu',mmu,'mmv',mmv,'lat',LATS_VAL(iy));
48     else;
49     LATS_MASKS(iy)=struct('mmt',mmt,'mmu',mmu,'mmv',mmv,'lat',LATS_VAL(iy));
50     end;
51    
52     end;
53    
54     mygrid.LATS_MASKS=LATS_MASKS;
55    
56    

  ViewVC Help
Powered by ViewVC 1.1.22