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