1 | ;+ |
---|
2 | ; |
---|
3 | ; .. _TropFlux_19890101_20091231.pro: |
---|
4 | ; |
---|
5 | ; ============================== |
---|
6 | ; TropFlux_19890101_20091231.pro |
---|
7 | ; ============================== |
---|
8 | ; |
---|
9 | ; This program computes net heat flux components on the 1° oaflux grid. |
---|
10 | ; |
---|
11 | ; all input variables are corrected for mean bias and variability. |
---|
12 | ; |
---|
13 | ; gustiness correction is applied for wind speed based on cronin's climatological |
---|
14 | ; gustiness values. |
---|
15 | ; |
---|
16 | ; :file:`${PROJECT_ID}/mask_oaflux_30N30S.nc` |
---|
17 | ; containing |
---|
18 | ; OAFLUX grid |
---|
19 | ; has been produced by |
---|
20 | ; :ref:`oaflux_mask_30N30S.pro`. |
---|
21 | ; |
---|
22 | ; :file:`${PROJECT_OD}/TropFlux_sst_19890101_20091231.nc` |
---|
23 | ; containing |
---|
24 | ; sst corrected on OAFLUX grid |
---|
25 | ; has been produced by |
---|
26 | ; :ref:`sst_correction_ncdf.pro`. |
---|
27 | ; |
---|
28 | ; :file:`${PROJECT_OD}/TropFlux_ws_19890101_20091231.nc` |
---|
29 | ; containing |
---|
30 | ; ws corrected on OAFLUX grid |
---|
31 | ; has been produced by |
---|
32 | ; :ref:`ws_correction_ncdf.pro`. |
---|
33 | ; |
---|
34 | ; :file:`${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc` |
---|
35 | ; containing |
---|
36 | ; ++ |
---|
37 | ; has been produced by |
---|
38 | ; :ref:`cronin_gustiness_ncdf.pro`. |
---|
39 | ; |
---|
40 | ; :file:`${PROJECT_OD}/TropFlux_swr_19890101_20091231_BLND.nc` |
---|
41 | ; containing |
---|
42 | ; ws corrected on OAFLUX grid |
---|
43 | ; has been produced by |
---|
44 | ; :ref:`TropFlux_swr_BLND_19890101_20091231.pro`. |
---|
45 | ; |
---|
46 | ; :file:`${PROJECT_OD}/TropFlux_lwr_19890101_20091231.nc` |
---|
47 | ; containing |
---|
48 | ; lwr corrected on OAFLUX grid |
---|
49 | ; has been produced by |
---|
50 | ; :ref:`lwr_correction_ncdf.pro`. |
---|
51 | ; |
---|
52 | ; containing |
---|
53 | ; t2m corrected on OAFLUX grid |
---|
54 | ; has been produced by |
---|
55 | ; :ref:`t2m_correction_ncdf.pro`. |
---|
56 | ; |
---|
57 | ; :file:`${PROJECT_OD}/TropFlux_q2m_19890101_20091231.nc` |
---|
58 | ; containing |
---|
59 | ; q2m corrected on OAFLUX grid |
---|
60 | ; has been produced by |
---|
61 | ; :ref:`d2m_to_q2m_erai.pro`. |
---|
62 | ; |
---|
63 | ; net heat flux components are written |
---|
64 | ; in :file:`${PROJECT_OD}/TropFlux_19890101_20091231_coarev3.nc` |
---|
65 | ; if this file not already exists. |
---|
66 | ; |
---|
67 | ; This output file |
---|
68 | ; :file:`${PROJECT_OD}/TropFlux_19890101_20091231_coarev3.nc` |
---|
69 | ; will be used by |
---|
70 | ; :ref:`TropFlux_NRT_ncdf.pro`. |
---|
71 | ; |
---|
72 | ; .. graphviz:: |
---|
73 | ; |
---|
74 | ; digraph tropflux_19890101_20091231 { |
---|
75 | ; |
---|
76 | ; mask [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/mask_oaflux_30N30S.nc"]; |
---|
77 | ; file_sst [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_sst_19890101_20091231.nc"]; |
---|
78 | ; file_ws [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_ws_19890101_20091231.nc"]; |
---|
79 | ; file_wg [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc"]; |
---|
80 | ; file_swr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_19890101_20091231_BLND.nc"]; |
---|
81 | ; file_lwr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_lwr_19890101_20091231.nc"]; |
---|
82 | ; file_t2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_t2m_19890101_20091231.nc"]; |
---|
83 | ; file_q2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_q2m_19890101_20091231.nc"]; |
---|
84 | ; |
---|
85 | ; file_out[shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_19890101_20091231_coarev3.nc"]; |
---|
86 | ; |
---|
87 | ; tropflux_19890101_20091231 [shape=box, |
---|
88 | ; fontname=Courier, |
---|
89 | ; color=blue, |
---|
90 | ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/TropFlux_19890101_20091231.pro", |
---|
91 | ; label="${PROJECT}/src/TropFlux_19890101_20091231.pro"]; |
---|
92 | ; |
---|
93 | ; {mask file_sst file_ws file_wg file_swr file_lwr file_t2m file_q2m} -> {tropflux_19890101_20091231} -> {file_out} |
---|
94 | ; |
---|
95 | ; } |
---|
96 | ; |
---|
97 | ; SEE ALSO |
---|
98 | ; ======== |
---|
99 | ; |
---|
100 | ; :ref:`project_profile.sh` |
---|
101 | ; |
---|
102 | ; :func:`report <saxo:report>` |
---|
103 | ; :func:`isadirectory <saxo:isadirectory>` |
---|
104 | ; :func:`isafile <saxo:isafile>` |
---|
105 | ; :func:`initncdf <saxo:initncdf>` |
---|
106 | ; :func:`ncdf_lec <saxo:ncdf_lec>` |
---|
107 | ; :func:`read_ncdf <saxo:read_ncdf>` |
---|
108 | ; :func:`caldat <saxo:caldat>` |
---|
109 | ; :func:`julday <saxo:julday>` |
---|
110 | ; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>` |
---|
111 | ; |
---|
112 | ; :func:`qsee` |
---|
113 | ; :func:`lwnet_clark` |
---|
114 | ; :func:`calc_claud_vlat` |
---|
115 | ; :func:`cor30a` |
---|
116 | ; |
---|
117 | ; .. note:: |
---|
118 | ; |
---|
119 | ; :func:`lwdown_clark` is not used here but available. |
---|
120 | ; |
---|
121 | ; EXAMPLES |
---|
122 | ; ======== |
---|
123 | ; |
---|
124 | ; :: |
---|
125 | ; |
---|
126 | ; IDL> .compile TropFlux_19890101_20091231 |
---|
127 | ; IDL> tropflux_19890101_20091231 |
---|
128 | ; |
---|
129 | ; TODO |
---|
130 | ; ==== |
---|
131 | ; |
---|
132 | ; describe usage of tau |
---|
133 | ; |
---|
134 | ; make it work :: |
---|
135 | ; |
---|
136 | ; % Compiled module: EXTRAPOLATE. |
---|
137 | ; % Attempt to subscript LAND with OK is out of range. |
---|
138 | ; % Execution halted at: EXTRAPOLATE 176 |
---|
139 | ; /usr/home/fplod/SAXO_DIR/SRC/Interpolation/extrapolate.pro |
---|
140 | ; % TROPFLUX_19890101_20091231 450 |
---|
141 | ; /usr/home/fplod/incas/tropflux/tropflux_ws/src/TropFlux_19890101_20091231.p |
---|
142 | ; ro |
---|
143 | ; % $MAIN$ |
---|
144 | ; % Program caused arithmetic error: Floating overflow |
---|
145 | ; % Program caused arithmetic error: Floating illegal operand |
---|
146 | ; |
---|
147 | ; the incriminated line is :: |
---|
148 | ; |
---|
149 | ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,1)) & tab(ocean)=x & m=fi nite(tab) & tab=extrapolate(tab,m) & lwr(*,*,jt)=tab*msk+valmask*(1-msk) |
---|
150 | ; |
---|
151 | ; to make progress I DO NOT extrapolate anymore lwr, sen and lat |
---|
152 | ; !!!!! must be reactivated |
---|
153 | ; |
---|
154 | ; when I DO NOT extrapolate lwr, sen and lat , program end with :: |
---|
155 | ; |
---|
156 | ; Written to |
---|
157 | ; !/usr/work/incas/fplod/tropflux_d/TropFlux_19890101_20091231_coarev3.nc |
---|
158 | ; ------------------------- |
---|
159 | ; % Program caused arithmetic error: Floating divide by 0 |
---|
160 | ; % Program caused arithmetic error: Floating underflow |
---|
161 | ; % Program caused arithmetic error: Floating overflow |
---|
162 | ; % Program caused arithmetic error: Floating illegal operand |
---|
163 | ; |
---|
164 | ; explain why :func:`lwdown_clark` is not used |
---|
165 | ; |
---|
166 | ; check if K or °C in input |
---|
167 | ; |
---|
168 | ; get rid of:: |
---|
169 | ; |
---|
170 | ; % date 1: 19880101 is not found in the time axis. |
---|
171 | ; |
---|
172 | ; why :: |
---|
173 | ; |
---|
174 | ; da1=19880101 |
---|
175 | ; |
---|
176 | ; 1st date 19890101 no ? |
---|
177 | ; |
---|
178 | ; why da1-1 (with da1=19880101) when reading gustiness file :: |
---|
179 | ; |
---|
180 | ; wg=read_ncdf('wg',da1-1,da2,file=fullfilename_wg,/nostr) |
---|
181 | ; |
---|
182 | ; avoid mix lower/uppercase in pro name to avoid compile |
---|
183 | ; |
---|
184 | ; coding rules |
---|
185 | ; |
---|
186 | ; KNOWN ISSUES |
---|
187 | ; ============ |
---|
188 | ; |
---|
189 | ; test of existence of fullfilename_msk not very efficient because |
---|
190 | ; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented |
---|
191 | ; |
---|
192 | ; EVOLUTIONS |
---|
193 | ; ========== |
---|
194 | ; |
---|
195 | ; $Id |
---|
196 | ; |
---|
197 | ; $URL$ |
---|
198 | ; |
---|
199 | ; - fplod 20110830T135832Z cratos (Linux) |
---|
200 | ; |
---|
201 | ; * replace tt by time |
---|
202 | ; |
---|
203 | ; - fplod 20110830T084129Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
204 | ; |
---|
205 | ; * add tau in ouptut file |
---|
206 | ; |
---|
207 | ; - fplod 20110822T090838Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
208 | ; |
---|
209 | ; * split some multiple lines statement to investigate |
---|
210 | ; pb of extropalation for lwr |
---|
211 | ; |
---|
212 | ; - fplod 20110819T144332Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
213 | ; |
---|
214 | ; * add _coarev3 to filename output |
---|
215 | ; * check if filename output exists |
---|
216 | ; |
---|
217 | ; - fplod 20110809T110911Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
218 | ; |
---|
219 | ; * complete descritption |
---|
220 | ; * remove v* from filenames (in and out) |
---|
221 | ; * usage of ${PROJECT_OD} |
---|
222 | ; * remove return statement |
---|
223 | ; * add test on IO files |
---|
224 | ; |
---|
225 | ; - fplod 20101217T140745Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
226 | ; |
---|
227 | ; * remove hard coded directory for mask_oaflux_30N30S.nc |
---|
228 | ; |
---|
229 | ; - fplod 20101214T112131Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
230 | ; |
---|
231 | ; * add graph |
---|
232 | ; |
---|
233 | ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
234 | ; |
---|
235 | ; * minimal header |
---|
236 | ; |
---|
237 | ; - pbk 2008 |
---|
238 | ; |
---|
239 | ; * creation |
---|
240 | ; |
---|
241 | ;- |
---|
242 | ; |
---|
243 | pro TropFlux_19890101_20091231 |
---|
244 | ; |
---|
245 | @cm_4cal |
---|
246 | @cm_4data |
---|
247 | @cm_4mesh |
---|
248 | @cm_4data |
---|
249 | @cm_project |
---|
250 | ; |
---|
251 | ; check for input directory |
---|
252 | ; |
---|
253 | ; test if ${PROJECT_ID} defined |
---|
254 | CASE project_id_env OF |
---|
255 | '' : BEGIN |
---|
256 | msg = 'eee : ${PROJECT_ID} is not defined' |
---|
257 | ras = report(msg) |
---|
258 | STOP |
---|
259 | END |
---|
260 | ELSE: BEGIN |
---|
261 | msg = 'iii : ${PROJECT_ID} is ' + project_id_env |
---|
262 | ras = report(msg) |
---|
263 | END |
---|
264 | ENDCASE |
---|
265 | ; |
---|
266 | iodirin = isadirectory(project_id_env) |
---|
267 | ; |
---|
268 | ; existence and protection of ${PROJECT_ID} |
---|
269 | IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN |
---|
270 | msg = 'eee : the directory' + iodirin + ' is not accessible.' |
---|
271 | ras = report(msg) |
---|
272 | STOP |
---|
273 | ENDIF |
---|
274 | ; |
---|
275 | ; build mask filename |
---|
276 | filename_msk='mask_oaflux_30N30S.nc' |
---|
277 | ; |
---|
278 | ; check if this file exists |
---|
279 | msg='iii : looking for ' + filename_msk |
---|
280 | ras = report(msg) |
---|
281 | fullfilename_msk = isafile(iodirin + filename_msk, NEW=0, /MUST_EXIST) |
---|
282 | IF fullfilename_msk[0] EQ '' THEN BEGIN |
---|
283 | msg = 'eee : the file ' + fullfilename_msk + ' was not found.' |
---|
284 | ras = report(msg) |
---|
285 | STOP |
---|
286 | ENDIF |
---|
287 | ; |
---|
288 | ; test if ${PROJECT_OD} defined |
---|
289 | CASE project_od_env OF |
---|
290 | '' : BEGIN |
---|
291 | msg = 'eee : ${PROJECT_OD} is not defined' |
---|
292 | ras = report(msg) |
---|
293 | STOP |
---|
294 | END |
---|
295 | ELSE: BEGIN |
---|
296 | msg = 'iii : ${PROJECT_OD} is ' + project_od_env |
---|
297 | ras = report(msg) |
---|
298 | END |
---|
299 | ENDCASE |
---|
300 | ; |
---|
301 | ; check if output data will be possible |
---|
302 | iodirout = isadirectory(project_od_env) |
---|
303 | ; |
---|
304 | ; existence and protection for reading |
---|
305 | IF (FILE_TEST(iodirout, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN |
---|
306 | msg = 'eee : the directory' + iodirout + ' is not accessible.' |
---|
307 | ras = report(msg) |
---|
308 | STOP |
---|
309 | ENDIF |
---|
310 | ; |
---|
311 | ; existence and protection for writing |
---|
312 | IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN |
---|
313 | msg = 'eee : the directory' + iodirout + ' was not found.' |
---|
314 | ras = report(msg) |
---|
315 | STOP |
---|
316 | ENDIF |
---|
317 | ; |
---|
318 | ; build sst data filename |
---|
319 | filename_sst='TropFlux_sst_19890101_20091231.nc' |
---|
320 | ; |
---|
321 | ; check if this file exists |
---|
322 | msg='iii : looking for ' + filename_sst |
---|
323 | ras = report(msg) |
---|
324 | fullfilename_sst = isafile(iodirout + filename_sst, NEW=0, /MUST_EXIST) |
---|
325 | IF fullfilename_sst[0] EQ '' THEN BEGIN |
---|
326 | msg = 'eee : the file ' + fullfilename_sst + ' was not found.' |
---|
327 | ras = report(msg) |
---|
328 | STOP |
---|
329 | ENDIF |
---|
330 | ; |
---|
331 | ; build ws data filename |
---|
332 | filename_ws='TropFlux_ws_19890101_20091231.nc' |
---|
333 | ; |
---|
334 | ; check if this file exists |
---|
335 | msg='iii : looking for ' + filename_ws |
---|
336 | ras = report(msg) |
---|
337 | fullfilename_ws = isafile(iodirout + filename_ws, NEW=0, /MUST_EXIST) |
---|
338 | IF fullfilename_ws[0] EQ '' THEN BEGIN |
---|
339 | msg = 'eee : the file ' + fullfilename_ws + ' was not found.' |
---|
340 | ras = report(msg) |
---|
341 | STOP |
---|
342 | ENDIF |
---|
343 | ; |
---|
344 | ; build swr data filename |
---|
345 | filename_swr='TropFlux_swr_19890101_20091231_BLND.nc' |
---|
346 | ; |
---|
347 | ; check if this file exists |
---|
348 | msg='iii : looking for ' + filename_swr |
---|
349 | ras = report(msg) |
---|
350 | fullfilename_swr = isafile(iodirout + filename_swr, NEW=0, /MUST_EXIST) |
---|
351 | IF fullfilename_swr[0] EQ '' THEN BEGIN |
---|
352 | msg = 'eee : the file ' + fullfilename_swr + ' was not found.' |
---|
353 | ras = report(msg) |
---|
354 | STOP |
---|
355 | ENDIF |
---|
356 | ; |
---|
357 | ; build lwr data filename |
---|
358 | filename_lwr='TropFlux_lwr_19890101_20091231.nc' |
---|
359 | ; |
---|
360 | ; check if this file exists |
---|
361 | msg='iii : looking for ' + filename_lwr |
---|
362 | ras = report(msg) |
---|
363 | fullfilename_lwr = isafile(iodirout + filename_lwr, NEW=0, /MUST_EXIST) |
---|
364 | IF fullfilename_lwr[0] EQ '' THEN BEGIN |
---|
365 | msg = 'eee : the file ' + fullfilename_lwr + ' was not found.' |
---|
366 | ras = report(msg) |
---|
367 | STOP |
---|
368 | ENDIF |
---|
369 | ; |
---|
370 | ; build t2m data filename |
---|
371 | filename_t2m='TropFlux_t2m_19890101_20091231.nc' |
---|
372 | ; |
---|
373 | ; check if this file exists |
---|
374 | msg='iii : looking for ' + filename_t2m |
---|
375 | ras = report(msg) |
---|
376 | fullfilename_t2m = isafile(iodirout + filename_t2m, NEW=0, /MUST_EXIST) |
---|
377 | IF fullfilename_t2m[0] EQ '' THEN BEGIN |
---|
378 | msg = 'eee : the file ' + fullfilename_t2m + ' was not found.' |
---|
379 | ras = report(msg) |
---|
380 | STOP |
---|
381 | ENDIF |
---|
382 | ; |
---|
383 | ; build q2m data filename |
---|
384 | filename_q2m='TropFlux_q2m_19890101_20091231.nc' |
---|
385 | ; |
---|
386 | ; check if this file exists |
---|
387 | msg='iii : looking for ' + filename_q2m |
---|
388 | ras = report(msg) |
---|
389 | fullfilename_q2m = isafile(iodirout + filename_q2m, NEW=0, /MUST_EXIST) |
---|
390 | IF fullfilename_q2m[0] EQ '' THEN BEGIN |
---|
391 | msg = 'eee : the file ' + fullfilename_q2m + ' was not found.' |
---|
392 | ras = report(msg) |
---|
393 | STOP |
---|
394 | ENDIF |
---|
395 | ; |
---|
396 | ; build wg data filename |
---|
397 | filename_wg='TropFlux_gustiness_19890101_20091231.nc' |
---|
398 | ; |
---|
399 | ; check if this file exists |
---|
400 | msg='iii : looking for ' + filename_wg |
---|
401 | ras = report(msg) |
---|
402 | fullfilename_wg = isafile(iodirout + filename_wg, NEW=0, /MUST_EXIST) |
---|
403 | IF fullfilename_wg[0] EQ '' THEN BEGIN |
---|
404 | msg = 'eee : the file ' + fullfilename_wg + ' was not found.' |
---|
405 | ras = report(msg) |
---|
406 | STOP |
---|
407 | ENDIF |
---|
408 | ; |
---|
409 | ; build output filename |
---|
410 | filename_out = 'TropFlux_19890101_20091231_coarev3.nc' |
---|
411 | fullfilename_out = iodirout + filename_out |
---|
412 | ; in order to avoid unexpected overwritten |
---|
413 | IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN |
---|
414 | msg = 'eee : the file ' + fullfilename_out + ' already exists.' |
---|
415 | ras = report(msg) |
---|
416 | STOP |
---|
417 | ENDIF |
---|
418 | ; |
---|
419 | da1=19880101 |
---|
420 | da2=20101231 |
---|
421 | ; |
---|
422 | initncdf, fullfilename_msk |
---|
423 | msk=ncdf_lec(fullfilename_msk,var='msk') |
---|
424 | ; |
---|
425 | initncdf, fullfilename_sst |
---|
426 | ; |
---|
427 | ws=read_ncdf('ws',da1,da2,file=fullfilename_ws,/nostr) |
---|
428 | wg=read_ncdf('wg',da1-1,da2,file=fullfilename_wg,/nostr) |
---|
429 | tt=time |
---|
430 | jpt=n_elements(time) |
---|
431 | sst=read_ncdf('sst',da1,da2,file=fullfilename_sst,/nostr) |
---|
432 | sst=reform(sst-273.15) |
---|
433 | swd=read_ncdf('swr',da1,da2,file=fullfilename_swr,/nostr) |
---|
434 | lw=read_ncdf('lwr',da1,da2,file=fullfilename_lwr,/nostr) |
---|
435 | swd=swd/0.94 ; converting from net swr to downward swr |
---|
436 | ; |
---|
437 | t2m=read_ncdf('t2m',da1,da2,file=fullfilename_t2m,/nostr)-273.15 ; in C |
---|
438 | q2m=read_ncdf('q2m',da1,da2,file=fullfilename_q2m,/nostr) ; in g/kg |
---|
439 | ; |
---|
440 | w=sqrt(ws*ws+wg*wg) ; wind corrected for gustiness |
---|
441 | w=ws |
---|
442 | tmask=msk |
---|
443 | help, ws,w,wg,u,sst,swd,t2m,q2m |
---|
444 | ocean=where(msk eq 1,compl=land) |
---|
445 | valmask=1.e20 |
---|
446 | time=tt |
---|
447 | jpt=n_elements(time) |
---|
448 | ; |
---|
449 | ; Constants for flux computation |
---|
450 | ; |
---|
451 | zu=10. ; height of wind speed measurement (m) |
---|
452 | us=0. ; surf current (m/s) |
---|
453 | zt=2. ; Height of air T measurement (m) |
---|
454 | zq=2. ; height of humidity measurement (m) |
---|
455 | P=1008. ; Pressure |
---|
456 | zi=600. ; Inversion height (m) |
---|
457 | jcool=0 ; Compute cool-skin |
---|
458 | jwave=0 ; No waves |
---|
459 | twave=5. |
---|
460 | hwave=1. |
---|
461 | ; |
---|
462 | caldat, time,mon,day,yea |
---|
463 | swr=fltarr(jpi,jpj,jpt)+1.e20 |
---|
464 | lwr=fltarr(jpi,jpj,jpt)+1.e20 |
---|
465 | lat=fltarr(jpi,jpj,jpt)+1.e20 |
---|
466 | sen=fltarr(jpi,jpj,jpt)+1.e20 |
---|
467 | lwnet_clrk=fltarr(jpi,jpj,jpt)+1.e20 |
---|
468 | ;Ch=fltarr(jpi,jpj,jpt)+1.e20 |
---|
469 | ;Ce=fltarr(jpi,jpj,jpt)+1.e20 |
---|
470 | junk=fltarr(jpi,jpj,jpt)+1.e20 |
---|
471 | ; |
---|
472 | for jt=0,jpt-1 do begin |
---|
473 | jday=time(jt)-julday(1,1,yea(jt)) |
---|
474 | print, 'Computing Fluxes ',jt,' / ',jpt-1 |
---|
475 | ; |
---|
476 | ; P=msl(*,*,jt) |
---|
477 | ; P=P(ocean) |
---|
478 | ; |
---|
479 | ; wind speed (m/s) |
---|
480 | wn=w(*,*,jt) |
---|
481 | wn=wn(ocean) |
---|
482 | ; Bulk sst (°C) |
---|
483 | ts=sst(*,*,jt) |
---|
484 | ts=ts(ocean) |
---|
485 | ; 2m Air T (°C) |
---|
486 | t=t2m(*,*,jt) |
---|
487 | t=t(ocean) |
---|
488 | ; Sea surface sat. spec. humidity (g/kg) |
---|
489 | qs=qsee(ts,P) |
---|
490 | ; 2m AIr specific humidity (g/kg) |
---|
491 | q=q2m(*,*,jt) |
---|
492 | q=q(ocean) |
---|
493 | ; Downward solar flux (W/m2) |
---|
494 | Rs=swd(*,*,jt) |
---|
495 | Rs=Rs(ocean) |
---|
496 | ylat=gphit(ocean) |
---|
497 | ; cld=calc_cloud(jday,Rs,ylat) |
---|
498 | cld=calc_cloud_vlat(jday,Rs,ylat) |
---|
499 | ; Downward IR flux (W/m2) |
---|
500 | ; Rl=lwdown_clark(ts,q,cld,t,P) |
---|
501 | Rl=lw(*,*,jt) |
---|
502 | Rl=Rl(ocean) |
---|
503 | rain=0. |
---|
504 | lw_clrk=-lwnet_clark(ts,q,cld,t,P) |
---|
505 | ; junk(*,*,jt)=lw_clrk |
---|
506 | ; |
---|
507 | ;stop |
---|
508 | y=cor30a(wn,us,ts,t,Qs,Q,Rs,Rl,rain,zi,P,zu,zt,zq,ylat,jcool,jwave,twave,hwave) |
---|
509 | ; A few punctual missing values (coare does not converge): filled by spatial extrapolation |
---|
510 | tab=fltarr(jpi,jpj)+!values.f_nan |
---|
511 | x=reform(y(*,0)) |
---|
512 | tab(ocean)=x |
---|
513 | m=finite(tab) |
---|
514 | help, tab, m, swr |
---|
515 | tab=extrapolate(tab,m) |
---|
516 | swr(*,*,jt)=tab*msk+valmask*(1-msk) |
---|
517 | ; |
---|
518 | tab=fltarr(jpi,jpj)+!values.f_nan |
---|
519 | x=reform(y(*,1)) |
---|
520 | tab(ocean)=x |
---|
521 | m=finite(tab) |
---|
522 | help, tab, m, lwr |
---|
523 | ;!!!!!!!!!!!!+++++++++++++++ tab=extrapolate(tab,m) |
---|
524 | print, 'www : extrapolation for lwr is not done' |
---|
525 | tab=tab |
---|
526 | lwr(*,*,jt)=tab*msk+valmask*(1-msk) |
---|
527 | ; |
---|
528 | tab=fltarr(jpi,jpj)+!values.f_nan |
---|
529 | x=reform(y(*,2)) |
---|
530 | tab(ocean)=x |
---|
531 | m=finite(tab) |
---|
532 | help, tab, m, lat |
---|
533 | ;!!!!!!!!!!!!+++++++++++++++ tab=extrapolate(tab,m) |
---|
534 | print, 'www : extrapolation for lat is not done' |
---|
535 | tab=tab |
---|
536 | lat(*,*,jt)=tab*msk+valmask*(1-msk) |
---|
537 | tab=fltarr(jpi,jpj)+!values.f_nan |
---|
538 | x=reform(y(*,3)) |
---|
539 | tab(ocean)=x |
---|
540 | m=finite(tab) |
---|
541 | help, tab, m, sen |
---|
542 | ;!!!!!!!!!!!!+++++++++++++++ tab=extrapolate(tab,m) |
---|
543 | print, 'www : extrapolation for sen is not done' |
---|
544 | tab=tab |
---|
545 | sen(*,*,jt)=tab*msk+valmask*(1-msk) |
---|
546 | ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(lw_clrk) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & lwnet_clrk(*,*,jt)=tab*msk+valmask*(1-msk) |
---|
547 | tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,5)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & tau(*,*,jt)=tab*msk+valmask*(1-msk) |
---|
548 | ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,6)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & Ch(*,*,jt)=tab*msk+valmask*(1-msk) |
---|
549 | ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,7)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & Ce(*,*,jt)=tab*msk+valmask*(1-msk) |
---|
550 | tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,8)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & wg(*,*,jt)=tab*msk+valmask*(1-msk) |
---|
551 | endfor |
---|
552 | time=timegen(7670, start=julday(1,1,1989,0), units='days') |
---|
553 | jpt=n_elements(time) |
---|
554 | ; |
---|
555 | cda0=string(jul2date(time(0)),format='(i8.8)') |
---|
556 | cda1=string(jul2date(time(jpt-1)),format='(i8.8)') |
---|
557 | time=time-julday(1,1,1950,00,00,00) |
---|
558 | xlon=reform(glamt(*,0) ) |
---|
559 | ylat=reform(gphit(0,*)) |
---|
560 | ; |
---|
561 | ncfile='!' + fullfilename_out |
---|
562 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
563 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
564 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:'1950-JAN-01 00:00:00'} |
---|
565 | globattr={source:'Fluxes for the Global Tropical Ocean - TropFlux',timerange:cda0+' - '+cda1} |
---|
566 | swr_attr={units:'W/m2',missing_value:valmask,long_name:'Surface net shortwave radiation',short_name:'swr',axis:'TYX'} |
---|
567 | lwr_attr={units:'W/m2',missing_value:valmask,long_name:'Surface net longwave radiation',short_name:'lwr',axis:'TYX'} |
---|
568 | lwr_clrk_attr={units:'W/m2',missing_value:valmask,long_name:'Surface net longwave radiation from clark',short_name:'lwr',axis:'TYX'} |
---|
569 | lhf_attr={units:'W/m2',missing_value:valmask,long_name:'Surface latent flux',short_name:'lhf',axis:'TYX'} |
---|
570 | shf_attr={units:'W/m2',missing_value:valmask,long_name:'Surface sensible flux',short_name:'shf',axis:'TYX'} |
---|
571 | wg_attr={units:'m/s',missing_value:valmask,long_name:'COARE convective gustiness',short_name:'wg',axis:'TYX'} |
---|
572 | tau_attr={units:'N/m2',missing_value:valmask,long_name:'Wind stress magnitude',short_name:'tau',axis:'TYX'} |
---|
573 | ; |
---|
574 | help, swr,lwr,lat,sen,time,xlon,ylat |
---|
575 | ; |
---|
576 | ncfields = 'tau[longitude,latitude,time]=tau:tau_attr; ' $ |
---|
577 | + 'wg[longitude,latitude,time]=wg:wg_attr; ' $ |
---|
578 | + 'swr[longitude,latitude,time]=swr:swr_attr; ' $ |
---|
579 | ; +'lwr_coare[longitude,latitude,time]=lwr:lwr_attr; ' $ |
---|
580 | +'lwr[longitude,latitude,time]=lwnet_clrk:lwr_clrk_attr; ' $ |
---|
581 | +'lhf[longitude,latitude,time]=lat:lhf_attr; ' $ |
---|
582 | +'shf[longitude,latitude,time]=sen:shf_attr; ' $ |
---|
583 | ; +'Ch[longitude,latitude,time]=Ch:Ch_attr; ' $ |
---|
584 | ; +'Ce[longitude,latitude,time]=Ce:Ce_attr; ' $ |
---|
585 | + 'longitude[]=xlon:lon_attr; ' $ |
---|
586 | + 'latitude[]=ylat:lat_attr; ' $ |
---|
587 | + 'time[*time]=time:time_attr ' $ |
---|
588 | + ' @ globattr' |
---|
589 | ; |
---|
590 | @ncdf_quickwrite |
---|
591 | ; |
---|
592 | end |
---|