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 | ; graph [ |
---|
22 | ; rankdir="LR", |
---|
23 | ; ] |
---|
24 | ; file_oaflux [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/lh_oaflux_2004.nc"]; |
---|
25 | ; mask [shape=ellipse,fontname=Courier,label="${PROJECT_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="${PROJECT}/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:`project_profile.sh` |
---|
45 | ; :ref:`project_init.pro` |
---|
46 | ; :ref:`cm_project.pro` |
---|
47 | ; |
---|
48 | ; :ref:`get_oaflux.sh` |
---|
49 | ; |
---|
50 | ; :func:`report <saxo:report>` |
---|
51 | ; :func:`initncdf <saxo:initncdf>` |
---|
52 | ; :func:`ncdf_lec <saxo:ncdf_lec>` |
---|
53 | ; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>` |
---|
54 | ; :func:`isadirectory <saxo:isadirectory>` |
---|
55 | ; :func:`isafile <saxo:isafile>` |
---|
56 | ; |
---|
57 | ; :ref:`TropFlux_19890101_20091231.pro` |
---|
58 | ; :ref:`interp_erai_dewt_1989_2009.pro` |
---|
59 | ; :ref:`interp_erai_lwr_1989_2009.pro` |
---|
60 | ; :ref:`interp_erai_sst_1989_2009.pro` |
---|
61 | ; :ref:`interp_erai_t2m_1989_2009.pro` |
---|
62 | ; :ref:`interp_erai_ws_1989_2009.pro` |
---|
63 | ; :ref:`interp_olr_30n30s_1989_2009.pro` |
---|
64 | ; |
---|
65 | ; EXAMPLES |
---|
66 | ; ======== |
---|
67 | ; |
---|
68 | ; :: |
---|
69 | ; |
---|
70 | ; IDL> oaflux_mask_30n30s |
---|
71 | ; |
---|
72 | ; TODO |
---|
73 | ; ==== |
---|
74 | ; |
---|
75 | ; SAXO new (keep compatibility false) |
---|
76 | ; |
---|
77 | ; coding rules |
---|
78 | ; |
---|
79 | ; pro -> function |
---|
80 | ; |
---|
81 | ; NetCDF CF (may be area_type) |
---|
82 | ; |
---|
83 | ; global attributes corrections : |
---|
84 | ; - written now : OAFLUX mask over the Indian Ocean: 40E-120E, 30S-30N |
---|
85 | ; - while data latitude=[-29.5,+29.5] longitude=[30.5,379.5] |
---|
86 | ; |
---|
87 | ; KNOWN ISSUES |
---|
88 | ; ============ |
---|
89 | ; |
---|
90 | ; test of existence of fullfilename_in not very efficient because |
---|
91 | ; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented |
---|
92 | ; |
---|
93 | ; EVOLUTIONS |
---|
94 | ; ========== |
---|
95 | ; |
---|
96 | ; $Id$ |
---|
97 | ; |
---|
98 | ; - fplod 20110411T140133Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
99 | ; |
---|
100 | ; * usage of tropflux_init and cm_project |
---|
101 | ; * replace 30N30S by 30n30s |
---|
102 | ; |
---|
103 | ; - fplod 20101217T081915Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
104 | ; |
---|
105 | ; * remove hard coded directory - usage of ${PROJECT_ID} and ${PROJECT_OD} |
---|
106 | ; * add IO test |
---|
107 | ; |
---|
108 | ; - fplod 20101216T141137Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
109 | ; |
---|
110 | ; * minimal header |
---|
111 | ; |
---|
112 | ; - jv 2010 |
---|
113 | ; |
---|
114 | ; * creation |
---|
115 | ; |
---|
116 | ;- |
---|
117 | ; |
---|
118 | PRO oaflux_mask_30n30s |
---|
119 | ; |
---|
120 | @cm_4cal |
---|
121 | @cm_4data |
---|
122 | @cm_4mesh |
---|
123 | @cm_4data |
---|
124 | @cm_project |
---|
125 | |
---|
126 | ; check for input file |
---|
127 | ; build input filename |
---|
128 | yyyy=2004 |
---|
129 | cy=string(yyyy,format='(i4.4)') |
---|
130 | filename_in='lh_oaflux_'+cy+'.nc' |
---|
131 | ; |
---|
132 | ; check if this file exists |
---|
133 | fullfilename_in = isafile(project_id_env + filename_in, NEW=0, /MUST_EXIST) |
---|
134 | IF fullfilename_in[0] EQ '' THEN BEGIN |
---|
135 | msg = 'eee : the file ' + fullfilename_in + ' was not found.' |
---|
136 | ras = report(msg) |
---|
137 | STOP |
---|
138 | ENDIF |
---|
139 | ; |
---|
140 | ; |
---|
141 | fullfilename_out=project_od_env+'mask_oaflux_30N30S.nc' |
---|
142 | ; in order to avoid unexpected overwritten |
---|
143 | IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN |
---|
144 | msg = 'eee : the file ' + fullfilename_out + ' already exists.' |
---|
145 | ras = report(msg) |
---|
146 | STOP |
---|
147 | ENDIF |
---|
148 | ; |
---|
149 | ; Read oaflux grid and mask |
---|
150 | initncdf, fullfilename_in |
---|
151 | lh=ncdf_lec(fullfilename_in,var='lhtfl',count=[jpi,jpj,1]) & lh=float(lh) |
---|
152 | valmask=1.e20 |
---|
153 | ind=where(lh ge 32000,compl=nind) & lh(ind)=valmask & lh(nind)=-0.1*lh(nind) |
---|
154 | mask_out=(lh ne valmask) |
---|
155 | domdef, 0.,360.,-30.,30. |
---|
156 | |
---|
157 | lon=reform(glamt(*,0)) |
---|
158 | ind1=where(lon le 20.) |
---|
159 | ind2=where(lon ge 30.) |
---|
160 | |
---|
161 | lat_out=reform(gphit(0,firstyt:lastyt)) |
---|
162 | |
---|
163 | lon_out=[reform(glamt(ind2,0)),reform(glamt(ind1,0))+360] |
---|
164 | |
---|
165 | mask_out=mask_out([ind2,ind1],firstyt:lastyt)*1. |
---|
166 | |
---|
167 | ncfile='!'+fullfilename_out |
---|
168 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
169 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
170 | msk_attr={long_name:'land sea mask',short_name:'msk',axis:'YX'} |
---|
171 | globattr={description:'OAFLUX mask over the Indian Ocean: 40E-120E, 30S-30N'} |
---|
172 | |
---|
173 | ncfields = '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 | |
---|
180 | END |
---|