source: trunk/src/flux_evaluation_tpr_map.pro

Last change on this file was 204, checked in by pinsard, 10 years ago

fix thanks to coding rules; typo

  • Property svn:executable set to *
  • Property svn:keywords set to URL Id
File size: 6.3 KB
Line 
1;+
2;
3; .. _flux_evaluation_tpr_map.pro:
4;
5; ===========================
6; flux_evaluation_tpr_map.pro
7; ===========================
8;
9; DESCRIPTION
10; ===========
11;
12; SEE ALSO
13; ========
14;
15; :ref:`project_profile.sh`
16; :ref:`project_init.pro`
17; :ref:`cm_project.pro`
18;
19; TODO
20; ====
21;
22; make it work : need output of flux_evaluation_tpr_timeseries.pro
23;
24; uncomment var
25;
26; coding rules
27;
28; EXAMPLES
29; ========
30;
31; .. code-block:: idl
32;
33;    date1 = 20000101L
34;    date2 = 20091231L
35;    flux_evaluation_tpr_map, date1, date2
36;
37; EVOLUTIONS
38; ==========
39;
40; $Id$
41;
42; $URL$
43;
44; - fplod 20111130T142224Z cratos (Linux)
45;
46;   * try to make it work on my account on cratos
47;   * remove x_site_location and x_site_location because already exist
48;
49;-
50pro flux_evaluation_tpr_map, $
51;                    var,    $ ;;  flux variable (swr, lwr, lhf, shf) to calculate the statistics
52date1,  $ ;;  start date (in Julian date. eg. 20000101)
53date2     ;;  end date (in Julian date eg. 20091231)
54
55@common
56@cm_project
57reinitplt, /z,/invert
58key_portrait = 1
59openps, FILENAME = project_od_env+'flux_evaluation_tpr_map.ps'
60;
61;; part to change
62
63min_obs=10.  ;; this will allow to calculate statistics at locations with more than 180. valid observation
64
65;; choose the appropriate min and max values for the following.
66
67bias_mi=-5     &  bias_ma=5    & bias_int=0.5
68std_mi=0.5      &  std_ma=1.5    & std_int=0.05
69rmsd_mi=0       &  rmsd_ma=15    & rmsd_int=1.5
70cor_mi=0.5      &  cor_ma=1.     & cor_int=0.025
71
72;; TPR locations.  This needs to be updated with time since more locations are added to the array.
73
74sitelist=['5n165e','8s67e','12s55e', '8s55e', '8s80.5e', '1.5s80.5e', '0n80.5e', '1.5n80.5e', '1.5s90e', $
75           '0n90e', '1.5n90e', '4n90e','8n90e','12n90e', '15n90e', '5s95e', $
76           '8s165e', '8s180w',  '8s155w', '8s125w', '8s110w', '8s95w',  '5s156e', '5s165e', '5s180w', '5s170w', $
77          '5s155w', '5s140w', '5s125w', '5s110w', '5s95w', '2s156e', '2s165e', '2s180w', '2s170w', '2s155w', '2s140w', $
78          '2s125w', '2s110w', '2s95w', '0n147e', '0n156e', '0n165e', '0n180w', '0n170w', '0n155w', '0n140w', '0n125w', $
79          '0n110w', '0n95w', '2n147e', '2n156e', '2n165e', '2n180w', '2n170w', '2n155w', '2n140w', '2n125w', '2n110w', $
80          '2n95w', '5n147e', '5n156e', '5n170w', '5n155w', '5n140w', '5n125w', '5n110w', '5n95w', $
81          '8n156e', '8n165e', '8n180w', '8n170w', '9n140w', '8n125w', '8n110w', '8n95w', $
82          '0n0e', '0n10w', '0n23w', '0n35w', '10s10w', '12n23w', '12n38w', '14s32w', '15n38w', '19s34w', '20n38w', $
83          '21n23w', '4n23w', '4n38w', '6s10w', '8n38w', '8s30w']
84
85;;   This program will create the following text files with statistics of respective variables
86
87close,/all
88
89erase
90;; PLOTTING THE MAPS
91
92fi = project_od_env + 'flux_stat.txt'
93res=read_ascii(fi,data_start=1)
94ff=res.field1
95
96lat=reform(ff(0,*))
97lon=reform(ff(1,*))
98cor=reform(ff(2,*))
99bias=reform(ff(3,*))
100std=reform(ff(4,*))
101rmsd=reform(ff(5,*))
102
103corr_t=total(cor)/n_elements(cor)
104bias_t=total(bias)/n_elements(bias)
105std_t=total(std)/n_elements(std)
106rmsd_t=total(rmsd)/n_elements(rmsd)
107cstat=string(corr_t, bias_t, std_t, rmsd_t, format='(f4.2,3x,f7.2,3x,f4.2,3x,f5.2)')
108
109file= project_id_env + 'mask_oaflux_30N30S.nc'
110initncdf, file
111domdef, 30,390,-30,30
112msk=ncdf_lec(file,var='msk')
113marge1=[0,0,-5,0]
114
115plt, msk,realcont=2,/nocont,/nofill,xminor=1,yminor=1,lct=64,cor_mi, cor_ma,int=cor_int, $
116title='1) Correlation ', subtitle='', small=[1,4,1],/rempl,marge=marge1
117
118NN=n_elements(lat)
119
120usersym, [-.5,.5,.5,-.5,-.5],[-.5,-.5,.5,.5,-.5],/fill
121
122for n=0,NN-1 do begin
123    x=lon(n)
124    y=lat(n)
125    c=cor(n)
126    cmi=cor_mi & cma=cor_ma & dc=cma-cmi
127    col=((10+244*(c-cmi)/dc) > 10) < 254
128    plots, x,y,psym=8,symsize=1.5,color=col
129endfor
130
131usersym, [-.5,.5,.5,-.5,-.5],[-.5,-.5,.5,.5,-.5]
132
133for n=0,NN-1 do begin
134    x=lon(n)
135    y=lat(n)
136    c=cor(n)
137    plots, x,y,psym=8,symsize=1.5,color=0
138endfor
139
140plt,msk,realcont=2,/nocont,/nofill,xminor=1,yminor=1,lct=64,bias_mi, bias_ma, int=bias_int,/noer, marge=marge1, $
141title='2) Mean bias', subtitle='', small=[1,4,2],/rempl
142
143NN=n_elements(lat)
144
145usersym, [-.5,.5,.5,-.5,-.5],[-.5,-.5,.5,.5,-.5],/fill
146
147for n=0,NN-1 do begin
148    x=lon(n)
149    y=lat(n)
150    c=bias(n)
151    cmi=bias_mi & cma=bias_ma & dc=cma-cmi
152    col=((10+244*(c-cmi)/dc) > 10) < 254
153    plots, x,y,psym=8,symsize=1.5,color=col
154endfor
155
156usersym, [-.5,.5,.5,-.5,-.5],[-.5,-.5,.5,.5,-.5]
157
158for n=0,NN-1 do begin
159    x=lon(n)
160    y=lat(n)
161    c=bias(n)
162    plots, x,y,psym=8,symsize=1.5,color=0
163endfor
164plt,msk,realcont=2,/nocont,/nofill,xminor=1,yminor=1,lct=64,rmsd_mi, rmsd_ma, int=rmsd_int,/noer, $
165title='3) RMSD ', subtitle='', small=[1,4,3],/rempl, marge=marge1
166
167NN=n_elements(lat)
168
169usersym, [-.5,.5,.5,-.5,-.5],[-.5,-.5,.5,.5,-.5],/fill
170
171for n=0,NN-1 do begin
172    x=lon(n)
173    y=lat(n)
174    c=rmsd(n)
175    cmi=rmsd_mi & cma=rmsd_ma & dc=cma-cmi
176    col=((10+244*(c-cmi)/dc) > 10) < 254
177    plots, x,y,psym=8,symsize=1.5,color=col
178endfor
179
180usersym, [-.5,.5,.5,-.5,-.5],[-.5,-.5,.5,.5,-.5]
181for n=0,NN-1 do begin
182    x=lon(n)
183    y=lat(n)
184    c=rmsd(n)
185    plots, x,y,psym=8,symsize=1.5,color=0
186endfor
187plt,msk,realcont=2,/nocont,/nofill,xminor=1,yminor=1,lct=64,std_mi, std_ma, int=std_int,/noer, $
188title='4) STD ratio', subtitle='', small=[1,4,4],/rempl, marge=marge1
189
190NN=n_elements(lat)
191
192usersym, [-.5,.5,.5,-.5,-.5],[-.5,-.5,.5,.5,-.5],/fill
193
194for n=0,NN-1 do begin
195    x=lon(n)
196    y=lat(n)
197    c=std(n)
198    cmi=std_mi & cma=std_ma & dc=cma-cmi
199    col=((10+244*(c-cmi)/dc) > 10) < 254
200    plots, x,y,psym=8,symsize=1.5,color=col
201endfor
202
203usersym, [-.5,.5,.5,-.5,-.5],[-.5,-.5,.5,.5,-.5]
204
205for n=0,NN-1 do begin
206    x=lon(n)
207    y=lat(n)
208    c=std(n)
209    plots, x,y,psym=8,symsize=1.5,color=0
210endfor
211
212erase
213;; computing the pdf
214
215x=mooring & y=product
216mio=-50 & mao=300 & inx=25 & nx=(mao-mio)/inx+1l & xx=mio+indgen(nx)*inx
217mis=-50 & mas=300 & iny=25 & ny=(mas-mis)/iny+1l & yy=mis+indgen(ny)*iny
218pdf=fltarr(nx,ny)
219for i=0, nx-2 do begin
220    for j=0,ny-2 do begin
221        xmi=xx(i) & xma=xx(i+1)
222        ymi=yy(j) & yma=yy(j+1)
223        ind=where((x ge xmi) and (x le xma) and (y ge ymi) and (y le yma))
224        pdf(i,j)=float(n_elements(ind))
225        ;    print, xmi,xma,ymi,yma,n_elements(ind)
226    endfor
227endfor
228
229scontour, pdf,xx,yy ,small=[2,1,1],/noer, charsize=1, nlevels=30,/fill, $
230xtitle='TAO Flux', ytitle='Product', title='PDF'
231xyouts, 0, -150, cstat, charsize=1.2
232
233closeps
234
235end
Note: See TracBrowser for help on using the repository browser.