source: trunk/src/oaflux_mask_30N30S.pro @ 29

Last change on this file since 29 was 20, checked in by pinsard, 13 years ago

sphinx intermapping with SAXO

File size: 5.6 KB
Line 
1;+
2;
3; .. _oaflux_mask_30N30S.pro:
4;
5; =================================================================
6; oaflux_mask_30N30S.pro -- OAFLUX mask over global tropical oceans
7; =================================================================
8;
9; Produce a NetCDF file with OAFLUX mask over global tropical oceans (30N-30S)
10;
11; .. note::
12;
13;    Longitude range [30.5,379.5] was choosen in order not to make any cut in
14;    the Atlantic Ocean.
15;    Otherwise if we choose longitude range to [0.5,359.5], Atlantic Ocean
16;    will be split to two and will appear on right and left sides of the map.
17;
18; .. graphviz::
19;
20;    digraph oaflux_mask_30N30S {
21;       graph [
22;       rankdir="LR",
23;       ]
24;       file_oaflux [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/lh_oaflux_2004.nc"];
25;       mask [shape=ellipse,fontname=Courier,label="${TROPFLUX_OD}/mask_oaflux_30N30S.nc"];
26;
27;       oaflux_mask_30N30S [shape=box,
28;       fontname=Courier,
29;       color=blue,
30;       URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/oaflux_mask_30N30S.pro",
31;       label="${TROPFLUX}/src/oaflux_mask_30N30S.pro"];
32;
33;       {file_oaflux} -> {oaflux_mask_30N30S} -> {mask}
34;
35;      }
36;
37; SEE ALSO
38; ========
39;
40; :ref:`guide Gather data <gather_data>`
41;
42; :ref:`guide data OAFLUX <data_in_oaflux>`
43;
44; :ref:`tropflux_profile.sh`
45;
46; :ref:`get_oaflux.sh`
47;
48; :func:`report <saxo:report>`
49; :func:`initncdf <saxo:initncdf>`
50; :func:`ncdf_lec <saxo:ncdf_lec>`
51; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>`
52; :func:`isadirectory <saxo:isadirectory>`
53; :func:`isafile <saxo:isafile>`
54;
55; :ref:`TropFlux_19890101_20091231.pro`
56; :ref:`interp_erai_dewt_1989_2009.pro`
57; :ref:`interp_erai_lwr_1989_2009.pro`
58; :ref:`interp_erai_sst_1989_2009.pro`
59; :ref:`interp_erai_t2m_1989_2009.pro`
60; :ref:`interp_erai_ws_1989_2009.pro`
61; :ref:`interp_olr_30n30s_1989_2009.pro`
62;
63; EXAMPLES
64; ========
65;
66; ::
67;
68;  IDL> oaflux_mask_30N30S
69;
70; TODO
71; ====
72;
73; SAXO new (keep compatibility false)
74;
75; coding rules
76;
77; pro -> function
78;
79; NetCDF CF (may be area_type)
80;
81; global attributes corrections :
82;  - written now : OAFLUX mask over the Indian Ocean: 40E-120E, 30S-30N
83;  - while data latitude=[-29.5,+29.5] longitude=[30.5,379.5]
84;
85; KNOWN ISSUES
86; ============
87;
88; test of existence of fullfilename_in not very efficient because
89; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented
90;
91; EVOLUTIONS
92; ==========
93;
94; - fplod 20101217T081915Z aedon.locean-ipsl.upmc.fr (Darwin)
95;
96;   * remove hard coded directory - usage of ${TROPFLUX_ID} and ${TROPFLUX_OD}
97;   * add IO test
98;
99; - fplod 20101216T141137Z aedon.locean-ipsl.upmc.fr (Darwin)
100;
101;   * minimal header
102;
103; - jv 2010
104;
105;   * creation
106;
107;-
108;
109PRO oaflux_mask_30N30S
110;
111@common
112;
113; check for input file
114;
115; test if ${TROPFLUX_ID} defined
116tropflux_id_env=GETENV('TROPFLUX_ID')
117CASE tropflux_id_env OF
118    ''  :  BEGIN
119     msg = 'eee : ${TROPFLUX_ID} is not defined'
120     ras = report(msg)
121     STOP
122           END
123 ELSE: BEGIN
124     msg = 'iii : ${TROPFLUX_ID} is ' + tropflux_id_env
125     ras = report(msg)
126       END
127ENDCASE
128;
129iodirin = isadirectory(tropflux_id_env)
130;
131; existence and protection of ${TROPFLUX_ID}
132IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN
133   msg = 'eee : the directory' + iodirin  + ' is not accessible.'
134   ras = report(msg)
135   STOP
136ENDIF
137;
138; build input filename
139yyyy=2004
140cy=string(yyyy,format='(i4.4)')
141filename_in='lh_oaflux_'+cy+'.nc'
142;
143; check if this file exists
144fullfilename_in = isafile(iodirin + filename_in, NEW=0, /MUST_EXIST)
145IF fullfilename_in[0] EQ '' THEN BEGIN
146   msg = 'eee : the file ' + fullfilename_in + ' was not found.'
147   ras = report(msg)
148   STOP
149ENDIF
150;
151; test if ${TROPFLUX_OD} defined
152tropflux_od_env=GETENV('TROPFLUX_OD')
153CASE tropflux_od_env OF
154  '' : BEGIN
155   msg = 'eee : ${TROPFLUX_OD} is not defined'
156   ras = report(msg)
157   STOP
158       END
159ELSE: BEGIN
160   msg = 'iii : ${TROPFLUX_OD} is ' + tropflux_od_env
161   ras = report(msg)
162        END
163ENDCASE
164;
165; check if output data will be possible
166iodirout = isadirectory(tropflux_od_env)
167;
168; existence and protection
169IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN
170   msg = 'eee : the directory' + iodirout  + ' was not found.'
171   ras = report(msg)
172   STOP
173ENDIF
174;
175fullfilename_out=iodirout+'mask_oaflux_30N30S.nc'
176; in order to avoid unexpected overwritten
177IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN
178   msg = 'eee : the file ' + fullfilename_out  + ' already exists.'
179   ras = report(msg)
180   STOP
181ENDIF
182;
183; Read oaflux grid and mask
184initncdf, fullfilename_in
185lh=ncdf_lec(fullfilename_in,var='lhtfl',count=[jpi,jpj,1]) & lh=float(lh)
186valmask=1.e20
187ind=where(lh ge 32000,compl=nind) & lh(ind)=valmask & lh(nind)=-0.1*lh(nind)
188mask_out=(lh ne valmask)
189domdef, 0.,360.,-30.,30.
190
191lon=reform(glamt(*,0))
192ind1=where(lon le 20.)
193ind2=where(lon ge 30.)
194
195lat_out=reform(gphit(0,firstyt:lastyt))
196
197lon_out=[reform(glamt(ind2,0)),reform(glamt(ind1,0))+360]
198
199mask_out=mask_out([ind2,ind1],firstyt:lastyt)*1.
200
201
202ncfile='!'+fullfilename_out
203lon_attr={units:'degrees_east',long_name:'Longitude'}
204lat_attr={units:'degrees_north',long_name:'Latitude'}
205msk_attr={long_name:'land sea mask',short_name:'msk',axis:'YX'}
206globattr={description:'OAFLUX mask over the Indian Ocean: 40E-120E, 30S-30N'}
207
208ncfields = 'msk[longitude,latitude]=mask_out:msk_attr; ' $
209                      + 'longitude[]=lon_out:lon_attr; ' $
210                      + 'latitude[]=lat_out:lat_attr; ' $
211                      + ' @ globattr'
212
213@ncdf_quickwrite
214
215END
Note: See TracBrowser for help on using the repository browser.