1 | ;+ |
---|
2 | ; |
---|
3 | ; =========== |
---|
4 | ; fig_mld.pro |
---|
5 | ; =========== |
---|
6 | ; |
---|
7 | ; .. program:: fig_mld |
---|
8 | ; |
---|
9 | ; main POMME project program |
---|
10 | ; |
---|
11 | ; - read the 2 mld models :file:`${PROJECT_ID}/noeddy_mld.nc` and :file:`${PROJECT_ID}/eddy_mld.nc` |
---|
12 | ; - read mld insitu data and metadata |
---|
13 | ; - compute daily mean insitu mld data |
---|
14 | ; - compute daily mean modeled data in boxes of 1/2° and 1° around insitu |
---|
15 | ; measurement location |
---|
16 | ; - plot +todo+ |
---|
17 | ; - write :file:`${PROJECT_OD}/fig_mld.txt` containing for each day between |
---|
18 | ; 20000927 and +todo+ |
---|
19 | ; |
---|
20 | ; * time step (0 is 20000927) |
---|
21 | ; * latitude |
---|
22 | ; * longitude |
---|
23 | ; * insitu daily mean of MLD critere 01 |
---|
24 | ; * insitu daily mean of MLD critere 02 |
---|
25 | ; * insitu daily mean of MLD critere 05 |
---|
26 | ; * insitu daily mean of MLD critere 10 |
---|
27 | ; * insitu daily mean of MLD critere melch |
---|
28 | ; * model 1 mean of MLD in the box latidude+-0.5°,longitude+-.5° |
---|
29 | ; * model 2 mean of MLD in the box latidude+-0.5°,longitude+-.5° |
---|
30 | ; * model 1 stddev of MLD in the box latidude+-0.5°,longitude+-.5° |
---|
31 | ; * model 2 stddev of MLD in the box latidude+-0.5°,longitude+-.5° |
---|
32 | ; * model 1 mean of MLD in the box latidude+-1°,longitude+1° |
---|
33 | ; * model 2 mean of MLD in the box latidude+-1°,longitude+1° |
---|
34 | ; * model 1 stddev of MLD in the box latidude+-1°,longitude+1° |
---|
35 | ; * model 2 stddev of MLD in the box latidude+-1°,longitude+1° |
---|
36 | ; |
---|
37 | ; .. only:: man |
---|
38 | ; |
---|
39 | ; Figure is visible on PDF and HTML documents only. |
---|
40 | ; |
---|
41 | ; .. only:: html |
---|
42 | ; |
---|
43 | ; .. graphviz:: |
---|
44 | ; |
---|
45 | ; digraph fig_mld { |
---|
46 | ; graph [ |
---|
47 | ; rankdir="TB", |
---|
48 | ; ] |
---|
49 | ; ; |
---|
50 | ; pomme_asc [shape=ellipse,fontname=Courier,label="${VARAMMA_ID}/*.asc", |
---|
51 | ; URL="http://www.locean-ipsl.upmc.fr/~fplod/varamma/varamma_ws/doc/html/sphinx/guides/data_content.html#data_station"]; |
---|
52 | ; pomme_prn [shape=ellipse,fontname=Courier,label="${VARAMMA_ID}/*.prn", |
---|
53 | ; URL="http://www.locean-ipsl.upmc.fr/~fplod/varamma/varamma_ws/doc/html/sphinx/guides/data_content.html#data_mld_insitu"]; |
---|
54 | ; pomme_nc [shape=ellipse,fontname=Courier,label="${VARAMMA_ID}/*.nc", |
---|
55 | ; URL="http://www.locean-ipsl.upmc.fr/~fplod/varamma/varamma_ws/doc/html/sphinx/guides/data_content.html#data_mld_models"]; |
---|
56 | ; pomme_ps [shape=ellipse,fontname=Courier,label="${VARAMMA_OD}/fig_mld_valid_sta.ps"]; |
---|
57 | ; |
---|
58 | ; fig_mld [shape=box, |
---|
59 | ; fontname=Courier, |
---|
60 | ; color=blue, |
---|
61 | ; URL="http://forge.ipsl.jussieu.fr/pomme/browser/trunk/src/fig_mld.pro" |
---|
62 | ; label="${PROJECT}/src/fig_mld.pro"]; |
---|
63 | ; |
---|
64 | ; {pomme_asc pomme_prn pomme_nc} -> {fig_mld} -> {pomme_ps}; |
---|
65 | ; } |
---|
66 | ; |
---|
67 | ; :examples: |
---|
68 | ; |
---|
69 | ; .. code-block:: guess |
---|
70 | ; |
---|
71 | ; IDL> @init_pom |
---|
72 | ; IDL> fig_mld |
---|
73 | ; IDL> exit |
---|
74 | ; |
---|
75 | ; :file:`${PROJECT_OD}/fig_mld_valid_sta.ps` can be used for future work. |
---|
76 | ; |
---|
77 | ; :file:`${PROJECT_OD}/fig_mld.txt` can be used for future work (mainly |
---|
78 | ; comparison). |
---|
79 | ; |
---|
80 | ; :uses: |
---|
81 | ; |
---|
82 | ; :func:`read_ncdf <saxo:read_ncdf>` |
---|
83 | ; :func:`julday <saxo:julday>` |
---|
84 | ; :func:`plt1d <saxo:plt1d>` |
---|
85 | ; :func:`moyenne <saxo:moyenne>` |
---|
86 | ; :func:`domdef <saxo:domdef>` |
---|
87 | ; |
---|
88 | ; :func:`file_prn_to_mem` |
---|
89 | ; :func:`file_asc_to_mem` |
---|
90 | ; :func:`dmean_mld` |
---|
91 | ; :func:`join_dmean_asc` |
---|
92 | ; |
---|
93 | ; :func:`reform` |
---|
94 | ; |
---|
95 | ; :see also: |
---|
96 | ; |
---|
97 | ; figure 4 of submitted paper +todo+ |
---|
98 | ; |
---|
99 | ; :ref:`project_init.pro` |
---|
100 | ; :ref:`cm_project.pro` |
---|
101 | ; |
---|
102 | ; :todo: |
---|
103 | ; |
---|
104 | ; |
---|
105 | ; - fplod 20110426T170242Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
106 | ; |
---|
107 | ; * make it work : now pb with :: |
---|
108 | ; |
---|
109 | ; % Error: impossible to make a "t" type plot with jpt = 1 |
---|
110 | ; % Attempt to subscript MLD1 with IDAY is out of range. |
---|
111 | ; |
---|
112 | ; remove hard coded value (95) of time axe of model correction |
---|
113 | ; |
---|
114 | ; better organisation of output files |
---|
115 | ; ascii output file |
---|
116 | ; |
---|
117 | ; 250 = red |
---|
118 | ; 90 = light blue |
---|
119 | ; 150 = green |
---|
120 | ; ++ longitude should be dark blue |
---|
121 | ; ++ latitude should be orange |
---|
122 | ; |
---|
123 | ; superposer plot latitude et longitude |
---|
124 | ; |
---|
125 | ; mettre les labels et le titre des Y du plot longitude à droite |
---|
126 | ; see x recipe http://www.dfanning.com/graphics_tips/xattop.html |
---|
127 | ; |
---|
128 | ; how to avoid lines between legs without retouche++ |
---|
129 | ; |
---|
130 | ; :history: |
---|
131 | ; |
---|
132 | ; - fplod 20110426T161700Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
133 | ; |
---|
134 | ; * rely on project_init.pro instead of init_pom.pro |
---|
135 | ; * fix typo (copy/paste std1 vs mld5) |
---|
136 | ; * add init_pom |
---|
137 | ; * handle 2D vs 1D my* because ml use only delta = 0 |
---|
138 | ; |
---|
139 | ; - fplod 20101209T100325Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
140 | ; |
---|
141 | ; * align ytitles to final figures |
---|
142 | ; * add ascii output |
---|
143 | ; |
---|
144 | ; - fplod 20101208T140038Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
145 | ; |
---|
146 | ; * revision according to Marina/myself work (20101130) |
---|
147 | ; tricky convention differences on longitude between in situ and model files |
---|
148 | ; * revision according to Marina work (20101201) |
---|
149 | ; plots production, selection of delta = 1 for figure |
---|
150 | ; * add graphviz |
---|
151 | ; |
---|
152 | ; - fplod 20101129T151939Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
153 | ; |
---|
154 | ; * loop on delta |
---|
155 | ; * create output file |
---|
156 | ; * use http://www.dfanning.com/math_tips/nans.html to test *equality* to NaN |
---|
157 | ; |
---|
158 | ; - fplod 20101129T130822Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
159 | ; |
---|
160 | ; * add reading of insitu MLD data files and associated |
---|
161 | ; * use the right filenames for models |
---|
162 | ; * complete header |
---|
163 | ; |
---|
164 | ; - fplod 20101125T145638Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
165 | ; |
---|
166 | ; * add ReST minimal header |
---|
167 | ; |
---|
168 | ; - marina 20101125T130000Z |
---|
169 | ; |
---|
170 | ; * creation draft |
---|
171 | ; |
---|
172 | ;- |
---|
173 | PRO fig_mld |
---|
174 | ; |
---|
175 | compile_opt idl2, strictarrsubs |
---|
176 | ; |
---|
177 | @cm_project |
---|
178 | ; |
---|
179 | ; read MLD in insitu files and metafiles |
---|
180 | data_asc=file_asc_to_mem() |
---|
181 | data_prn=file_prn_to_mem() |
---|
182 | data_dmean=dmean_mld(data_prn) |
---|
183 | data_insitu=join_dmean_asc(data_dmean,data_asc) |
---|
184 | ; |
---|
185 | ; temps des données insitu |
---|
186 | time_insitu=data_insitu.doy |
---|
187 | ; |
---|
188 | ; build compatible insitu arrays with models arrays |
---|
189 | ndays = n_elements(time_insitu) |
---|
190 | mld1 = findgen(ndays) |
---|
191 | mld2 = findgen(ndays) |
---|
192 | mld3 = findgen(ndays) |
---|
193 | mld4 = findgen(ndays) |
---|
194 | mld5 = findgen(ndays) |
---|
195 | std1 = findgen(ndays) |
---|
196 | xlon = findgen(ndays) |
---|
197 | ylat = findgen(ndays) |
---|
198 | FOR iday=0, ndays - 1 DO BEGIN |
---|
199 | indice_insitu=WHERE(time_insitu-time_insitu[0] EQ iday,count) |
---|
200 | IF (count EQ 0) THEN BEGIN |
---|
201 | mld1[iday] = !VALUES.F_NAN |
---|
202 | mld2[iday] = !VALUES.F_NAN |
---|
203 | mld3[iday] = !VALUES.F_NAN |
---|
204 | mld4[iday] = !VALUES.F_NAN |
---|
205 | mld5[iday] = !VALUES.F_NAN |
---|
206 | std1[iday] = !VALUES.F_NAN |
---|
207 | xlon[iday] = !VALUES.F_NAN |
---|
208 | ylat[iday] = !VALUES.F_NAN |
---|
209 | ENDIF ELSE BEGIN |
---|
210 | mld1[iday] = data_insitu[indice_insitu].mean_zhom001 |
---|
211 | mld2[iday] = data_insitu[indice_insitu].mean_zhom002 |
---|
212 | mld3[iday] = data_insitu[indice_insitu].mean_zhom005 |
---|
213 | mld4[iday] = data_insitu[indice_insitu].mean_zhom010 |
---|
214 | mld5[iday] = data_insitu[indice_insitu].mean_zhomelch |
---|
215 | std1[iday] = data_insitu[indice_insitu].std_zhom001 |
---|
216 | xlon[iday] = data_insitu[indice_insitu].lon |
---|
217 | ylat[iday] = data_insitu[indice_insitu].lat |
---|
218 | ENDELSE |
---|
219 | ENDFOR |
---|
220 | ; |
---|
221 | ; compute mean of modeled MLD in boxes around lat,lon insitu data |
---|
222 | mymldm = findgen(2,ndays) |
---|
223 | mymldr = findgen(2,ndays) |
---|
224 | myvarm = findgen(2,ndays) |
---|
225 | myvarr = findgen(2,ndays) |
---|
226 | ; |
---|
227 | ; define the size of the box |
---|
228 | delta=findgen(2) |
---|
229 | delta[0] = 0.5 |
---|
230 | delta[1] = 1. |
---|
231 | ndelta=n_elements(delta) |
---|
232 | ; |
---|
233 | ; loop on delta |
---|
234 | FOR idelta=0, ndelta - 1 DO BEGIN |
---|
235 | ; loop on days |
---|
236 | FOR iday=0, ndays - 1 DO BEGIN |
---|
237 | IF (finite(mld1[iday]) NE 0) THEN BEGIN |
---|
238 | domdef |
---|
239 | mybox = [ -xlon[iday]-delta[idelta] $ |
---|
240 | , -xlon[iday]+delta[idelta] $ |
---|
241 | , ylat[iday]-delta[idelta] $ |
---|
242 | , ylat[iday]+delta[idelta] $ |
---|
243 | ] |
---|
244 | |
---|
245 | jt = time_insitu[iday]+95 |
---|
246 | mldm_box = reform(read_ncdf('mld', jt, /timestep, file=project_id_env+'eddy_mld.nc', /nostruct, box = mybox)) |
---|
247 | mldr_box = reform(read_ncdf('mld', jt, /timestep, file=project_id_env+'noeddy_mld.nc', /nostruct, box = mybox)) |
---|
248 | |
---|
249 | mymldm[idelta,iday] = moyenne(mldm_box, box = mybox, 'xy') |
---|
250 | mymldr[idelta,iday] = moyenne(mldr_box, box = mybox, 'xy') |
---|
251 | myvarm[idelta,iday] = stddev(mldm_box) |
---|
252 | myvarr[idelta,iday] = stddev(mldr_box) |
---|
253 | ENDIF ELSE BEGIN |
---|
254 | mymldm[idelta,iday] = !VALUES.F_NAN |
---|
255 | mymldr[idelta,iday] = !VALUES.F_NAN |
---|
256 | myvarm[idelta,iday] = !VALUES.F_NAN |
---|
257 | myvarr[idelta,iday] = !VALUES.F_NAN |
---|
258 | ENDELSE |
---|
259 | ENDFOR |
---|
260 | ENDFOR |
---|
261 | ; |
---|
262 | ; plot: |
---|
263 | ; selection de la partie qui nous interesse: |
---|
264 | ind = where(finite(mld1) NE 0) |
---|
265 | mld1 = mld1[ind] |
---|
266 | std1 = std1[ind] |
---|
267 | mymldm_1d = mymldm[0, *] |
---|
268 | mymldm_1d = mymldm[ind] |
---|
269 | mymldr_1d = mymldr[0, *] |
---|
270 | mymldr_1d = mymldr[ind] |
---|
271 | |
---|
272 | myvarm_1d = myvarm[0, *] |
---|
273 | myvarm_1d = myvarm[ind] |
---|
274 | myvarr_1d = myvarr[0, *] |
---|
275 | myvarr_1d = myvarr[ind] |
---|
276 | |
---|
277 | time=julday(01,01,2001)+time_insitu |
---|
278 | time_save = time |
---|
279 | jpt_save = n_elements(time) |
---|
280 | time = time[ind] |
---|
281 | jpt=n_elements(time) |
---|
282 | |
---|
283 | |
---|
284 | ;++ ok openps, project_od_env+'fig_mld_valid_sta.ps' |
---|
285 | plt1d, -mld1, 't', -300, 0, ytitle="meters", title='MLD along cruise track', color = 10, small = [1, 2, 1] |
---|
286 | polyfill, [time, reverse(time)], [(-mymldm_1d-myvarm_1d),reverse(-mymldm_1d+myvarm_1d)], color = 250 |
---|
287 | polyfill, [time, reverse(time)], [(-mymldr_1d-myvarr_1d),reverse(-mymldr_1d+myvarr_1d)], color = 150 |
---|
288 | polyfill, [time, reverse(time)], [(-mld1-std1),reverse(-mld1+std1)], color = 90 |
---|
289 | plt1d, -mymldr_1d, 't', /ov1d, line = 2 |
---|
290 | plt1d, -mld1, 't', /ov1d |
---|
291 | plt1d, -mymldm_1d, 't', /ov1d, line = 1 |
---|
292 | |
---|
293 | time = time_save |
---|
294 | jpt = jpt_save |
---|
295 | plt1d, ylat, 't', title='', ytitle='latitude', color=250, small = [3, 2, 4], /noerase |
---|
296 | plt1d, xlon, 't', title='', ytitle='longitude', color=90 , small = [3, 2, 6], /noerase |
---|
297 | closeps |
---|
298 | |
---|
299 | ; |
---|
300 | ; Write results in ${PROJECT_OD}/fig_mld.txt |
---|
301 | fullfilename=project_od_env+'fig_mld.txt' |
---|
302 | OPENW, lun, fullfilename, /GET_LUN |
---|
303 | ;++ hanlde error |
---|
304 | ; |
---|
305 | header='jt xlon xlat mld1 mld2 mld3 mld4 mld5 mymldm_0 mymldr_0 myvarm_0 myvarr_0 mymldm_1 mymldr_1 myvarm_1 myvarr_1' |
---|
306 | ; write header |
---|
307 | printf, lun, header |
---|
308 | ; |
---|
309 | ; write data lines |
---|
310 | FOR iday=0, ndays - 1 DO BEGIN |
---|
311 | printf, lun $ |
---|
312 | , iday $ |
---|
313 | , xlon[iday] $ |
---|
314 | , ylat[iday] $ |
---|
315 | , mld1[iday] $ |
---|
316 | , mld2[iday] $ |
---|
317 | , mld3[iday] $ |
---|
318 | , mld4[iday] $ |
---|
319 | , mld5[iday] $ |
---|
320 | , mymldm[0,iday] $ |
---|
321 | , mymldr[0,iday] $ |
---|
322 | , myvarm[0,iday] $ |
---|
323 | , myvarr[0,iday] $ |
---|
324 | , mymldm[1,iday] $ |
---|
325 | , mymldr[1,iday] $ |
---|
326 | , myvarm[1,iday] $ |
---|
327 | , myvarr[0,iday] $ |
---|
328 | , mymldm[1,iday] $ |
---|
329 | , mymldr[1,iday] $ |
---|
330 | , myvarm[1,iday] $ |
---|
331 | , myvarr[1,iday] |
---|
332 | ENDFOR |
---|
333 | ; |
---|
334 | ; close file |
---|
335 | FREE_LUN, lun |
---|
336 | |
---|
337 | END |
---|