1 | ;+ |
---|
2 | ; |
---|
3 | ; .. _basic_variable_evaluation_tpr_timeseries.pro: |
---|
4 | ; |
---|
5 | ; ============================================ |
---|
6 | ; basic_variable_evaluation_tpr_timeseries.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 | ; use :func:`read_basic_var`, :func:`x_site_location`, :func:`y_site_location` |
---|
20 | ; |
---|
21 | ; TODO |
---|
22 | ; ==== |
---|
23 | ; |
---|
24 | ; make it work : missing extract_tpr_location.pro |
---|
25 | ; |
---|
26 | ; uncomment var parameter |
---|
27 | ; |
---|
28 | ; correct bad check on unavailable tpr data |
---|
29 | ; |
---|
30 | ; EXAMPLES |
---|
31 | ; ======== |
---|
32 | ; |
---|
33 | ; :: |
---|
34 | ; |
---|
35 | ; IDL> date1 = 20000101L |
---|
36 | ; IDL> date2 = 20091231L |
---|
37 | ; IDL> basic_variable_evaluation_tpr_timeseries, date1, date2 |
---|
38 | ; |
---|
39 | ; EVOLUTIONS |
---|
40 | ; ========== |
---|
41 | ; |
---|
42 | ; $Id$ |
---|
43 | ; |
---|
44 | ; $URL$ |
---|
45 | ; |
---|
46 | ; - fplod 20111130T133857Z cratos (Linux) |
---|
47 | ; |
---|
48 | ; * try to make it work on my account on cratos |
---|
49 | ; * remove x_site_location and x_site_location because already exist |
---|
50 | ; |
---|
51 | ;- |
---|
52 | pro basic_variable_evaluation_tpr_timeseries, $ |
---|
53 | ; var, $ ;; basic variable (sst, t2m, q2m, ws) to calculate the statistics |
---|
54 | date1, $ ;; start date (in julian date. eg. 20000101) |
---|
55 | date2 ;; end date (in julian date eg. 20091231) |
---|
56 | @common |
---|
57 | @cm_project |
---|
58 | ;------------------------------------------------------------ |
---|
59 | reinitplt, /z,/invert |
---|
60 | key_portrait = 0 |
---|
61 | openps, FILENAME = project_od_env+'basic_variable_evaluation_tpr_timeseries.ps' |
---|
62 | ;------------------------------------------------------------ |
---|
63 | ;; part to change |
---|
64 | |
---|
65 | min_obs=10. ;; this will allow to calculate statistics at locations with more than 180. valid observation |
---|
66 | |
---|
67 | ;------------------------------------------------------------ |
---|
68 | ;; Before running this program, you have to compile the following subroutines |
---|
69 | ;; .r read_basic_var |
---|
70 | |
---|
71 | ;; TPR locations. This needs to be updated with time since more locations are added to the array. |
---|
72 | |
---|
73 | sitelist=['5n165e','8s67e','12s55e', '8s55e', '8s80.5e', '1.5s80.5e', '0n80.5e', '1.5n80.5e', '1.5s90e', $ |
---|
74 | '0n90e', '1.5n90e', '4n90e','8n90e','12n90e', '15n90e', '5s95e', $ |
---|
75 | '8s165e', '8s180w', '8s155w', '8s125w', '8s110w', '8s95w', '5s156e', '5s165e', '5s180w', '5s170w', $ |
---|
76 | '5s155w', '5s140w', '5s125w', '5s110w', '5s95w', '2s156e', '2s165e', '2s180w', '2s170w', '2s155w', '2s140w', $ |
---|
77 | '2s125w', '2s110w', '2s95w', '0n147e', '0n156e', '0n165e', '0n180w', '0n170w', '0n155w', '0n140w', '0n125w', $ |
---|
78 | '0n110w', '0n95w', '2n147e', '2n156e', '2n165e', '2n180w', '2n170w', '2n155w', '2n140w', '2n125w', '2n110w', $ |
---|
79 | '2n95w', '5n147e', '5n156e', '5n170w', '5n155w', '5n140w', '5n125w', '5n110w', '5n95w', $ |
---|
80 | '8n156e', '8n165e', '8n180w', '8n170w', '9n140w', '8n125w', '8n110w', '8n95w', $ |
---|
81 | '0n0e', '0n10w', '0n23w', '0n35w', '10s10w', '12n23w', '12n38w', '14s32w', '15n38w', '19s34w', '20n38w', $ |
---|
82 | '21n23w', '4n23w', '4n38w', '6s10w', '8n38w', '8s30w'] |
---|
83 | |
---|
84 | ;------------------------------------------------------------------------------------------------------------------------ |
---|
85 | ;; This program will create the following text files with statistics of respective variables |
---|
86 | ;------------------------------------------------------------------------------------------------------------------------ |
---|
87 | close,/all |
---|
88 | |
---|
89 | fi = project_id_env + 'basic_var_stat.txt' |
---|
90 | openw,1,fi |
---|
91 | |
---|
92 | printf,1, 'x y cor bias std ratio rmsd' |
---|
93 | ;------------------------------------------------------------------------------------------------------------------------ |
---|
94 | ;; First, this program reads the full TropFlux data and later extract it at specific TPR locations |
---|
95 | |
---|
96 | file = project_id_env + "sst_tropflux_1d_1989_2010.nc" |
---|
97 | initncdf, file |
---|
98 | var=read_ncdf("sst", date1, date2, file=file,/nostr) |
---|
99 | help, var |
---|
100 | |
---|
101 | ;------------------------------------------------------------------------------------------------------------------------ |
---|
102 | nn=n_elements(sitelist) |
---|
103 | date1=date1 |
---|
104 | date2=date2 |
---|
105 | nsmooth=1. ;; this will return daily TPR values |
---|
106 | mooring=0 & product=0 |
---|
107 | |
---|
108 | for n=0, nn-1 do begin |
---|
109 | |
---|
110 | ;; reading data from mooring |
---|
111 | |
---|
112 | site=sitelist(n) & csite=site |
---|
113 | print, csite |
---|
114 | x=x_site_location(site) |
---|
115 | y=y_site_location(site) |
---|
116 | if (y ge 0. and y le 30.) then y=y+360. |
---|
117 | dx=0.5 & dy=0.5 & box=[y-dy, y+dy, x-dx, x+dx] |
---|
118 | |
---|
119 | read_basic_var, csite,date1,date2,nsmooth, $ |
---|
120 | at, rh, sst, wu, wv, ws |
---|
121 | help, sst |
---|
122 | print, sst |
---|
123 | ;; select the appropriate variables for evaluation (trp = sw or lw or sh or lh) |
---|
124 | |
---|
125 | tpr=sst |
---|
126 | |
---|
127 | ind=where(finite(tpr)) & no_valid=n_elements(ind) |
---|
128 | |
---|
129 | if (no_valid ge min_obs) then begin |
---|
130 | |
---|
131 | |
---|
132 | extract_tpr_location,var,box, $ |
---|
133 | var_tpr |
---|
134 | var_tpr=reform(var_tpr) |
---|
135 | |
---|
136 | stats_5d, tpr,var_tpr, $ ;; tpr=TPR observation and var_tpr=gridded product extracted at TPR location |
---|
137 | cor, bias, std, rmsd |
---|
138 | |
---|
139 | printf, 1, x, y, cor, bias, std, rmsd, format='(f6.2, 3x, f6.2, 3x, f4.2, 3x, f7.2, 3x, f4.2, 3x, f5.2)' |
---|
140 | cstat=string(cor, bias, std, rmsd, format='(f4.2,3x,f7.2,3x,f4.2,3x,f5.2)') |
---|
141 | print, cstat |
---|
142 | |
---|
143 | ;; PLOTTING THE TIME-SERIES |
---|
144 | array=[tpr, var_tpr] & mi=min(array,/nan) & ma=max(array,/nan) & int=(ma-mi)/3. |
---|
145 | pltt, ts_smooth(tpr,5,/nan), "t",/rempl, small=[1,3,1], lct=65, $ |
---|
146 | title='Five day stats are shown below. TPR (black) and Product (red) at'+csite+' ', charsize=1., $ |
---|
147 | subtitle=cstat |
---|
148 | ind=where(finite(tpr,/nan)) & var_tpr(ind)=!Values.f_nan |
---|
149 | pltt, ts_smooth(var_tpr,5,/nan), "t",/ov1d, color=250 |
---|
150 | erase |
---|
151 | mooring=[mooring,tpr] & product=[product,var_tpr] |
---|
152 | endif |
---|
153 | endfor |
---|
154 | |
---|
155 | close,/all |
---|
156 | closeps |
---|
157 | |
---|
158 | end |
---|