source: trunk/src/oaflux_mask_30n30s.pro @ 152

Last change on this file since 152 was 99, checked in by pinsard, 13 years ago

suppress successive semi-column lines

File size: 4.5 KB
Line 
1;+
2;
3; .. _oaflux_mask_30n30s.pro:
4;
5; ======================
6; oaflux_mask_30n30s.pro
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;
22;       file_oaflux [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/lh_oaflux_2004.nc"];
23;       mask [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/mask_oaflux_30N30S.nc"];
24;
25;       oaflux_mask_30n30s [shape=box,
26;       fontname=Courier,
27;       color=blue,
28;       URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/oaflux_mask_30n30s.pro",
29;       label="${PROJECT}/src/oaflux_mask_30n30s.pro"];
30;
31;       {file_oaflux} -> {oaflux_mask_30n30s} -> {mask}
32;
33;      }
34;
35; SEE ALSO
36; ========
37;
38; :ref:`guide Gather data <gather_data>`
39;
40; :ref:`guide data OAFLUX <data_in_oaflux>`
41;
42; :ref:`project_profile.sh`
43; :ref:`project_init.pro`
44; :ref:`cm_project.pro`
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; $Id$
95;
96; - fplod 20110411T140133Z aedon.locean-ipsl.upmc.fr (Darwin)
97;
98;   * usage of tropflux_init and cm_project
99;   * replace 30N30S by 30n30s
100;
101; - fplod 20101217T081915Z aedon.locean-ipsl.upmc.fr (Darwin)
102;
103;   * remove hard coded directory - usage of ${PROJECT_ID} and ${PROJECT_OD}
104;   * add IO test
105;
106; - fplod 20101216T141137Z aedon.locean-ipsl.upmc.fr (Darwin)
107;
108;   * minimal header
109;
110; - jv 2010
111;
112;   * creation
113;
114;-
115;
116PRO oaflux_mask_30n30s
117;
118@cm_4cal
119@cm_4data
120@cm_4mesh
121@cm_4data
122@cm_project
123
124; check for input file
125; build input filename
126yyyy=2004
127cy=string(yyyy,format='(i4.4)')
128filename_in='lh_oaflux_'+cy+'.nc'
129;
130; check if this file exists
131fullfilename_in = isafile(project_id_env + filename_in, NEW=0, /MUST_EXIST)
132IF fullfilename_in[0] EQ '' THEN BEGIN
133   msg = 'eee : the file ' + fullfilename_in + ' was not found.'
134   ras = report(msg)
135   STOP
136ENDIF
137;
138fullfilename_out=project_od_env+'mask_oaflux_30N30S.nc'
139; in order to avoid unexpected overwritten
140IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN
141   msg = 'eee : the file ' + fullfilename_out  + ' already exists.'
142   ras = report(msg)
143   STOP
144ENDIF
145;
146; Read oaflux grid and mask
147initncdf, fullfilename_in
148lh=ncdf_lec(fullfilename_in,var='lhtfl',count=[jpi,jpj,1])
149lh=float(lh)
150valmask=1.e20
151ind=where(lh ge 32000,compl=nind)
152lh(ind)=valmask
153lh(nind)=-0.1*lh(nind)
154mask_out=(lh ne valmask)
155domdef, 0.,360.,-30.,30.
156
157lon=reform(glamt(*,0))
158ind1=where(lon le 20.)
159ind2=where(lon ge 30.)
160
161lat_out=reform(gphit(0,firstyt:lastyt))
162
163lon_out=[reform(glamt(ind2,0)),reform(glamt(ind1,0))+360]
164
165mask_out=mask_out([ind2,ind1],firstyt:lastyt)*1.
166
167ncfile='!'+fullfilename_out
168lon_attr={units:'degrees_east',long_name:'Longitude'}
169lat_attr={units:'degrees_north',long_name:'Latitude'}
170msk_attr={long_name:'land sea mask',short_name:'msk',axis:'YX'}
171globattr={description:'OAFLUX mask over the Indian Ocean: 40E-120E, 30S-30N'}
172
173ncfields = 'msk[longitude,latitude]=mask_out:msk_attr; ' $
174                      + 'longitude[]=lon_out:lon_attr; ' $
175                      + 'latitude[]=lat_out:lat_attr; ' $
176                      + ' @ globattr'
177
178@ncdf_quickwrite
179
180END
Note: See TracBrowser for help on using the repository browser.