source: trunk/src/paper01/fig3/air_validation_scatter_2000_2009_v50.pro @ 70

Last change on this file since 70 was 50, checked in by pinsard, 13 years ago

replace TROPFLUX by PROJECT

  • Property svn:executable set to *
File size: 14.6 KB
Line 
1;+
2;
3; .. _air_validation_scatter_2000_2009_v50.pro:
4;
5; ========================================
6; air_validation_scatter_2000_2009_v50.pro
7; ========================================
8;
9; DESCRIPTION
10; ===========
11;
12; .. graphviz::
13;
14;    digraph air_validation_scatter_2000_2009_v50 {
15;       graph [
16;       rankdir="LR",
17;       ]
18;
19;       air_erai [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/air_2000_2009_erai_v50.txt"];
20;
21;       air_trop [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/air_2000_2009_trop_v50.txt"];
22;       air_oaflux [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/air_2000_2009_oaflx_v50.txt"];
23;       air_ncep  [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/air_2000_2009_ncep_v50.txt"];
24;       air_ncep1  [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/air_2000_2009_ncep1_v50.txt"];
25;       air_ncep2 [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/air_2000_2009_ncep2_v50.txt"];
26;       air_ncep2_oafluxgrid [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/air_2m_ncep2_oafluxgrid_19890101_20091231.nc"];
27;
28;       t2m_ncep1 [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/t2m_ncep1_19890101_20091231.nc"];
29;       figure [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/air_validation_scatter_2000_2009_v50.ps"];
30;
31;       erai_t2m [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/erai_t2m_19890101_20091231_oafluxgrid.nc"];
32;
33;       tropflux_t2m [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/TropFlux_t2m_19890101_20091231_v50.nc"];
34;
35;       oaflux_basic [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/OAFlux_basic_variables_1985_2009.nc"];
36;
37;       air_validation_scatter_2000_2009_v50 [shape=box,
38;       fontname=Courier,
39;       color=blue,
40;       URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/paper01/fig3/air_validation_scatter_2000_2009_v50.pro",
41;       label="${TROPFLUX}/src/paper01/fig3/air_validation_scatter_2000_2009_v50.pro"];
42;
43;       {air_erai air_ncep erai_t2m tropflux_t2m oaflux_basic air_ncep2_oafluxgrid t2m_ncep1} -> {air_validation_scatter_2000_2009_v50} -> { air_trop air_oaflux air_ncep1 air_ncep2 figure}
44;
45;    }
46;
47; SEE ALSO
48; ========
49;
50; :ref:`project_profile.sh`
51; :ref:`project_init.pro`
52; :ref:`cm_project.pro`
53;
54; :func:`x_site_location`
55; :func:`y_site_location`
56;
57; :ref:`read_variables_v2.pro`
58; :ref:`statistics_3var_v1.pro`
59;
60; EXAMPLES
61; ========
62;
63; ::
64;
65;  IDL> date1=20001001L
66;  IDL> date2=20091231L
67;  IDL> air_validation_scatter_2000_2009_v50, date1, date2
68;
69; TODO
70; ====
71;
72; make it work (missing data)
73;
74; Praveen confirm date selection
75;
76; coding rules
77;
78; get rid of spwan
79;
80; complete description
81;
82; externalize function
83;
84; handle IO error
85;
86; EVOLUTIONS
87; ==========
88;
89; $Id$
90;
91; - fplod 20110412T101323Z aedon.locean-ipsl.upmc.fr (Darwin)
92;
93;   * remove hard coding path
94;   * add graphviz
95;
96; - fplod 20110411T142955Z aedon.locean-ipsl.upmc.fr (Darwin)
97;
98;   * minimal header
99;
100;-
101pro air_validation_scatter_2000_2009_v50, date1, date2
102
103@cm_project
104
105reinitplt, /z,/invert
106key_portrait = 1
107
108openps, FILENAME = 'idl.ps'
109
110;; Give the location of mooring for validation of basic meteorological variables
111
112
113sitelist=['8s67e','12s55e', '8s55e', '8s80.5e', '1.5s80.5e', '0n80.5e', '1.5n80.5e', '1.5s90e', $
114           '0n90e', '1.5n90e', '4n90e','8n90e','12n90e', '15n90e', '5s95e', $
115           '8s165e', '8s180w',  '8s155w', '8s125w', '8s110w', '8s95w',  '5s156e', '5s165e', '5s180w', '5s170w', $
116          '5s155w', '5s140w', '5s125w', '5s110w', '5s95w', '2s156e', '2s165e', '2s180w', '2s170w', '2s155w', '2s140w', $
117          '2s125w', '2s110w', '2s95w', '0n147e', '0n156e', '0n165e', '0n180w', '0n170w', '0n155w', '0n140w', '0n125w', $
118          '0n110w', '0n95w', '2n147e', '2n156e', '2n165e', '2n180w', '2n170w', '2n155w', '2n140w', '2n125w', '2n110w', $
119          '2n95w', '5n147e', '5n156e', '5n165e', '5n170w', '5n155w', '5n140w', '5n125w', '5n110w', '5n95w', $
120          '8n156e', '8n165e', '8n180w', '8n170w', '9n140w', '8n125w', '8n110w', '8n95w', $
121          '0n0e', '0n10w', '0n23w', '0n35w', '10s10w', '12n23w', '12n38w', '14s32w', '15n38w', '19s34w', '20n38w', $
122          '21n23w', '4n23w', '4n38w', '6s10w', '8n38w', '8s30w']
123
124ocean='global'
125
126nsmooth=1.    ;; statistics are with 7 day smoothed
127;;   This program will create the following text files with statistics of respective variables
128close,/all
129
130fi_air_erai=project_id_env+'air_2000_2009_erai_v50.txt'
131openw,1,fi_air_erai
132fi_air_trop=project_id_env+'air_2000_2009_trop_v50.txt'
133openw,2,fi_air_trop
134fi_air_oaflx=project_id_env+'air_2000_2009_oaflx_v50.txt'
135openw,3,fi_air_oaflx
136fi_air_ncep2=project_id_env+'air_2000_2009_ncep2_v50.txt'
137openw,4,fi_air_ncep2
138fi_air_ncep1=project_id_env+'air_2000_2009_ncep1_v50.txt'
139openw,5,fi_air_ncep1
140
141
142printf,1, 'x     y      cor    bias     std     rmsd    mean_tao'
143printf,2, 'x     y      cor    bias     std     rmsd    mean_tao'
144printf,3, 'x     y      cor    bias     std     rmsd    mean_tao'
145printf,4, 'x     y      cor    bias     std     rmsd    mean_tao'
146printf,5, 'x     y      cor    bias     std     rmsd    mean_tao'
147
148;; first reading the whole ERAI uncorrected and corrected data
149
150file=project_id_env+'erai_t2m_19890101_20091231_oafluxgrid.nc'
151initncdf, file
152unc=read_ncdf('t2m',date1,date2,file=file,/nostr) & unc=unc-273.15
153help, unc
154
155file=project_id_env+'TropFlux_t2m_19890101_20091231_v50.nc'
156initncdf, file
157cor=read_ncdf('t2m',date1,date2,file=file,/nostr) & cor=cor-273.15
158help, cor
159
160file=project_id_env+'OAFlux_basic_variables_1985_2009.nc'
161initncdf, file
162oaf=read_ncdf("air", date1, date2, file=file,/nostr)
163help, oaf
164
165fi=project_id_env+'air_2m_ncep2_oafluxgrid_19890101_20091231.nc'
166initncdf, fi
167nce=read_ncdf("air", date1-1, date2, file=fi,/nostr)
168nce=nce-273.15
169help, nce
170
171file=project_id_env+'t2m_ncep1_19890101_20091231.nc'
172initncdf, file
173nce1=read_ncdf("t2m", date1, date2, file=file,/nostr)
174nce1=nce1-273.15
175help, nce1
176
177nn=n_elements(sitelist)
178for n=0, nn-1 do begin
179
180;; reading data from mooring
181
182    site=sitelist(n) & csite=site
183    print, csite
184    x=x_site_location(site)
185    y=y_site_location(site)
186    if (y ge 0. and y le 30.) then y=y+360.
187    dx=0.5 & dy=0.5 & box=[y-dy, y+dy, x-dx, x+dx]
188    read_variables_v2, csite,date1,date2,nsmooth, $
189         at, sw,rh,sst,wu,wv,ws,lh
190
191
192;    air=rh_to_sphum(rh,at,1008)               ;;        at  ->  air temperature
193    air=at                                               ;;        air ->  sea surface temperature
194                                                ;;        lh  ->  latent heat flux
195                                                ;;        rh  ->  relative humidity
196                                                ;;   wu,wv,ws ->  wind speed
197;;
198
199
200;;  extracting the corrected and uncorrected ERAI data at the locations
201    nsmooth=1.
202
203    extract_flux_tropflux,unc,box, $
204        tropflux
205    uncr=tropflux
206
207     extract_flux_tropflux,cor,box, $
208        tropflux
209     corr=tropflux
210
211     extract_flux_tropflux,oaf,box, $
212        tropflux
213     oafl=tropflux
214
215     extract_flux_tropflux,nce,box, $
216        tropflux
217     ncep=tropflux
218
219     extract_flux_tropflux,nce1,box, $
220        tropflux
221     ncep1=tropflux
222
223
224    ind=where(finite(air)) & air=air(ind) & uncr_air=uncr(ind)  & corr_air=corr(ind)
225    oafl=oafl(ind) & ncep=ncep(ind) & ncep1=ncep1(ind)
226    mean_tao=total(air,/nan)/n_elements(ind)
227
228    statistics_3var_v1, air, uncr_air, corr_air, $
229         cor1, cor2, bias1, bias2, std1, std2, rmsd1, rmsd2
230
231    printf, 1, x, y, cor1, bias1, std1, rmsd1, mean_tao, format='(f6.2, 3x, f6.2, 3x, f5.2,3x,f5.2,3x,f4.2,3x,f4.2,3x,f6.2)'
232    printf, 2, x, y, cor2, bias2, std2, rmsd2, mean_tao, format='(f6.2, 3x, f6.2, 3x, f5.2,3x,f5.2,3x,f4.2,3x,f4.2,3x,f6.2)'
233
234    statistics_3var_v1, air, oafl, ncep, $
235         cor1, cor2, bias1, bias2, std1, std2, rmsd1, rmsd2
236    printf, 3, x, y, cor1, bias1, std1, rmsd1, mean_tao, format='(f6.2, 3x, f6.2, 3x, f5.2,3x,f5.2,3x,f4.2,3x,f4.2,3x,f6.2)'
237    printf, 4, x, y, cor2, bias2, std2, rmsd2, mean_tao, format='(f6.2, 3x, f6.2, 3x, f5.2,3x,f6.2,3x,f4.2,3x,f4.2,3x,f6.2)'
238
239    statistics_3var_v1, air, ncep1, ncep, $
240         cor1, cor2, bias1, bias2, std1, std2, rmsd1, rmsd2
241    printf, 5, x, y, cor1, bias1, std1, rmsd1, mean_tao, format='(f6.2, 3x, f6.2, 3x, f5.2,3x,f5.2,3x,f4.2,3x,f4.2,3x,f6.2)'
242
243endfor
244close,/all
245
246fi_air_erai=project_id_env+'air_2000_2009_erai_v50.txt'
247res=read_ascii(fi_air_erai,data_start=1)
248ff=res.field1
249lat=reform(ff(0,*))
250lon=reform(ff(1,*))
251cor_era=reform(ff(2,*))   & cor_erai=total(cor_era)/n_elements(cor_era)
252bias_era=reform(ff(3,*))  & bias_erai=total(bias_era)/n_elements(bias_era)
253std_era=reform(ff(4,*))   & std_erai=total(std_era)/n_elements(std_era)
254rmsd_era=reform(ff(5,*))  & rmsd_erai=total(rmsd_era)/n_elements(rmsd_era)
255mean_tao=reform(ff(6,*))  & mean_erai=bias_era+mean_tao
256
257print, ''
258print, 'ERAI'
259print, cor_erai, bias_erai, std_erai, rmsd_erai
260cstat=string(cor_erai, bias_erai, std_erai, rmsd_erai, format='(f4.2,1x,f6.2,1x,f4.2,1x,f4.2)')
261splot, mean_tao, mean_erai, title='T2m - TAO Vs ERAI', subtitle='', $
262     charsize=1.1, xtitle='TAO T2m', ytitle='ERAI T2m', small=[2,3,1], psym=2, $
263     xrange=[22,31], yrange=[22,31], xmin=1,ymin=1
264xyouts, 22.3,30.2, cstat, charsize=0.9
265xyouts, 22.3,29.5, 'cor   bias   std   rmsd', charsize=0.9
266
267oplot, [22,31], [22,31]
268ab=linfit(mean_tao, mean_erai,yfit=yfit)
269a=float(ab(0)) & b=float(ab(1))
270oplot, mean_tao, yfit, color=250, thick=2
271
272fi_air_trop=project_id_env+'air_2000_2009_trop_v50.txt'
273res=read_ascii(fi_air_trop,data_start=1)
274ff=res.field1
275lat=reform(ff(0,*))
276lon=reform(ff(1,*))
277cor_tro=reform(ff(2,*))   & cor_trop=total(cor_tro)/n_elements(cor_tro)
278bias_tro=reform(ff(3,*))  & bias_trop=total(bias_tro)/n_elements(bias_tro)
279std_tro=reform(ff(4,*))   & std_trop=total(std_tro)/n_elements(std_tro)
280rmsd_tro=reform(ff(5,*))  & rmsd_trop=total(rmsd_tro)/n_elements(rmsd_tro)
281mean_tao=reform(ff(6,*))  & mean_trop=bias_tro+mean_tao
282
283print, ''
284print, 'TropFlux'
285print, cor_trop, bias_trop, std_trop, rmsd_trop
286cstat=string(cor_trop, bias_trop, std_trop, rmsd_trop, format='(f4.2,1x,f6.2,1x,f4.2,1x,f4.2)')
287
288splot, mean_tao, mean_trop, title='T2m - TAO Vs TropFlux', subtitle='', $
289     charsize=1.1, xtitle='TAO T2m', ytitle='TropFlux T2m', small=[2,3,2],/noer, psym=2, $
290     xrange=[22,31], yrange=[22,31], xmin=1,ymin=1
291oplot, [22,31], [22,31]
292xyouts, 22.3,30.2, cstat, charsize=0.9
293xyouts, 22.3,29.5, 'cor   bias   std   rmsd', charsize=0.9
294
295ab=linfit(mean_tao, mean_trop,yfit=yfit)
296a=float(ab(0)) & b=float(ab(1))
297oplot, mean_tao, yfit, color=250, thick=2
298
299fi_air_oaflx=project_id_env+'air_2000_2009_oaflx_v50.txt'
300res=read_ascii(fi_air_oaflx,data_start=1)
301ff=res.field1
302lat=reform(ff(0,*))
303lon=reform(ff(1,*))
304cor_oaf=reform(ff(2,*))   & cor_oafl=total(cor_oaf)/n_elements(cor_oaf)
305bias_oaf=reform(ff(3,*))  & bias_oafl=total(bias_oaf)/n_elements(bias_oaf)
306std_oaf=reform(ff(4,*))   & std_oafl=total(std_oaf)/n_elements(std_oaf)
307rmsd_oaf=reform(ff(5,*))  & rmsd_oafl=total(rmsd_oaf)/n_elements(rmsd_oaf)
308mean_tao=reform(ff(6,*))  & mean_oafl=bias_oaf+mean_tao
309
310print, ''
311print, 'OAFlux'
312print, cor_oafl, bias_oafl, std_oafl, rmsd_oafl
313cstat=string(cor_oafl, bias_oafl, std_oafl, rmsd_oafl, format='(f4.2,1x,f6.2,1x,f4.2,1x,f4.2)')
314
315splot, mean_tao, mean_oafl, title='T2m - TAO Vs OAFlux', subtitle='', $
316     charsize=1.1, xtitle='TAO T2m', ytitle='OAFlux T2m', small=[2,3,3],/noer, psym=2, $
317     xrange=[22,31], yrange=[22,31], xmin=1,ymin=1
318oplot, [22,31], [22,31]
319xyouts, 22.3,30.2, cstat, charsize=0.9
320xyouts, 22.3,29.5, 'cor   bias   std   rmsd', charsize=0.9
321
322ab=linfit(mean_tao, mean_oafl,yfit=yfit)
323a=float(ab(0)) & b=float(ab(1))
324oplot, mean_tao, yfit, color=250, thick=2
325
326
327
328fi_air_ncep=project_id_env+'air_2000_2009_ncep_v50.txt'
329res=read_ascii(fi_air_ncep,data_start=1)
330ff=res.field1
331lat=reform(ff(0,*))
332lon=reform(ff(1,*))
333cor_nce=reform(ff(2,*))   & cor_ncep=total(cor_nce)/n_elements(cor_nce)
334bias_nce=reform(ff(3,*))  & bias_ncep=total(bias_nce)/n_elements(bias_nce)
335std_nce=reform(ff(4,*))   & std_ncep=total(std_nce)/n_elements(std_nce)
336rmsd_nce=reform(ff(5,*))  & rmsd_ncep=total(rmsd_nce)/n_elements(rmsd_nce)
337mean_tao=reform(ff(6,*))  & mean_ncep=bias_nce+mean_tao
338
339print, ''
340print, 'NCEP2'
341print, cor_ncep, bias_ncep, std_ncep, rmsd_ncep
342cstat=string(cor_ncep, bias_ncep, std_ncep, rmsd_ncep, format='(f4.2,1x,f6.2,1x,f4.2,1x,f4.2)')
343
344splot, mean_tao, mean_ncep, title='T2m - TAO Vs NCEP2', subtitle='', $
345     charsize=1.1, xtitle='TAO T2m', ytitle='NCEP2 T2m', small=[2,3,4],/noer, psym=2, $
346     xrange=[22,31], yrange=[22,31], xmin=1,ymin=1
347oplot, [22,31], [22,31]
348xyouts, 22.3,30.2, cstat, charsize=0.9
349xyouts, 22.3,29.5, 'cor   bias   std   rmsd', charsize=0.9
350
351ab=linfit(mean_tao, mean_ncep,yfit=yfit)
352a=float(ab(0)) & b=float(ab(1))
353oplot, mean_tao, yfit, color=250, thick=2
354
355fi_air_ncep1=project_id_env+'air_2000_2009_ncep1_v50.txt'
356res=read_ascii(fi_air_ncep1,data_start=1)
357ff=res.field1
358lat=reform(ff(0,*))
359lon=reform(ff(1,*))
360cor_nce=reform(ff(2,*))   & cor_ncep=total(cor_nce)/n_elements(cor_nce)
361bias_nce=reform(ff(3,*))  & bias_ncep=total(bias_nce)/n_elements(bias_nce)
362std_nce=reform(ff(4,*))   & std_ncep=total(std_nce)/n_elements(std_nce)
363rmsd_nce=reform(ff(5,*))  & rmsd_ncep=total(rmsd_nce)/n_elements(rmsd_nce)
364mean_tao=reform(ff(6,*))  & mean_ncep=bias_nce+mean_tao
365
366print, ''
367print, 'NCEP1'
368print, cor_ncep, bias_ncep, std_ncep, rmsd_ncep
369cstat=string(cor_ncep, bias_ncep, std_ncep, rmsd_ncep, format='(f4.2,1x,f6.2,1x,f4.2,1x,f4.2)')
370
371splot, mean_tao, mean_ncep, title='T2m - TAO Vs NCEP_NCAR', subtitle='', $
372     charsize=1.1, xtitle='TAO T2m', ytitle='NCEP', small=[2,3,5],/noer, psym=2, $
373     xrange=[22,31], yrange=[22,31], xmin=1,ymin=1
374oplot, [22,31], [22,31]
375xyouts, 22.3,30.2, cstat, charsize=0.9
376xyouts, 22.3,29.5, 'cor   bias   std   rmsd', charsize=0.9
377
378ab=linfit(mean_tao, mean_ncep,yfit=yfit)
379a=float(ab(0)) & b=float(ab(1))
380oplot, mean_tao, yfit, color=250, thick=2
381
382closeps
383
384fig=project_od_env+'air_validation_scatter_2000_2009_v50.ps'
385spawn, 'mv '+psdir+'idl.ps '+fig
386spawn, 'gv '+fig
387return
388end
389function x_site_location, site
390    n1=strpos(site, 's')
391if (n1 gt -1) then begin
392    ns=-1.
393    x=strmid(site, 0, n1)
394    x=float(x)*ns
395endif else begin
396    n1=strpos(site, 'n')
397    x=strmid(site, 0, n1)
398    ny=1.
399    x=float(x)*ny
400endelse
401return, float(x)
402end
403function y_site_location, site
404    n1=strpos(site, 'e')
405if (n1 gt -1) then begin
406    n=strpos(site, 's')
407    if (n gt -1) then begin
408        y=strmid(site, n+1, n1-n-1)
409    endif else begin
410        n=strpos(site, 'n')
411        y=strmid(site, n+1, n1-n-1)
412    endelse
413
414endif else begin
415    n1=strpos(site, 'w')
416    n=strpos(site, 's')
417    if (n gt -1) then begin
418        y=strmid(site, n+1, n1-n-1)
419        y=180+(180-float(y))
420    endif else begin
421        n=strpos(site, 'n')
422        y=strmid(site, n+1, n1-n-1)
423        y=180+(180-float(y))
424   endelse
425endelse
426return,float(y)
427end
Note: See TracBrowser for help on using the repository browser.