/[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.5 - (hide annotations) (download)
Fri Jul 22 14:47:57 2016 UTC (9 years ago) by gforget
Branch: MAIN
Changes since 1.4: +5 -4 lines
- avoid using deg2rad that now tests for input type (issue reported by L. Lundgren).

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 gforget 1.4 % LONS_MASKS that will be added to mygrid.
6 gforget 1.1 %optional input:
7     % LATS_VAL is the latitudes vector ([-89:89]' by default)
8 gforget 1.4 % LONS_VAL is the latitudes vector ([-179.5:179.5]' by default)
9 gforget 1.1
10     global mygrid;
11    
12     if nargin>0; LATS_VAL=varargin{1}; else; LATS_VAL=[-89:89]'; end;
13 gforget 1.4 if nargin>1; LONS_VAL=varargin{2}; else; LONS_VAL=[-179.5:179.5]'; end;
14    
15     if iscell(LONS_VAL);
16     warning('gcmfaces_lines_zonal now takes LONS_VAL as 2nd argument');
17     LONS_VAL=[-179.5:179.5]';
18     end;
19    
20     MSKS_NAM={'mskCint','mskCedge','mskWedge','mskSedge'};
21 gforget 1.1
22     for iy=1:length(LATS_VAL);
23 gforget 1.2
24     mskCint=1*(mygrid.YC>=LATS_VAL(iy));
25     [mskCedge,mskWedge,mskSedge]=gcmfaces_edge_mask(mskCint);
26    
27 gforget 1.3 for im=1:length(MSKS_NAM);
28     eval(['tmp1.' MSKS_NAM{im} '=' MSKS_NAM{im} ';']);
29     end;
30     tmp1.lat=LATS_VAL(iy);
31    
32 gforget 1.1 %store:
33     if iy==1;
34 gforget 1.3 LATS_MASKS=tmp1;
35 gforget 1.1 else;
36 gforget 1.3 LATS_MASKS(iy)=tmp1;
37 gforget 1.1 end;
38    
39     end;
40    
41 gforget 1.5 d2r=pi/180;
42 gforget 1.4 for iy=1:length(LONS_VAL);
43    
44 gforget 1.5 mskCint=1*(sin(d2r*(mygrid.XC-LONS_VAL(iy)))>=0);
45 gforget 1.4 [mskCedge,mskWedge,mskSedge]=gcmfaces_edge_mask(mskCint);
46 gforget 1.5 tmp1=1*(cos(d2r*(mygrid.XC-LONS_VAL(iy)))>0);
47 gforget 1.4 mskCedge=mskCedge.*tmp1;
48 gforget 1.5 tmp1=1*(cos(d2r*(mygrid.XG-LONS_VAL(iy)))>0);
49 gforget 1.4 mskWedge=mskWedge.*tmp1;
50 gforget 1.5 tmp1=1*(cos(d2r*(mygrid.XC-LONS_VAL(iy)))>0);
51 gforget 1.4 mskSedge=mskSedge.*tmp1;
52    
53     clear tmp1;
54     for im=1:length(MSKS_NAM);
55     eval(['tmp1.' MSKS_NAM{im} '=' MSKS_NAM{im} ';']);
56     end;
57     tmp1.lon=LONS_VAL(iy);
58    
59     %store:
60     if iy==1;
61     LONS_MASKS=tmp1;
62     else;
63     LONS_MASKS(iy)=tmp1;
64     end;
65    
66     end;
67    
68 gforget 1.1 mygrid.LATS_MASKS=LATS_MASKS;
69 gforget 1.4 mygrid.LONS_MASKS=LONS_MASKS;
70     mygrid.LATS=[mygrid.LATS_MASKS.lat]';
71     mygrid.LONS=[mygrid.LONS_MASKS.lon]';
72 gforget 1.1

  ViewVC Help
Powered by ViewVC 1.1.22