source: trunk/src/paper01/fig3/q2m_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: 13.6 KB
Line 
1;+
2;
3; .. _q2m_validation_scatter_2000_2009_v50.pro:
4;
5; ========================================
6; q2m_validation_scatter_2000_2009_v50.pro
7; ========================================
8;
9; DESCRIPTION
10; ===========
11;
12; .. graphviz::
13;
14;    digraph q2m_validation_scatter_2000_2009_v50 {
15;       graph [
16;       rankdir="LR",
17;       ]
18;
19;       q2m_erai [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/q2m_2000_2009_erai_v50.txt"];
20;
21;       q2m_trop [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/q2m_2000_2009_trop_v50.txt"];
22;       q2m_oaflux [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/q2m_2000_2009_oaflx_v50.txt"];
23;       q2m_ncep  [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/q2m_2000_2009_ncep_v50.txt"];
24;       q2m_ncep1  [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/q2m_2000_2009_ncep1_v50.txt"];
25;
26;       erai_q2m_oafluxgrid [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/erai_t2m_19890101_20091231_oafluxgrid.nc"];
27;
28;       tropflux_q2m [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/TropFlux_q2m_19890101_20091231_v50.nc"];
29;
30;       oaflux_basic [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/OAFlux_basic_variables_1985_2009.nc"];
31;
32;       sphum_ncep2_oafluxgrid [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/sphum_ncep2_oafluxgrid_19890101_20091231.nc"];
33;
34;       q2m_validation_scatter_2000_2009_v50 [shape=box,
35;       fontname=Courier,
36;       color=blue,
37;       URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/paper01/fig3/q2m_validation_scatter_2000_2009_v50.pro",
38;       label="${TROPFLUX}/src/paper01/fig3/q2m_validation_scatter_2000_2009_v50.pro"];
39;
40;       figure [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/q2m_validation_scatter_2000_2009_v50.ps"];
41;
42;       {q2m_erai erai_q2m_oafluxgrid tropflux_q2m oaflux_basic sphum_ncep2_oafluxgrid} -> {q2m_validation_scatter_2000_2009_v50} -> {q2m_trop q2m_oaflux q2m_ncep q2m_ncep1 figure}
43;
44;     }
45;
46; SEE ALSO
47; ========
48;
49; :ref:`project_profile.sh`
50; :ref:`project_init.pro`
51; :ref:`cm_project.pro`
52;
53; :func:`x_site_location`
54; :func:`y_site_location`
55;
56; :ref:`read_variables_v2.pro`
57; :ref:`statistics_3var_v1.pro`
58;
59; EXAMPLES
60; ========
61;
62; ::
63;
64;  IDL> date1=20001001L
65;  IDL> date2=20091231L
66;  IDL> q2m_validation_scatter_2000_2009_v50, date1, date2
67;
68; TODO
69; ====
70;
71; make it work (missing data)
72;
73; Praveen confirm date selection
74;
75; coding rules
76;
77; get rid of spwan
78;
79; complete description
80;
81; handle IO error
82;
83; EVOLUTIONS
84; ==========
85;
86; $Id$
87;
88; - pinsard 2011-04-20T15:17:57Z loholt1.ipsl.polytechnique.fr (Linux)
89;
90;   * typo
91;   * externalize function
92;
93; - fplod 20110412T104125Z aedon.locean-ipsl.upmc.fr (Darwin)
94;
95;   * remove hard coding path
96;   * add graphviz
97;
98; - fplod 20110411T142955Z aedon.locean-ipsl.upmc.fr (Darwin)
99;
100;   * minimal header
101;
102;-
103pro q2m_validation_scatter_2000_2009_v50, date1, date2
104
105@cm_project
106
107reinitplt, /z,/invert
108key_portrait = 1
109
110openps, FILENAME = 'idl.ps'
111
112;; Give the location of mooring for validation of basic meteorological variables
113
114
115sitelist=['8s67e','12s55e', '8s55e', '8s80.5e', '1.5s80.5e', '0n80.5e', '1.5n80.5e', '1.5s90e', $
116           '0n90e', '1.5n90e', '4n90e','8n90e','12n90e', '15n90e', '5s95e', $
117           '8s165e', '8s180w',  '8s155w', '8s125w', '8s110w', '8s95w',  '5s156e', '5s165e', '5s180w', '5s170w', $
118          '5s155w', '5s140w', '5s125w', '5s110w', '5s95w', '2s156e', '2s165e', '2s180w', '2s170w', '2s155w', '2s140w', $
119          '2s125w', '2s110w', '2s95w', '0n147e', '0n156e', '0n165e', '0n180w', '0n170w', '0n155w', '0n140w', '0n125w', $
120          '0n110w', '0n95w', '2n147e', '2n156e', '2n165e', '2n180w', '2n170w', '2n155w', '2n140w', '2n125w', '2n110w', $
121          '2n95w', '5n147e', '5n156e', '5n165e', '5n170w', '5n155w', '5n140w', '5n125w', '5n110w', '5n95w', $
122          '8n156e', '8n165e', '8n180w', '8n170w', '9n140w', '8n125w', '8n110w', '8n95w', $
123          '0n0e', '0n10w', '0n23w', '0n35w', '10s10w', '12n23w', '12n38w', '14s32w', '15n38w', '19s34w', '20n38w', $
124          '21n23w', '4n23w', '4n38w', '6s10w', '8n38w', '8s30w']
125
126ocean='global'
127
128nsmooth=1.    ;; statistics are with 7 day smoothed
129;;   This program will create the following text files with statistics of respective variables
130close,/all
131
132fi_q2m_erai=project_id_env+'q2m_2000_2009_erai_v50.txt'
133openw,1,fi_q2m_erai
134fi_q2m_trop=project_id_env+'q2m_2000_2009_trop_v50.txt'
135openw,2,fi_q2m_trop
136fi_q2m_oaflx=project_id_env+'q2m_2000_2009_oaflx_v50.txt'
137openw,3,fi_q2m_oaflx
138fi_q2m_ncep=project_id_env+'q2m_2000_2009_ncep_v50.txt'
139openw,4,fi_q2m_ncep
140fi_q2m_ncep1=project_id_env+'q2m_2000_2009_ncep1_v50.txt'
141openw,5,fi_q2m_ncep1
142
143
144printf,1, 'x     y      cor    bias     std     rmsd    mean_tao'
145printf,2, 'x     y      cor    bias     std     rmsd    mean_tao'
146printf,3, 'x     y      cor    bias     std     rmsd    mean_tao'
147printf,4, 'x     y      cor    bias     std     rmsd    mean_tao'
148printf,5, 'x     y      cor    bias     std     rmsd    mean_tao'
149
150;; first reading the whole ERAI uncorrected and corrected data
151
152file=project_id_env+'erai_q2m_19890101_20091231_oafluxgrid.nc'
153initncdf, file
154unc=read_ncdf('q2m',date1,date2,file=file,/nostr)
155help, unc
156
157file=project_id_env+'TropFlux_q2m_19890101_20091231_v20.nc'
158initncdf, file
159cor=read_ncdf('q2m',date1,date2,file=file,/nostr)
160help, cor
161
162file=project_id_env+'OAFlux_basic_variables_1985_2009.nc'
163initncdf, file
164oaf=read_ncdf("sphum", date1, date2, file=file,/nostr)
165help, oaf
166
167fi=project_id_env+'sphum_ncep2_oafluxgrid_19890101_20091231.nc'
168initncdf, fi
169nce=read_ncdf("shum", date1-1, date2, file=fi,/nostr)
170nce=nce*1000
171help, nce
172
173file=project_id_env+'q2m_ncep1_19890101_20091231.nc'
174initncdf, file
175nce1=read_ncdf("q2m", date1, date2, file=file,/nostr)
176nce1=nce1*1000
177help, nce1
178
179nn=n_elements(sitelist)
180for n=0, nn-1 do begin
181
182;; reading data from mooring
183
184    site=sitelist(n) & csite=site
185    print, csite
186    x=x_site_location(site)
187    y=y_site_location(site)
188    if (y ge 0. and y le 30.) then y=y+360.
189    dx=0.5 & dy=0.5 & box=[y-dy, y+dy, x-dx, x+dx]
190    read_variables_v2, csite,date1,date2,nsmooth, $
191         at, sw,rh,sst,wu,wv,ws,lh
192
193
194    q2m=rh_to_sphum(rh,at,1008)               ;;        at  ->  q2m temperature
195;    q2m=at                                               ;;        q2m ->  sea surface temperature
196                                                ;;        lh  ->  latent heat flux
197                                                ;;        rh  ->  relative humidity
198                                                ;;   wu,wv,ws ->  wind speed
199;;
200
201
202;;  extracting the corrected and uncorrected ERAI data at the locations
203    nsmooth=1.
204
205    extract_flux_tropflux,unc,box, $
206        tropflux
207    uncr=tropflux
208
209     extract_flux_tropflux,cor,box, $
210        tropflux
211     corr=tropflux
212
213     extract_flux_tropflux,oaf,box, $
214        tropflux
215     oafl=tropflux
216
217     extract_flux_tropflux,nce,box, $
218        tropflux
219     ncep=tropflux
220
221     extract_flux_tropflux,nce1,box, $
222        tropflux
223     ncep1=tropflux
224
225    ind=where(finite(q2m)) & q2m=q2m(ind) & uncr_q2m=uncr(ind)  & corr_q2m=corr(ind)
226    oafl=oafl(ind) & ncep=ncep(ind) & ncep1=ncep1(ind)
227    mean_tao=total(q2m,/nan)/n_elements(ind)
228
229    statistics_3var_v1, q2m, uncr_q2m, corr_q2m, $
230         cor1, cor2, bias1, bias2, std1, std2, rmsd1, rmsd2
231
232    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)'
233    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)'
234
235    statistics_3var_v1, q2m, oafl, ncep, $
236         cor1, cor2, bias1, bias2, std1, std2, rmsd1, rmsd2
237    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)'
238    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)'
239
240    statistics_3var_v1, q2m, ncep1, ncep, $
241         cor1, cor2, bias1, bias2, std1, std2, rmsd1, rmsd2
242    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)'
243
244endfor
245close,/all
246
247fi_q2m_erai=project_id_env+'q2m_2000_2009_erai_v50.txt'
248res=read_ascii(fi_q2m_erai,data_start=1)
249ff=res.field1
250lat=reform(ff(0,*))
251lon=reform(ff(1,*))
252cor_era=reform(ff(2,*))   & cor_erai=total(cor_era)/n_elements(cor_era)
253bias_era=reform(ff(3,*))  & bias_erai=total(bias_era)/n_elements(bias_era)
254std_era=reform(ff(4,*))   & std_erai=total(std_era)/n_elements(std_era)
255rmsd_era=reform(ff(5,*))  & rmsd_erai=total(rmsd_era)/n_elements(rmsd_era)
256mean_tao=reform(ff(6,*))  & mean_erai=bias_era+mean_tao
257
258print, ''
259print, 'ERAI'
260print, cor_erai, bias_erai, std_erai, rmsd_erai
261cstat=string(cor_erai, bias_erai, std_erai, rmsd_erai, format='(f4.2,1x,f6.2,1x,f4.2,1x,f4.2)')
262splot, mean_tao, mean_erai, title='Q2m - TAO Vs ERAI', subtitle='', $
263     charsize=1.1, xtitle='TAO Q2m', ytitle='ERAI Q2m', small=[2,3,1], psym=2, $
264     xrange=[11,21], yrange=[11,21], xmin=1,ymin=1
265xyouts, 12,20.2, cstat, charsize=0.9
266xyouts, 12,19.7, 'cor   bias   std   rmsd', charsize=0.9
267
268oplot, [11,21], [11,21]
269ab=linfit(mean_tao, mean_erai,yfit=yfit)
270a=float(ab(0)) & b=float(ab(1))
271oplot, mean_tao, yfit, color=250, thick=2
272
273fi_q2m_trop=project_id_env+'q2m_2000_2009_trop_v50.txt'
274res=read_ascii(fi_q2m_trop,data_start=1)
275ff=res.field1
276lat=reform(ff(0,*))
277lon=reform(ff(1,*))
278cor_tro=reform(ff(2,*))   & cor_trop=total(cor_tro)/n_elements(cor_tro)
279bias_tro=reform(ff(3,*))  & bias_trop=total(bias_tro)/n_elements(bias_tro)
280std_tro=reform(ff(4,*))   & std_trop=total(std_tro)/n_elements(std_tro)
281rmsd_tro=reform(ff(5,*))  & rmsd_trop=total(rmsd_tro)/n_elements(rmsd_tro)
282mean_tao=reform(ff(6,*))  & mean_trop=bias_tro+mean_tao
283
284print, ''
285print, 'TropFlux'
286print, cor_trop, bias_trop, std_trop, rmsd_trop
287cstat=string(cor_trop, bias_trop, std_trop, rmsd_trop, format='(f4.2,1x,f6.2,1x,f4.2,1x,f4.2)')
288
289splot, mean_tao, mean_trop, title='Q2m - TAO Vs TropFlux', subtitle='', $
290     charsize=1.1, xtitle='TAO Q2m', ytitle='TropFlux Q2m', small=[2,3,2],/noer, psym=2, $
291     xrange=[11,21], yrange=[11,21], xmin=1,ymin=1
292oplot, [11,21], [11,21]
293xyouts, 12,20.2, cstat, charsize=0.9
294xyouts, 12,19.7, 'cor   bias   std   rmsd', charsize=0.9
295
296ab=linfit(mean_tao, mean_trop,yfit=yfit)
297a=float(ab(0)) & b=float(ab(1))
298oplot, mean_tao, yfit, color=250, thick=2
299
300fi_q2m_oaflx=project_id_env+'q2m_2000_2009_oaflx_v50.txt'
301res=read_ascii(fi_q2m_oaflx,data_start=1)
302ff=res.field1
303lat=reform(ff(0,*))
304lon=reform(ff(1,*))
305cor_oaf=reform(ff(2,*))   & cor_oafl=total(cor_oaf)/n_elements(cor_oaf)
306bias_oaf=reform(ff(3,*))  & bias_oafl=total(bias_oaf)/n_elements(bias_oaf)
307std_oaf=reform(ff(4,*))   & std_oafl=total(std_oaf)/n_elements(std_oaf)
308rmsd_oaf=reform(ff(5,*))  & rmsd_oafl=total(rmsd_oaf)/n_elements(rmsd_oaf)
309mean_tao=reform(ff(6,*))  & mean_oafl=bias_oaf+mean_tao
310
311print, ''
312print, 'OAFlux'
313print, cor_oafl, bias_oafl, std_oafl, rmsd_oafl
314cstat=string(cor_oafl, bias_oafl, std_oafl, rmsd_oafl, format='(f4.2,1x,f6.2,1x,f4.2,1x,f4.2)')
315
316splot, mean_tao, mean_oafl, title='Q2m - TAO Vs OAFlux', subtitle='', $
317     charsize=1.1, xtitle='TAO Q2m', ytitle='OAFlux Q2m', small=[2,3,3],/noer, psym=2, $
318     xrange=[11,21], yrange=[11,21], xmin=1,ymin=1
319oplot, [11,21], [11,21]
320xyouts, 12,20.2, cstat, charsize=0.9
321xyouts, 12,19.7, 'cor   bias   std   rmsd', charsize=0.9
322
323ab=linfit(mean_tao, mean_oafl,yfit=yfit)
324a=float(ab(0)) & b=float(ab(1))
325oplot, mean_tao, yfit, color=250, thick=2
326
327
328fi_q2m_ncep=project_id_env+'q2m_2000_2009_ncep_v50.txt'
329res=read_ascii(fi_q2m_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='Q2m - TAO Vs NCEP2', subtitle='', $
345     charsize=1.1, xtitle='TAO Q2m', ytitle='NCEP2 Q2m', small=[2,3,4],/noer, psym=2, $
346     xrange=[11,21], yrange=[11,21], xmin=1,ymin=1
347oplot, [11,21], [11,21]
348xyouts, 12,20.2, cstat, charsize=0.9
349xyouts, 12,19.7, '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_q2m_ncep1=project_id_env+'q2m_2000_2009_ncep1_v50.txt'
356res=read_ascii(fi_q2m_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='Q2m - TAO Vs NCEP', subtitle='', $
372     charsize=1.1, xtitle='TAO Q2m', ytitle='NCEP1 Q2m', small=[2,3,5],/noer, psym=2, $
373     xrange=[11,21], yrange=[11,21], xmin=1,ymin=1
374oplot, [11,21], [11,21]
375xyouts, 12,20.2, cstat, charsize=0.9
376xyouts, 12,19.7, '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+'q2m_validation_scatter_2000_2009_v50.ps'
385spawn, 'mv '+psdir+'idl.ps '+fig
386spawn, 'gv '+fig
387end
Note: See TracBrowser for help on using the repository browser.