1 | #!/bin/bash |
---|
2 | # Shell script to compare observations with simulations using PyNCplot |
---|
3 | # |
---|
4 | # observations: different files from create_OBSnetcdf.py and/or UWyoming_snd_nc.py |
---|
5 | # simulations: multiple outputs from different models and runs |
---|
6 | # |
---|
7 | |
---|
8 | # Name of the file with the configuration |
---|
9 | if test $1 = '-h'; then |
---|
10 | echo "************************************************" |
---|
11 | echo "*** Script to compare ***" |
---|
12 | echo "*** sounding and single-station observations ***" |
---|
13 | echo "*** with multiple simulations ***" |
---|
14 | echo "************************************************" |
---|
15 | echo "obs-sim_Comparison [ConfFile](configuration file)" |
---|
16 | else |
---|
17 | rootsh=`pwd` |
---|
18 | |
---|
19 | configfname=$1 |
---|
20 | |
---|
21 | ####### ###### ##### #### ### ## # |
---|
22 | |
---|
23 | function uploadvars() { |
---|
24 | # Function to upload variables to the system from an ASCII file as: |
---|
25 | # [varname] = [value] |
---|
26 | fileval=$1 |
---|
27 | errormsg='ERROR -- error -- ERROR -- error' |
---|
28 | |
---|
29 | if test ! -f ${fileval}; then |
---|
30 | echo ${errormsg} |
---|
31 | echo " "${fname}": file '"${fileval}"' does not exist!!" |
---|
32 | exit |
---|
33 | fi |
---|
34 | |
---|
35 | Nlin=`wc -l ${fileval} | awk '{print $1}'` |
---|
36 | |
---|
37 | ilin=1 |
---|
38 | while test ${ilin} -le ${Nlin}; do |
---|
39 | line=`head -n ${ilin} ${fileval} | tail -n 1` |
---|
40 | varname=`echo ${line} | tr '=' ' ' | awk '{print $1}'` |
---|
41 | value=`echo ${line} | tr '=' ' ' | awk '{print $2}'` |
---|
42 | Lvarname=`expr length ${varname}'0'` |
---|
43 | |
---|
44 | if test ${Lvarname} -gt 1 && test ! ${varname:0:1} = '#'; then |
---|
45 | export ${varname}=${value} |
---|
46 | fi |
---|
47 | ilin=`expr ${ilin} + 1` |
---|
48 | done |
---|
49 | } |
---|
50 | |
---|
51 | uploadvars ${configfname} |
---|
52 | echo "END upload -- end UPLOAD -- END upload -- end UPLOAD" |
---|
53 | |
---|
54 | # files from scratch |
---|
55 | if test ${fscratch} = 'true'; then fscratch=true |
---|
56 | else fscratch=false; fi |
---|
57 | |
---|
58 | # figures from scratch |
---|
59 | if test ${gscratch} = 'true'; then gscratch=true |
---|
60 | else gscratch=false; fi |
---|
61 | |
---|
62 | function num_hex(){ |
---|
63 | # Fucntion to transform a number to a hexagonal basis |
---|
64 | # num: number to transform |
---|
65 | fname='num_hex' |
---|
66 | num=$1 |
---|
67 | |
---|
68 | if test ${num} -gt 255; then |
---|
69 | echo ${errormsg} |
---|
70 | echo " "${fname}": value "${num}" too large !!" |
---|
71 | exit |
---|
72 | fi |
---|
73 | if test ${num} -gt 16; then |
---|
74 | xviA=`expr ${num} / 16` |
---|
75 | numA=`expr ${xviA} '*' 16` |
---|
76 | xviB=`expr ${num} - ${numA}` |
---|
77 | else |
---|
78 | xviA=0 |
---|
79 | xviB=${num} |
---|
80 | fi |
---|
81 | |
---|
82 | if test ${xviA} -gt 9; then |
---|
83 | case ${xviA} in |
---|
84 | 10) |
---|
85 | hexA='A' |
---|
86 | ;; |
---|
87 | 11) |
---|
88 | hexA='B' |
---|
89 | ;; |
---|
90 | 12) |
---|
91 | hexA='C' |
---|
92 | ;; |
---|
93 | 13) |
---|
94 | hexA='D' |
---|
95 | ;; |
---|
96 | 14) |
---|
97 | hexA='E' |
---|
98 | ;; |
---|
99 | 15) |
---|
100 | hexA='F' |
---|
101 | ;; |
---|
102 | esac |
---|
103 | else |
---|
104 | hexA=${xviA} |
---|
105 | fi |
---|
106 | |
---|
107 | if test ${xviB} -gt 9; then |
---|
108 | case ${xviB} in |
---|
109 | 10) |
---|
110 | hexB='A' |
---|
111 | ;; |
---|
112 | 11) |
---|
113 | hexB='B' |
---|
114 | ;; |
---|
115 | 12) |
---|
116 | hexB='C' |
---|
117 | ;; |
---|
118 | 13) |
---|
119 | hexB='D' |
---|
120 | ;; |
---|
121 | 14) |
---|
122 | hexB='E' |
---|
123 | ;; |
---|
124 | 15) |
---|
125 | hexB='F' |
---|
126 | ;; |
---|
127 | esac |
---|
128 | else |
---|
129 | hexB=${xviB} |
---|
130 | fi |
---|
131 | |
---|
132 | echo ${hexA}${hexB} |
---|
133 | } |
---|
134 | |
---|
135 | function isin_list() { |
---|
136 | # Function to check whether a value is in a list |
---|
137 | list=$1 |
---|
138 | value=$2 |
---|
139 | |
---|
140 | is=`echo ${list} | tr ':' '\n' | awk '{print "@"$1"@"}' | grep '@'${value}'@' | wc -w` |
---|
141 | if test ${is} -eq 1 |
---|
142 | then |
---|
143 | true |
---|
144 | else |
---|
145 | false |
---|
146 | fi |
---|
147 | } |
---|
148 | |
---|
149 | function get_WRFsounding_data(){ |
---|
150 | # Function to get the data to compute analysis in a sounding point |
---|
151 | # stlon= longitude value of the station |
---|
152 | # stlat= latitude value of the station |
---|
153 | # filen= name of the file |
---|
154 | # lonvarn= name of the longitude variable |
---|
155 | # latvarn= name of the latitude variable |
---|
156 | # snddiagnames= diagnostics to compute (as ':' separated list) |
---|
157 | # snddiagd= name of the dimensions and dimension variables to use for diagnostics |
---|
158 | |
---|
159 | funcvals=$1 |
---|
160 | |
---|
161 | stlon=`echo ${funcvals} | tr '#' ' ' | awk '{print $1}'` |
---|
162 | stlat=`echo ${funcvals} | tr '#' ' ' | awk '{print $2}'` |
---|
163 | filen=`echo ${funcvals} | tr '#' ' ' | awk '{print $3}'` |
---|
164 | lonvarn=`echo ${funcvals} | tr '#' ' ' | awk '{print $4}'` |
---|
165 | latvarn=`echo ${funcvals} | tr '#' ' ' | awk '{print $5}'` |
---|
166 | snddiagnames=`echo ${funcvals} | tr '#' ' ' | awk '{print $6}'` |
---|
167 | snddiagd=`echo ${funcvals} | tr '#' ' ' | awk '{print $7}'` |
---|
168 | |
---|
169 | vals=${lonvarn}':'${latvarn}':Time|0' |
---|
170 | gridsndv=`python ${pyHOME}/nc_var.py -o get_point -f ${filen} -S ${vals} \ |
---|
171 | -v ${stlon},${stlat} | tr ' ' '!'` |
---|
172 | echo "* get grid point: "${stlon}", "${stlat} >> ${ofileins} |
---|
173 | echo python ${pyHOME}/nc_var.py -o get_point -f ${filen} -S "'"${vals}"'" \ |
---|
174 | -v ${stlon},${stlat} >> ${ofileins} |
---|
175 | echo " " >> ${ofileins} |
---|
176 | |
---|
177 | xsnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $1}' | tr ',' ' ' | \ |
---|
178 | awk '{print $1}'` |
---|
179 | ysnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $1}' | tr ',' ' ' | \ |
---|
180 | awk '{print $2}'` |
---|
181 | dsnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $2}'` |
---|
182 | |
---|
183 | xsnd1=`expr ${xsnd} + 1` |
---|
184 | ysnd1=`expr ${ysnd} + 1` |
---|
185 | |
---|
186 | # Getting values |
---|
187 | if ${fscratch}; then rm ${simsndptf} >& /dev/null; fi |
---|
188 | if test ! -f ${simsndptf}; then |
---|
189 | values='Time,0,-1,1@bottom_top,0,-1,1@south_north,'${ysnd}','${ysnd}',1@' |
---|
190 | values=${values}'west_east,'${xsnd}','${xsnd}',1@south_north_stag,'${ysnd}',' |
---|
191 | values=${values}${ysnd1}',1@west_east_stag,'${xsnd}','${xsnd1}',1:False' |
---|
192 | python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
193 | -S ${values} -v all |
---|
194 | if test $? -ne 0; then |
---|
195 | echo ${errmsg} |
---|
196 | echo " python failed!!" |
---|
197 | echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
198 | -S "'"${values}"'" -v all |
---|
199 | exit |
---|
200 | fi |
---|
201 | echo "* get values at snd point: "${stlon}", "${stlat} >> ${ofileins} |
---|
202 | echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
203 | -S "'"${values}"'" -v all >> ${ofileins} |
---|
204 | echo " " >> ${ofileins} |
---|
205 | |
---|
206 | yslc='south_north_B'${ysnd}'-E'${ysnd}'-I1' |
---|
207 | ystslc='south_north_stag_B'${ysnd}'-E'${ysnd1}'-I1' |
---|
208 | xslc='west_east_B'${xsnd}'-E'${xsnd}'-I1' |
---|
209 | xstslc='west_east_stag_B'${xsnd}'-E'${xsnd1}'-I1' |
---|
210 | |
---|
211 | Hfilen=`basename ${filen}` |
---|
212 | Dfilen=`dirname ${filen}` |
---|
213 | Hhfilen=`echo ${Hfilen} | tr '.' ' ' | awk '{print $1}'` |
---|
214 | |
---|
215 | ofilen='newfile_multidims.nc' |
---|
216 | mv ${ofilen} ${simsndptf} |
---|
217 | fi |
---|
218 | |
---|
219 | # Computing sounding diagnostics |
---|
220 | diagns=`echo ${snddiagnames} | tr ':' ' '` |
---|
221 | |
---|
222 | idiag=1 |
---|
223 | for diagn in ${diagns}; do |
---|
224 | diagv=`cat $pyHOME/diagnostics.inf | grep ${diagn}',' | tr ',' ' ' | \ |
---|
225 | awk '{print $2"|"$3}'` |
---|
226 | if test ${idiag} -eq 1; then |
---|
227 | snddiagvals=${diagv} |
---|
228 | else |
---|
229 | snddiagvals=${snddiagvals}','${diagv} |
---|
230 | fi |
---|
231 | idiag=`expr ${idiag} + 1` |
---|
232 | done |
---|
233 | |
---|
234 | if ${fscratch}; then rm ${simsnddiagsf}; fi |
---|
235 | if test ! -f ${simsnddiagsf}; then |
---|
236 | python ${pyHOME}/diagnostics.py -f ${simsndptf} -d ${snddiagd} -v ${snddiagvals} |
---|
237 | if test $? -ne 0; then |
---|
238 | echo ${errmsg} |
---|
239 | echo " python failed!!" |
---|
240 | echo python ${pyHOME}/diagnostics.py -f ${simsndptf} -d "'"${snddiagd}"'" -v \ |
---|
241 | "'"${snddiagvals}"'" |
---|
242 | exit |
---|
243 | fi |
---|
244 | echo "* computing diagnostics at snd point: "${stlon}", "${stlat} >> ${ofileins} |
---|
245 | echo python ${pyHOME}/diagnostics.py -f "'"${simsndptf}"'" -d "'"${snddiagd}"'" \ |
---|
246 | -v "'"${snddiagvals}"'" >> ${ofileins} |
---|
247 | echo " " >> ${ofileins} |
---|
248 | |
---|
249 | mv diagnostics.nc ${simsnddiagsf} |
---|
250 | if $(isin_list ${snddiagnames} WRFt); then |
---|
251 | #To deg |
---|
252 | python ${pyHOME}/nc_var.py -o valmod -S subc,273.15 -f ${simsnddiagsf} -v ta |
---|
253 | fi |
---|
254 | if $(isin_list ${snddiagnames} WRFp); then |
---|
255 | #To Pa |
---|
256 | python ${pyHOME}/nc_var.py -o valmod -S divc,100. -f ${simsnddiagsf} -v pres |
---|
257 | fi |
---|
258 | fi |
---|
259 | } |
---|
260 | |
---|
261 | function get_WRFsurface_data(){ |
---|
262 | # Function to get the data to compute analysis in a surface point |
---|
263 | # stlon= longitude value of the station |
---|
264 | # stlat= latitude value of the station |
---|
265 | # filen= name of the file |
---|
266 | # lonvarn= name of the longitude variable |
---|
267 | # latvarn= name of the latitude variable |
---|
268 | # sfcdiagnames= diagnostics to compute (as ':' separated list) |
---|
269 | # nondiagvs= ':' list of variables which are not from a diagnostics ('None' for |
---|
270 | # without) |
---|
271 | # sfcdiagd= name of the dimensions and dimension variables to use for diagnostics |
---|
272 | |
---|
273 | funcvals=$1 |
---|
274 | |
---|
275 | stlon=`echo ${funcvals} | tr '#' ' ' | awk '{print $1}'` |
---|
276 | stlat=`echo ${funcvals} | tr '#' ' ' | awk '{print $2}'` |
---|
277 | filen=`echo ${funcvals} | tr '#' ' ' | awk '{print $3}'` |
---|
278 | lonvarn=`echo ${funcvals} | tr '#' ' ' | awk '{print $4}'` |
---|
279 | latvarn=`echo ${funcvals} | tr '#' ' ' | awk '{print $5}'` |
---|
280 | sfcdiagnames=`echo ${funcvals} | tr '#' ' ' | awk '{print $6}'` |
---|
281 | nondiagvs=`echo ${funcvals} | tr '#' ' ' | awk '{print $7}'` |
---|
282 | sfcdiagd=`echo ${funcvals} | tr '#' ' ' | awk '{print $8}'` |
---|
283 | |
---|
284 | vals=${lonvarn}':'${latvarn}':Time|0' |
---|
285 | gridsndv=`python ${pyHOME}/nc_var.py -o get_point -f ${filen} -S ${vals} \ |
---|
286 | -v ${stlon},${stlat} | tr ' ' '!'` |
---|
287 | echo "* get grid point: "${stlon}", "${stlat} >> ${ofileins} |
---|
288 | echo python ${pyHOME}/nc_var.py -o get_point -f ${filen} -S "'"${vals}"'" \ |
---|
289 | -v ${stlon},${stlat} >> ${ofileins} |
---|
290 | echo " " >> ${ofileins} |
---|
291 | xsnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $1}' | tr ',' ' ' | \ |
---|
292 | awk '{print $1}'` |
---|
293 | ysnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $1}' | tr ',' ' ' | \ |
---|
294 | awk '{print $2}'` |
---|
295 | dsnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $2}'` |
---|
296 | |
---|
297 | xsnd1=`expr ${xsnd} + 1` |
---|
298 | ysnd1=`expr ${ysnd} + 1` |
---|
299 | |
---|
300 | # Getting values |
---|
301 | if ${fscratch}; then rm ${simsfcptf} >& /dev/null; fi |
---|
302 | if test ! -f ${simsfcptf}; then |
---|
303 | values='Time,0,-1,1@south_north,'${ysnd}','${ysnd}',1@' |
---|
304 | values=${values}'west_east,'${xsnd}','${xsnd}',1@south_north_stag,'${ysnd}',' |
---|
305 | values=${values}${ysnd1}',1@west_east_stag,'${xsnd}','${xsnd1}',1:False' |
---|
306 | python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
307 | -S ${values} -v all |
---|
308 | if test $? -ne 0; then |
---|
309 | echo ${errmsg} |
---|
310 | echo " python failed!!" |
---|
311 | echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
312 | -S "'"${values}"'" -v all |
---|
313 | exit |
---|
314 | fi |
---|
315 | echo "* get values at sfc point: "${stlon}", "${stlat} >> ${ofileins} |
---|
316 | echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
317 | -S "'"${values}"'" -v all >> ${ofileins} |
---|
318 | echo " " >> ${ofileins} |
---|
319 | yslc='south_north_B'${ysnd}'-E'${ysnd}'-I1' |
---|
320 | ystslc='south_north_stag_B'${ysnd}'-E'${ysnd1}'-I1' |
---|
321 | xslc='west_east_B'${xsnd}'-E'${xsnd}'-I1' |
---|
322 | xstslc='west_east_stag_B'${xsnd}'-E'${xsnd1}'-I1' |
---|
323 | |
---|
324 | ofilen='newfile_multidims.nc' |
---|
325 | mv ${ofilen} ${simsfcptf} |
---|
326 | fi |
---|
327 | |
---|
328 | # Computing sfc diagnostics |
---|
329 | diagns=`echo ${sfcdiagnames} | tr ':' ' '` |
---|
330 | |
---|
331 | idiag=1 |
---|
332 | for diagn in ${diagns}; do |
---|
333 | diagv=`cat $pyHOME/diagnostics.inf | grep WRF | grep ${diagn}',' | tr ',' ' ' | \ |
---|
334 | awk '{print $2"|"$3}'` |
---|
335 | if test ${idiag} -eq 1; then |
---|
336 | sfcdiagvals=${diagv} |
---|
337 | else |
---|
338 | sfcdiagvals=${sfcdiagvals}','${diagv} |
---|
339 | fi |
---|
340 | idiag=`expr ${idiag} + 1` |
---|
341 | done |
---|
342 | |
---|
343 | if ${fscratch}; then rm ${simsfcdiagsf}; fi |
---|
344 | if test ! -f ${simsfcdiagsf}; then |
---|
345 | python ${pyHOME}/diagnostics.py -f ${simsfcptf} -d ${sfcdiagd} -v ${sfcdiagvals} |
---|
346 | if test $? -ne 0; then |
---|
347 | echo ${errmsg} |
---|
348 | echo " python failed!!" |
---|
349 | echo python ${pyHOME}/diagnostics.py -f ${simsfcptf} -d "'"${sfcdiagd}"'" \ |
---|
350 | -v "'"${sfcdiagvals}"'" |
---|
351 | exit |
---|
352 | fi |
---|
353 | echo "* diagnostics at sfc point: "${stlon}", "${stlat} >> ${ofileins} |
---|
354 | echo python ${pyHOME}/diagnostics.py -f ${simsfcptf} -d "'"${sfcdiagd}"'" \ |
---|
355 | -v "'"${sfcdiagvals}"'" >> ${ofileins} |
---|
356 | echo " " >> ${ofileins} |
---|
357 | mv diagnostics.nc ${simsfcdiagsf} |
---|
358 | if $(isin_list ${sfcdiagnames} wds); then |
---|
359 | #To rad |
---|
360 | python ${pyHOME}/nc_var.py -o valmod -S mulc,0.0174532925199 -f ${simsfcdiagsf}\ |
---|
361 | -v wds |
---|
362 | python ${pyHOME}/nc_var.py -o varaddattr -S 'units|rad' -f ${simsfcdiagsf} -v wds |
---|
363 | fi |
---|
364 | |
---|
365 | #Adding non-diagnostic variables |
---|
366 | if test ! ${nondiagvs} = 'None'; then |
---|
367 | varsadd=`echo ${nondiagvs} | tr ':' ' '` |
---|
368 | for vadd in ${varsadd}; do |
---|
369 | python ${pyHOME}/nc_var.py -o fvaradd -S ${simsfcptf},${vadd} \ |
---|
370 | -f ${simsfcdiagsf} |
---|
371 | if test $? -ne 0; then |
---|
372 | echo ${errmsg} |
---|
373 | echo " python failed!!" |
---|
374 | echo python ${pyHOME}/nc_var.py -o fvaradd -S "'"${simsfcptf},${vadd}"'" \ |
---|
375 | -f ${simsfcdiagsf} |
---|
376 | exit |
---|
377 | rm ${simsfcdiagsf} |
---|
378 | fi |
---|
379 | echo "* adding variable '"${vadd}"' at sfc point: "${stlon}", "${stlat} >> \ |
---|
380 | ${ofileins} |
---|
381 | echo python ${pyHOME}/nc_var.py -o fvaradd -S "'"${simsfcptf},${vadd}"'" \ |
---|
382 | -f ${simsfcdiagsf} >> ${ofileins} |
---|
383 | echo " " >> ${ofileins} |
---|
384 | # CF varname |
---|
385 | CFvarn=`python $pyHOME/generic.py -o variables_values -S ${vadd} | \ |
---|
386 | tr ':' ' ' | awk '{print $1}'` |
---|
387 | if test $? -ne 0; then |
---|
388 | echo ${errmsg} |
---|
389 | echo " python failed!!" |
---|
390 | echo python $pyHOME/generic.py -o variables_values -S ${vadd} |
---|
391 | exit |
---|
392 | rm ${simsfcdiagsf} |
---|
393 | fi |
---|
394 | python $pyHOME/nc_var.py -o chvarname -S ${CFvarn} -f ${simsfcdiagsf} \ |
---|
395 | -v ${vadd} |
---|
396 | if test $? -ne 0; then |
---|
397 | echo ${errmsg} |
---|
398 | echo " python failed!!" |
---|
399 | echo python ${pyHOME}/nc_var.py -o chvarname -S ${CFvarn} \ |
---|
400 | -f ${simsfcdiagsf} -v ${vadd} |
---|
401 | exit |
---|
402 | rm ${simsfcdiagsf} |
---|
403 | fi |
---|
404 | done |
---|
405 | fi |
---|
406 | fi |
---|
407 | } |
---|
408 | |
---|
409 | function get_WRFsfc2D_data(){ |
---|
410 | # Function to get the data to compute analysis in a surface map |
---|
411 | # filen= name of the file |
---|
412 | # sfcdiagnames= diagnostics to compute (as ':' separated list) |
---|
413 | # nondiagvs= ':' list of variables which are not from a diagnostics ('None' for |
---|
414 | # without) |
---|
415 | # sfcmapdiagd= name of the dimensions and dimension variables to use for diagnostics |
---|
416 | |
---|
417 | funcvals=$1 |
---|
418 | |
---|
419 | filen=`echo ${funcvals} | tr '#' ' ' | awk '{print $1}'` |
---|
420 | sfcdiagnames=`echo ${funcvals} | tr '#' ' ' | awk '{print $2}'` |
---|
421 | nondiagvs=`echo ${funcvals} | tr '#' ' ' | awk '{print $3}'` |
---|
422 | sfcmapdiagd=`echo ${funcvals} | tr '#' ' ' | awk '{print $4}'` |
---|
423 | |
---|
424 | # Computing sfc diagnostics |
---|
425 | diagns=`echo ${sfcdiagnames} | tr ':' ' '` |
---|
426 | |
---|
427 | # getting that variables only required for the diagnostics |
---|
428 | vardiags='' |
---|
429 | idiag=1 |
---|
430 | for diagn in ${diagns}; do |
---|
431 | diagv=`cat $pyHOME/diagnostics.inf | grep WRF | grep ${diagn}',' | tr ',' ' ' | \ |
---|
432 | awk '{print $2"|"$3}'` |
---|
433 | if test ${idiag} -eq 1; then |
---|
434 | sfcdiagvals=${diagv} |
---|
435 | vardiags=`echo ${diagv} | tr '|' ' ' | awk '{print $2}' | tr '@' ':'` |
---|
436 | else |
---|
437 | sfcdiagvals=${sfcdiagvals}','${diagv} |
---|
438 | vardiag=`echo ${diagv} | tr '|' ' ' | awk '{print $2}' | tr '@' ' '` |
---|
439 | for vd in ${vardiag}; do |
---|
440 | if ! $(isin_list ${vardiags} ${vd}); then vardiags=${vardiags}':'${vd}; fi |
---|
441 | done |
---|
442 | fi |
---|
443 | idiag=`expr ${idiag} + 1` |
---|
444 | done |
---|
445 | |
---|
446 | # Inlcuding non-diagnostics |
---|
447 | if test ! ${nondiagvs} = 'None'; then |
---|
448 | nvns=`echo ${nondiagvs} | tr ':' ' '` |
---|
449 | for vn in ${nvns}; do |
---|
450 | if ! $(isin_list ${vardiags} ${vn}); then vardiags=${vardiags}':'${vn}; fi |
---|
451 | done |
---|
452 | if ! $(isin_list ${vardiags} 'time'); then vardiags=${vardiags}':time'; fi |
---|
453 | fi |
---|
454 | vardiag=`echo ${vardiags} | tr ':' ','` |
---|
455 | |
---|
456 | # Getting values |
---|
457 | if ${fscratch}; then rm ${simsfcmapf} >& /dev/null; fi |
---|
458 | if test ! -f ${simsfcmapf}; then |
---|
459 | values='Time,0,-1,1@south_north,0,-1,1@west_east,0,-1,1@south_north_stag,0,-1,1@' |
---|
460 | values=${values}'west_east_stag,0,-1,1:False' |
---|
461 | python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
462 | -S ${values} -v ${vardiag} |
---|
463 | if test $? -ne 0; then |
---|
464 | echo ${errmsg} |
---|
465 | echo " python failed!!" |
---|
466 | echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
467 | -S "'"${values}"'" -v ${vardiag} |
---|
468 | exit |
---|
469 | fi |
---|
470 | echo "* get values for 2D map diagnostics: " >> ${ofileins} |
---|
471 | echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
472 | -S "'"${values}"'" -v ${vardiag} >> ${ofileins} |
---|
473 | echo " " >> ${ofileins} |
---|
474 | |
---|
475 | ofilen='newfile_multidims.nc' |
---|
476 | mv ${ofilen} ${simsfcmapf} |
---|
477 | fi |
---|
478 | |
---|
479 | if ${fscratch}; then rm ${simsfcmapdiagsf}; fi |
---|
480 | if test ! -f ${simsfcmapdiagsf}; then |
---|
481 | python ${pyHOME}/diagnostics.py -f ${simsfcmapf} -d ${sfcmapdiagd} \ |
---|
482 | -v ${sfcdiagvals} |
---|
483 | if test $? -ne 0; then |
---|
484 | echo ${errmsg} |
---|
485 | echo " python failed!!" |
---|
486 | echo python ${pyHOME}/diagnostics.py -f ${simsfcmapf} -d "'"${sfcmapdiagd}"'" \ |
---|
487 | -v "'"${sfcdiagvals}"'" |
---|
488 | exit |
---|
489 | fi |
---|
490 | echo "* diagnostics for sfc 2D map: " >> ${ofileins} |
---|
491 | echo python ${pyHOME}/diagnostics.py -f ${simsfcmapf} -d "'"${sfcmapdiagd}"'" \ |
---|
492 | -v "'"${sfcdiagvals}"'" >> ${ofileins} |
---|
493 | echo " " >> ${ofileins} |
---|
494 | mv diagnostics.nc ${simsfcmapdiagsf} |
---|
495 | if $(isin_list ${sfcdiagnames} wds); then |
---|
496 | #To rad |
---|
497 | python ${pyHOME}/nc_var.py -o valmod -S mulc,0.0174532925199 \ |
---|
498 | -f ${simsfcmapdiagsf} -v wds |
---|
499 | python ${pyHOME}/nc_var.py -o varaddattr -S 'units|rad' -f ${simsfcmapdiagsf} \ |
---|
500 | -v wds |
---|
501 | fi |
---|
502 | |
---|
503 | #Adding non-diagnostic variables |
---|
504 | if test ! ${nondiagvs} = 'None'; then |
---|
505 | varsadd=`echo ${nondiagvs} | tr ':' ' '` |
---|
506 | for vadd in ${varsadd}; do |
---|
507 | python ${pyHOME}/nc_var.py -o fvaradd -S ${simsfcmapf},${vadd} \ |
---|
508 | -f ${simsfcmapdiagsf} |
---|
509 | if test $? -ne 0; then |
---|
510 | echo ${errmsg} |
---|
511 | echo " python failed!!" |
---|
512 | echo python ${pyHOME}/nc_var.py -o fvaradd -S "'"${simsfcmapf},${vadd}"'" \ |
---|
513 | -f ${simsfcmapdiagsf} |
---|
514 | exit |
---|
515 | rm ${simsfcmapdiagsf} |
---|
516 | fi |
---|
517 | echo "* adding variable '"${vadd}"' at sfc map: " >> ${ofileins} |
---|
518 | echo python ${pyHOME}/nc_var.py -o fvaradd -S "'"${simsfcmapf},${vadd}"'" \ |
---|
519 | -f ${simsfcmapdiagsf} >> ${ofileins} |
---|
520 | echo " " >> ${ofileins} |
---|
521 | # CF varname |
---|
522 | CFvarn=`python $pyHOME/generic.py -o variables_values -S ${vadd} | \ |
---|
523 | tr ':' ' ' | awk '{print $1}'` |
---|
524 | if test $? -ne 0; then |
---|
525 | echo ${errmsg} |
---|
526 | echo " python failed!!" |
---|
527 | echo python $pyHOME/generic.py -o variables_values -S ${vadd} |
---|
528 | exit |
---|
529 | rm ${simsfcmapdiagsf} |
---|
530 | fi |
---|
531 | python $pyHOME/nc_var.py -o chvarname -S ${CFvarn} -f ${simsfcmapdiagsf} \ |
---|
532 | -v ${vadd} |
---|
533 | if test $? -ne 0; then |
---|
534 | echo ${errmsg} |
---|
535 | echo " python failed!!" |
---|
536 | echo python ${pyHOME}/nc_var.py -o chvarname -S ${CFvarn} \ |
---|
537 | -f ${simsfcmapdiagsf} -v ${vadd} |
---|
538 | exit |
---|
539 | rm ${simsfcmapdiagsf} |
---|
540 | fi |
---|
541 | done |
---|
542 | fi |
---|
543 | fi |
---|
544 | } |
---|
545 | |
---|
546 | function get_WRFCDXsfc2D_data(){ |
---|
547 | # Function to get the data from WRFCDX to compute analysis in a surface map |
---|
548 | # filen= name of the file |
---|
549 | # sfcdiagnames= diagnostics to compute (as ':' separated list) |
---|
550 | # nondiagvs= ':' list of variables which are not from a diagnostics ('None' for |
---|
551 | # without) |
---|
552 | # sfcmapdiagd= name of the dimensions and dimension variables to use for diagnostics |
---|
553 | |
---|
554 | funcvals=$1 |
---|
555 | |
---|
556 | filen=`echo ${funcvals} | tr '#' ' ' | awk '{print $1}'` |
---|
557 | sfcdiagnames=`echo ${funcvals} | tr '#' ' ' | awk '{print $2}'` |
---|
558 | nondiagvs=`echo ${funcvals} | tr '#' ' ' | awk '{print $3}'` |
---|
559 | sfcmapdiagd=`echo ${funcvals} | tr '#' ' ' | awk '{print $4}'` |
---|
560 | |
---|
561 | # Computing sfc diagnostics |
---|
562 | diagns=`echo ${sfcdiagnames} | tr ':' ' '` |
---|
563 | |
---|
564 | # getting that variables only required for the diagnostics |
---|
565 | vardiags='' |
---|
566 | idiag=1 |
---|
567 | for diagn in ${diagns}; do |
---|
568 | diagv=`cat $pyHOME/diagnostics.inf | grep WRF | grep ${diagn}',' | tr ',' ' ' | \ |
---|
569 | awk '{print $2"|"$3}'` |
---|
570 | if test ${idiag} -eq 1; then |
---|
571 | sfcdiagvals=${diagv} |
---|
572 | vardiags=`echo ${diagv} | tr '|' ' ' | awk '{print $2}' | tr '@' ':'` |
---|
573 | else |
---|
574 | sfcdiagvals=${sfcdiagvals}','${diagv} |
---|
575 | vardiag=`echo ${diagv} | tr '|' ' ' | awk '{print $2}' | tr '@' ' '` |
---|
576 | for vd in ${vardiag}; do |
---|
577 | if ! $(isin_list ${vardiags} ${vd}); then vardiags=${vardiags}':'${vd}; fi |
---|
578 | done |
---|
579 | fi |
---|
580 | idiag=`expr ${idiag} + 1` |
---|
581 | done |
---|
582 | |
---|
583 | # Inlcuding non-diagnostics |
---|
584 | if test ! ${nondiagvs} = 'None'; then |
---|
585 | nvns=`echo ${nondiagvs} | tr ':' ' '` |
---|
586 | for vn in ${nvns}; do |
---|
587 | if ! $(isin_list ${vardiags} ${vn}); then vardiags=${vardiags}':'${vn}; fi |
---|
588 | done |
---|
589 | if ! $(isin_list ${vardiags} 'time'); then vardiags=${vardiags}':time'; fi |
---|
590 | fi |
---|
591 | vardiag=`echo ${vardiags} | tr ':' ','` |
---|
592 | |
---|
593 | # Getting values |
---|
594 | if ${fscratch}; then rm ${simsfcmapf} >& /dev/null; fi |
---|
595 | if test ! -f ${simsfcmapf}; then |
---|
596 | values='Time,0,-1,1@south_north,0,-1,1@west_east,0,-1,1:False' |
---|
597 | python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
598 | -S ${values} -v ${vardiag} |
---|
599 | if test $? -ne 0; then |
---|
600 | echo ${errmsg} |
---|
601 | echo " python failed!!" |
---|
602 | echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
603 | -S "'"${values}"'" -v ${vardiag} |
---|
604 | exit |
---|
605 | fi |
---|
606 | echo "* get values for 2D map diagnostics: " >> ${ofileins} |
---|
607 | echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \ |
---|
608 | -S "'"${values}"'" -v ${vardiag} >> ${ofileins} |
---|
609 | echo " " >> ${ofileins} |
---|
610 | |
---|
611 | ofilen='newfile_multidims.nc' |
---|
612 | mv ${ofilen} ${simsfcmapf} |
---|
613 | fi |
---|
614 | |
---|
615 | if ${fscratch}; then rm ${simsfcmapdiagsf}; fi |
---|
616 | if test ! -f ${simsfcmapdiagsf}; then |
---|
617 | python ${pyHOME}/diagnostics.py -f ${simsfcmapf} -d ${sfcmapdiagd} \ |
---|
618 | -v ${sfcdiagvals} |
---|
619 | if test $? -ne 0; then |
---|
620 | echo ${errmsg} |
---|
621 | echo " python failed!!" |
---|
622 | echo python ${pyHOME}/diagnostics.py -f ${simsfcmapf} -d "'"${sfcmapdiagd}"'" \ |
---|
623 | -v "'"${sfcdiagvals}"'" |
---|
624 | exit |
---|
625 | fi |
---|
626 | echo "* diagnostics for sfc 2D map: " >> ${ofileins} |
---|
627 | echo python ${pyHOME}/diagnostics.py -f ${simsfcmapf} -d "'"${sfcmapdiagd}"'" \ |
---|
628 | -v "'"${sfcdiagvals}"'" >> ${ofileins} |
---|
629 | echo " " >> ${ofileins} |
---|
630 | mv diagnostics.nc ${simsfcmapdiagsf} |
---|
631 | |
---|
632 | #Adding non-diagnostic variables |
---|
633 | if test ! ${nondiagvs} = 'None'; then |
---|
634 | varsadd=`echo ${nondiagvs} | tr ':' ' '` |
---|
635 | for vadd in ${varsadd}; do |
---|
636 | python ${pyHOME}/nc_var.py -o fvaradd -S ${simsfcmapf},${vadd} \ |
---|
637 | -f ${simsfcmapdiagsf} |
---|
638 | if test $? -ne 0; then |
---|
639 | echo ${errmsg} |
---|
640 | echo " python failed!!" |
---|
641 | echo python ${pyHOME}/nc_var.py -o fvaradd -S "'"${simsfcmapf},${vadd}"'" \ |
---|
642 | -f ${simsfcmapdiagsf} |
---|
643 | exit |
---|
644 | rm ${simsfcmapdiagsf} |
---|
645 | fi |
---|
646 | echo "* adding variable '"${vadd}"' at sfc map: " >> ${ofileins} |
---|
647 | echo python ${pyHOME}/nc_var.py -o fvaradd -S "'"${simsfcmapf},${vadd}"'" \ |
---|
648 | -f ${simsfcmapdiagsf} >> ${ofileins} |
---|
649 | echo " " >> ${ofileins} |
---|
650 | # CF varname |
---|
651 | CFvarn=`python $pyHOME/generic.py -o variables_values -S ${vadd} | \ |
---|
652 | tr ':' ' ' | awk '{print $1}'` |
---|
653 | if test $? -ne 0; then |
---|
654 | echo ${errmsg} |
---|
655 | echo " python failed!!" |
---|
656 | echo python $pyHOME/generic.py -o variables_values -S ${vadd} |
---|
657 | exit |
---|
658 | rm ${simsfcmapdiagsf} |
---|
659 | fi |
---|
660 | python $pyHOME/nc_var.py -o chvarname -S ${CFvarn} -f ${simsfcmapdiagsf} \ |
---|
661 | -v ${vadd} |
---|
662 | if test $? -ne 0; then |
---|
663 | echo ${errmsg} |
---|
664 | echo " python failed!!" |
---|
665 | echo python ${pyHOME}/nc_var.py -o chvarname -S ${CFvarn} \ |
---|
666 | -f ${simsfcmapdiagsf} -v ${vadd} |
---|
667 | exit |
---|
668 | rm ${simsfcmapdiagsf} |
---|
669 | fi |
---|
670 | done |
---|
671 | fi |
---|
672 | fi |
---|
673 | } |
---|
674 | |
---|
675 | function WindRose_plot() { |
---|
676 | # Function to plot a Wind rose |
---|
677 | # it: time-step to use from the file |
---|
678 | # sndstid: id of the sounding station |
---|
679 | # sndstn: name of the sounding station to appear in plot ('!' for spaces) |
---|
680 | # timeS: String with the format of the actual time ('!' for spaces) |
---|
681 | # ofigdir: folder for the output of the figure |
---|
682 | # timefS: date of the plot to be used for the figure name |
---|
683 | # filen: file to use |
---|
684 | # figheader: header of the figure's file name |
---|
685 | |
---|
686 | valuesfig=$1 |
---|
687 | |
---|
688 | it=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` |
---|
689 | sndstid=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` |
---|
690 | sndstn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` |
---|
691 | timeS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` |
---|
692 | ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` |
---|
693 | timefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` |
---|
694 | filen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` |
---|
695 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` |
---|
696 | |
---|
697 | values='pres|-1;time|'${it}':linepoint;multicol;pres;auto;auto;rainbow;auto:' |
---|
698 | values=${values}${sndstn}'!sounding!WindRose!on!'${timeS}'!local!time:'${kfig} |
---|
699 | values=${values}':cardinals:False:WindRose:True' |
---|
700 | ofign=${ofigdir}'/'${figheader}'_'${sndstid}'_'${timefS}'.'${kfig} |
---|
701 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
702 | if test ! -f ${ofign}; then |
---|
703 | echo " Wind Rose on: "$(echo ${timeS} | tr '!' ' ') |
---|
704 | python ${pyHOME}/drawing.py -o draw_WindRose -S ${values} -v ua,va -f ${filen} >& /dev/null |
---|
705 | if test $? -ne 0; then |
---|
706 | echo ${errmsg} |
---|
707 | echo " python failed!!" |
---|
708 | echo python ${pyHOME}/drawing.py -o draw_WindRose -S "'"${values}"'" -v ua,va -f ${filen} |
---|
709 | exit |
---|
710 | fi |
---|
711 | convert -trim WindRose.png ${ofign} |
---|
712 | echo "* "${ofign} >> ${ofilefigs} |
---|
713 | echo python ${pyHOME}/drawing.py -o draw_WindRose -S "'"${values}"'" -v ua,va -f "'"${filen}"'" >> ${ofilefigs} |
---|
714 | echo " " >> ${ofilefigs} |
---|
715 | fi |
---|
716 | } |
---|
717 | |
---|
718 | function SkewT_logP_plot() { |
---|
719 | # Function to plot a SkewT_logP plot |
---|
720 | # it: time step to use from file |
---|
721 | # sndstid: id of the sounding station |
---|
722 | # sndstn: name of the sounding station to appear in plot ('!' for spaces) |
---|
723 | # timeS: String with the format of the actual time ('!' for spaces) |
---|
724 | # ofigdir: folder for the output of the figure |
---|
725 | # timefS: date of the plot to be used for the figure name |
---|
726 | # filen: file to use |
---|
727 | # figheader: header of the figure's file name |
---|
728 | |
---|
729 | valuesfig=$1 |
---|
730 | |
---|
731 | it=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` |
---|
732 | sndstid=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` |
---|
733 | sndstn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` |
---|
734 | timeS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` |
---|
735 | ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` |
---|
736 | timefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` |
---|
737 | filen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` |
---|
738 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` |
---|
739 | |
---|
740 | values='time|'${it}',pres|-1:auto:auto:'${sndstn}'!sounding!on!'${timeS}'!local!' |
---|
741 | values=${values}'time:'${kfig}':True' |
---|
742 | ofign=${ofigdir}'/'${figheader}'_'${sndstid}'_'${timefS}'.'${kfig} |
---|
743 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
744 | if test ! -f ${ofign}; then |
---|
745 | echo " Sounding on: "$(echo ${timeS} | tr '!' ' ') |
---|
746 | python ${pyHOME}/drawing.py -o draw_SkewT -S ${values} -v ta,tda,pres -f ${filen} >& /dev/null |
---|
747 | if test $? -ne 0; then |
---|
748 | echo ${errmsg} |
---|
749 | echo " python failed!!" |
---|
750 | echo python ${pyHOME}/drawing.py -o draw_SkewT -S "'"${values}"'" -v ta,tda,pres -f ${filen} |
---|
751 | exit |
---|
752 | fi |
---|
753 | convert -trim SkewT.png ${ofign} |
---|
754 | echo "* "${ofign} >> ${ofilefigs} |
---|
755 | echo python ${pyHOME}/drawing.py -o draw_SkewT -S "'"${values}"'" -v ta,tda,pres -f "'"${filen}"'" >> ${ofilefigs} |
---|
756 | echo " " >> ${ofilefigs} |
---|
757 | fi |
---|
758 | } |
---|
759 | |
---|
760 | function multi_soundings_plot() { |
---|
761 | # Function to plot a multi_sounding figure |
---|
762 | # sndstid: id of the sounding station |
---|
763 | # sndstn: name of the sounding station to appear in plot ('!' for spaces) |
---|
764 | # tatda_evol_labs: labels for the figure |
---|
765 | # tatda_evol_cols: colors of the lines for the figure |
---|
766 | # timeS3: date in the figure |
---|
767 | # ofigdir: folder for the output figure |
---|
768 | # figheader: header of the figure's file name |
---|
769 | |
---|
770 | valuesfig=$1 |
---|
771 | |
---|
772 | sndstid=`echo ${valuesfig} | tr '@' ' ' | awk '{print $1}'` |
---|
773 | sndstn=`echo ${valuesfig} | tr '@' ' ' | awk '{print $2}'` |
---|
774 | tatda_evol_labs=`echo ${valuesfig} | tr '@' ' ' | awk '{print $3}'` |
---|
775 | tatda_evol_cols=`echo ${valuesfig} | tr '@' ' ' | awk '{print $4}'` |
---|
776 | tatda_evol_files=`echo ${valuesfig} | tr '@' ' ' | awk '{print $5}'` |
---|
777 | timeS3=`echo ${valuesfig} | tr '@' ' ' | awk '{print $6}'` |
---|
778 | ofigdir=`echo ${valuesfig} | tr '@' ' ' | awk '{print $7}'` |
---|
779 | figheader=`echo ${valuesfig} | tr '@' ' ' | awk '{print $8}'` |
---|
780 | |
---|
781 | tatda_evol_values='auto:auto:multilines!'${tatda_evol_labs}'!'${tatda_evol_cols}'!' |
---|
782 | tatda_evol_values=${tatda_evol_values}'-!,!2:0,auto:'${sndstn}'!sounding!evolution!on!' |
---|
783 | tatda_evol_values=${tatda_evol_values}${timeS3}'!local!time:'${kfig}':True' |
---|
784 | |
---|
785 | ofign=${ofigdir}'/'${figheader}'_'${stid}'.'${kfig} |
---|
786 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
787 | if test ! -f ${ofign}; then |
---|
788 | echo " Sounding on: "$(echo ${timeS} | tr '!' ' ') |
---|
789 | python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${tatda_evol_values} -f ${tatda_evol_files} >& /dev/null |
---|
790 | if test $? -ne 0; then |
---|
791 | echo ${errmsg} |
---|
792 | echo " python failed!!" |
---|
793 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${tatda_evol_values}"'" -f "'"${tatda_evol_files}"'" |
---|
794 | exit |
---|
795 | fi |
---|
796 | convert -trim multi_SkewT.png ${ofign} |
---|
797 | echo "* "${ofign} >> ${ofilefigs} |
---|
798 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${tatda_evol_values}"'" -f "'"${tatda_evol_files}"'" >> ${ofilefigs} |
---|
799 | echo " " >> ${ofilefigs} |
---|
800 | fi |
---|
801 | } |
---|
802 | |
---|
803 | function multi_SkewT_logP_plot() { |
---|
804 | # Function to plot a multi_SkewT_logP plot with multiple lines |
---|
805 | # sndstid: id of the sounding station |
---|
806 | # sndstn: name of the sounding station to appear in plot ('!' for spaces) |
---|
807 | # complabs: labels for the plot |
---|
808 | # compcols: colors for the plot |
---|
809 | # complines: type of lines for the plot |
---|
810 | # compfiles: files to use for the plot |
---|
811 | # dateS: String with the format of the actual time ('!' for spaces) |
---|
812 | # ofigdir: folder for the output of the figure |
---|
813 | # datefS: date of the plot to be used for the figure name |
---|
814 | # figheader: header of the figure's file name |
---|
815 | |
---|
816 | valuesfig=$1 |
---|
817 | sndstid=`echo ${valuesfig} | tr '@' ' ' | awk '{print $1}'` |
---|
818 | sndstn=`echo ${valuesfig} | tr '@' ' ' | awk '{print $2}'` |
---|
819 | complabs=`echo ${valuesfig} | tr '@' ' ' | awk '{print $3}'` |
---|
820 | compcols=`echo ${valuesfig} | tr '@' ' ' | awk '{print $4}'` |
---|
821 | complines=`echo ${valuesfig} | tr '@' ' ' | awk '{print $5}'` |
---|
822 | compfiles=`echo ${valuesfig} | tr '@' ' ' | awk '{print $6}'` |
---|
823 | dateS=`echo ${valuesfig} | tr '@' ' ' | awk '{print $7}'` |
---|
824 | ofigdir=`echo ${valuesfig} | tr '@' ' ' | awk '{print $8}'` |
---|
825 | datefS=`echo ${valuesfig} | tr '@' ' ' | awk '{print $9}'` |
---|
826 | figheader=`echo ${valuesfig} | tr '@' ' ' | awk '{print $10}'` |
---|
827 | |
---|
828 | values='auto:auto:multilines!'${complabs}'!'${compcols}'!' |
---|
829 | values=${values}${complines}'!,!2:0,auto:'${ststn}'!sounding!obs!,!sim!' |
---|
830 | values=${values}'comparison!on!'${dateS}'!UTC:png:True' |
---|
831 | |
---|
832 | ofign=${ofigdir}'/'${figheader}'_'${sndstid}'_'${datefS}'.'${kfig} |
---|
833 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
834 | if test ! -f ${ofign}; then |
---|
835 | echo " Sounding on: "$(echo ${dateS} | tr '!' ' ') |
---|
836 | python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${values} -f ${compfiles} >& /dev/null |
---|
837 | if test $? -ne 0; then |
---|
838 | echo ${errmsg} |
---|
839 | echo " python failed!!" |
---|
840 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${values}"'" -f "'"${compfiles}"'" |
---|
841 | exit |
---|
842 | fi |
---|
843 | convert -trim multi_SkewT.png ${ofign} |
---|
844 | echo "* "${ofign} >> ${ofilefigs} |
---|
845 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${values}"'" -f "'"${compfiles}"'" >> ${ofilefigs} |
---|
846 | echo " " >> ${ofilefigs} |
---|
847 | fi |
---|
848 | } |
---|
849 | |
---|
850 | function Hovmoeller_SkewT_map_plot() { |
---|
851 | # Function to plot a Hovmoeller SkewT_map |
---|
852 | # sndstid: id of the sounding station |
---|
853 | # sndstn: name of the sounding station to appear in plot ('!' for spaces) |
---|
854 | # sndv: variable to plot |
---|
855 | # ofigdir: folder for the output of the figure |
---|
856 | # datefS: date of the plot to be used for the figure name |
---|
857 | # timevals: values to use for the time-axis in the plot |
---|
858 | # simfilen: name of the simulation file at the given point |
---|
859 | # sndfilen: name of the sounding file |
---|
860 | # expl: label of the experiment |
---|
861 | # expn: name of the experiment |
---|
862 | # cbar: color bar |
---|
863 | # figheader: header of the figure's file name |
---|
864 | |
---|
865 | valuesfig=$1 |
---|
866 | sndstid=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` |
---|
867 | sndstn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` |
---|
868 | sndv=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` |
---|
869 | ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` |
---|
870 | datefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` |
---|
871 | timevals=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` |
---|
872 | simfilen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` |
---|
873 | sndfilen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` |
---|
874 | expl=`echo ${valuesfig} | tr '#' ' ' | awk '{print $9}'` |
---|
875 | expn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $10}'` |
---|
876 | cbar=`echo ${valuesfig} | tr '#' ' ' | awk '{print $11}'` |
---|
877 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $12}'` |
---|
878 | |
---|
879 | cfiles=${simfilen}';'${sndv}';time;pres;time|-1,pres|-1@' |
---|
880 | cfiles=${cfiles}${sndfilen}';'${sndv}';time;pres;time|-1,pres|-1' |
---|
881 | cvalues=${sndv}';y;auto|'${timevals}';Vfix,auto,50.,auto' |
---|
882 | cvalues=${cvalues}';'${cbar}',auto,auto;Srange,Srange;auto;obs!,!'${expn}'!' |
---|
883 | cvalues=${cvalues}${sndstn}'!sounding;'${kfig}';flip@y;None;yes' |
---|
884 | |
---|
885 | ofign=${ofigdir}'/'${figheader}'_'${expl}'_'${sndstid}'_'${sndv}'.'${kfig} |
---|
886 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
887 | if test ! -f ${ofign}; then |
---|
888 | echo " Sounding comparison on : "${sndstid}" by "${expl} |
---|
889 | python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f ${cfiles} -S ${cvalues} |
---|
890 | if test $? -ne 0; then |
---|
891 | echo ${errmsg} |
---|
892 | echo " python failed!!" |
---|
893 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f "'"${cfiles}"'" -S "'"${cvalues}"'" |
---|
894 | exit |
---|
895 | fi |
---|
896 | convert -trim 2Dshad_obs-sim_comparison_time.png ${ofign} |
---|
897 | echo "* "${ofign} >> ${ofilefigs} |
---|
898 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f "'"${cfiles}"'" -S "'"${cvalues}"'" >> ${ofilefigs} |
---|
899 | echo " " >> ${ofilefigs} |
---|
900 | fi |
---|
901 | } |
---|
902 | |
---|
903 | function multiple_time_series_plot(){ |
---|
904 | # Function to plot multiple time-series |
---|
905 | # sti: id of the surface station |
---|
906 | # stn: name of the surface station to appear in plot ('!' for spaces) |
---|
907 | # sfcv: name of variable to plot |
---|
908 | # ofigdir: folder for the output of the figure |
---|
909 | # timevals: values of the time-axis to use |
---|
910 | # files: files to use |
---|
911 | # labs: labels of the legend |
---|
912 | # lcol: color of lines to use |
---|
913 | # nsfc: minimum value to plot |
---|
914 | # xsfc: maximum value to plot |
---|
915 | # figheader: header of the figure's file name |
---|
916 | |
---|
917 | valuesfig=$1 |
---|
918 | stid=`echo ${valuesfig} | tr '@' ' ' | awk '{print $1}'` |
---|
919 | stn=`echo ${valuesfig} | tr '@' ' ' | awk '{print $2}'` |
---|
920 | sfcv=`echo ${valuesfig} | tr '@' ' ' | awk '{print $3}'` |
---|
921 | ofigdir=`echo ${valuesfig} | tr '@' ' ' | awk '{print $4}'` |
---|
922 | timevals=`echo ${valuesfig} | tr '@' ' ' | awk '{print $5}'` |
---|
923 | files=`echo ${valuesfig} | tr '@' ' ' | awk '{print $6}'` |
---|
924 | labs=`echo ${valuesfig} | tr '@' ' ' | awk '{print $7}'` |
---|
925 | lcol=`echo ${valuesfig} | tr '@' ' ' | awk '{print $8}'` |
---|
926 | nsfc=`echo ${valuesfig} | tr '@' ' ' | awk '{print $9}'` |
---|
927 | xsfc=`echo ${valuesfig} | tr '@' ' ' | awk '{print $10}'` |
---|
928 | figheader=`echo ${valuesfig} | tr '@' ' ' | awk '{print $11}'` |
---|
929 | |
---|
930 | timen=`echo ${timevals} | tr '|' ' ' | awk '{print $3}'` |
---|
931 | fmtT=`echo ${timevals} | tr '|' ' ' | awk '{print $1"|"$2}'` |
---|
932 | |
---|
933 | values='ststimes,time;y;'${timen}';auto;'${labs}';'${sfcv}';'${sfcv} |
---|
934 | values=${values}'|evolution|at|'$(echo ${stn} | tr '!' '|')';'${nsfc}','${xsfc}';' |
---|
935 | values=${values}'time|'${fmtT}';0|12;' |
---|
936 | values=${values}${kfig}';-;'${lcol}';.;2.;2.;all;-1;True' |
---|
937 | |
---|
938 | ofign=${ofigdir}'/'${figheader}'_'${sfcv}_${sti}'.'${kfig} |
---|
939 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
940 | if test ! -f ${ofign}; then |
---|
941 | echo " Time-Series comparison on : "${sti}" for "${sfcv} |
---|
942 | python ${pyHOME}/drawing.py -o draw_lines_time -f ${files} -S ${values} -v ${sfcv} |
---|
943 | if test $? -ne 0; then |
---|
944 | echo ${errmsg} |
---|
945 | echo " python failed!!" |
---|
946 | echo python ${pyHOME}/drawing.py -o draw_lines_time -f "'"${files}"'" -S "'"${values}"'" -v ${sfcv} |
---|
947 | exit |
---|
948 | fi |
---|
949 | convert -trim lines_time.${kfig} ${ofign} |
---|
950 | echo "* "${ofign} >> ${ofilefigs} |
---|
951 | echo python ${pyHOME}/drawing.py -o draw_lines_time -f "'"${files}"'" -S "'"${values}"'" -v ${sfcv} >> ${ofilefigs} |
---|
952 | echo " "${ofign} >> ${ofilefigs} |
---|
953 | fi |
---|
954 | } |
---|
955 | |
---|
956 | function shad_contdisc_map_plot(){ |
---|
957 | # Function to plot a map of a continuos and a discontinuos variable |
---|
958 | # expl: label of the experiment |
---|
959 | # expn: name of the experiment in the title of the plot |
---|
960 | # sfcv: name of variable to plot |
---|
961 | # ofigdir: folder for the output of the figure |
---|
962 | # obsfiles: observtional file to use |
---|
963 | # simfile: simulation file to use |
---|
964 | # it: time-step from simulation |
---|
965 | # oit: time-step from observations |
---|
966 | # timeS: format of time to appear in the title |
---|
967 | # timefS: format of time to be used for the file name |
---|
968 | # nsfc: minimum value to plot |
---|
969 | # xsfc: maximum value to plot |
---|
970 | # mapv: map values |
---|
971 | # mapcover: cover of the map |
---|
972 | # figheader: header of the figure's file name |
---|
973 | |
---|
974 | valuesfig=$1 |
---|
975 | |
---|
976 | expl=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` |
---|
977 | expn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` |
---|
978 | sfcv=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` |
---|
979 | ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` |
---|
980 | obsfile=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` |
---|
981 | simfile=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` |
---|
982 | it=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` |
---|
983 | oit=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` |
---|
984 | timeS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $9}'` |
---|
985 | timefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $10}'` |
---|
986 | nsfc=`echo ${valuesfig} | tr '#' ' ' | awk '{print $11}'` |
---|
987 | xsfc=`echo ${valuesfig} | tr '#' ' ' | awk '{print $12}'` |
---|
988 | mapv=`echo ${valuesfig} | tr '#' ' ' | awk '{print $13}'` |
---|
989 | mapcover=`echo ${valuesfig} | tr '#' ' ' | awk '{print $14}'` |
---|
990 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $15}'` |
---|
991 | |
---|
992 | CFvarvals=`python $pyHOME/generic.py -o variables_values -S ${sfcv}` |
---|
993 | cbar=`echo ${CFvarvals} | tr ':' ' ' | awk '{print $7}'` |
---|
994 | |
---|
995 | cfiles=${simfile}';'${sfcv}';XLONG;XLAT;Time|'${it}',time|'${it}',' |
---|
996 | cfiles=${cfiles}'west_east|-1,south_north|-1@'${obsfile}';'${sfcv} |
---|
997 | cfiles=${cfiles}';stslon;stslat;time|'${oit}',lon|-1,lat|-1' |
---|
998 | cvalues=${sfcv}':west_east,south_north:auto:'${cbar}',auto,auto:'${nsfc}',' |
---|
999 | cvalues=${cvalues}${xsfc}':''auto:obs!,!'${expn}'!'${sfcv}'!on!'${timeS}'!UTC:' |
---|
1000 | cvalues=${cvalues}${kfig}':None:'${mapv}':'${mapcover}':yes' |
---|
1001 | |
---|
1002 | ofign=${ofigdir}'/'${figheader}'_'${timefS}'_'${sfcv}'_'${expl}'.'${kfig} |
---|
1003 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
1004 | if test ! -f ${ofign}; then |
---|
1005 | echo " Map comparison on : "$(echo ${timeS} | tr '!' ' ')" by "${expl}" for "${sfcv} |
---|
1006 | python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f ${cfiles} -S ${cvalues} |
---|
1007 | if test $? -ne 0; then |
---|
1008 | echo ${errmsg} |
---|
1009 | echo " python failed!!" |
---|
1010 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f "'"${cfiles}"'" -S "'"${cvalues}"'" |
---|
1011 | fi |
---|
1012 | convert -trim 2Dshad_obs-sim_comparison.png ${ofign} |
---|
1013 | echo "* "${ofign} >> ${ofilefigs} |
---|
1014 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f "'"${cfiles}"'" -S "'"${cvalues}"'" >> ${ofilefigs} |
---|
1015 | echo " " >> ${ofilefigs} |
---|
1016 | fi |
---|
1017 | } |
---|
1018 | |
---|
1019 | function multi_WindRose_plot(){ |
---|
1020 | # Function to plot a WindRose with data from multiple soundings |
---|
1021 | # sti: id of the sounding station |
---|
1022 | # stn: name of the sounding station to appear in plot ('!' for spaces) |
---|
1023 | # ofigdir: folder for the output of the figure |
---|
1024 | # files: files to use |
---|
1025 | # labs: labels of the legend |
---|
1026 | # lmark: marker of lines to use |
---|
1027 | # timeS: time of the plot as it should appear in the figure ('!' for spaces) |
---|
1028 | # timefS: time of the plot as it should appear in the figure's file |
---|
1029 | # figheader: header of the figure's file name |
---|
1030 | |
---|
1031 | valuesfig=$1 |
---|
1032 | |
---|
1033 | stid=`echo ${valuesfig} | tr '%' ' ' | awk '{print $1}'` |
---|
1034 | stn=`echo ${valuesfig} | tr '%' ' ' | awk '{print $2}'` |
---|
1035 | ofigdir=`echo ${valuesfig} | tr '%' ' ' | awk '{print $3}'` |
---|
1036 | files=`echo ${valuesfig} | tr '%' ' ' | awk '{print $4}'` |
---|
1037 | labs=`echo ${valuesfig} | tr '%' ' ' | awk '{print $5}'` |
---|
1038 | lmark=`echo ${valuesfig} | tr '%' ' ' | awk '{print $6}'` |
---|
1039 | timeS=`echo ${valuesfig} | tr '%' ' ' | awk '{print $7}'` |
---|
1040 | timefS=`echo ${valuesfig} | tr '%' ' ' | awk '{print $8}'` |
---|
1041 | figheader=`echo ${valuesfig} | tr '%' ' ' | awk '{print $9}'` |
---|
1042 | |
---|
1043 | Nfiles=`echo ${labs} | tr ',' ' ' | wc -w | awk '{print $1-1}'` |
---|
1044 | frqm='1' |
---|
1045 | iff=1 |
---|
1046 | while test ${iff} -le ${Nfiles}; do frqm=${frqm}'@10'; iff=`expr ${iff} + 1`; done |
---|
1047 | |
---|
1048 | values='linepoint;multicol;pres;-;'${lmark}';'${frqm}';spectral;auto:'${labs}':' |
---|
1049 | values=${values}'WindRose!obs!,!sim!comparison!at!'${stid}'!on!'${timeS}'!UTC:' |
---|
1050 | values=${values}${kfig}':auto:''True' |
---|
1051 | |
---|
1052 | ofign=${ofigdir}'/'${figheader}'_'${stid}'_'${timefS}'.'${kfig} |
---|
1053 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
1054 | if test ! -f ${ofign}; then |
---|
1055 | echo " WindRose comparison at: "${stid}" on "$(echo ${timeS} | tr '!' ' ') |
---|
1056 | python ${pyHOME}/drawing.py -o draw_multiWindRose -f ${files} -S ${values} |
---|
1057 | if test $? -ne 0; then |
---|
1058 | echo ${errmsg} |
---|
1059 | echo " python failed!!" |
---|
1060 | echo python ${pyHOME}/drawing.py -o draw_multiWindRose -f "'"${files}"'" \ |
---|
1061 | -S "'"${values}"'" |
---|
1062 | exit |
---|
1063 | fi |
---|
1064 | convert -trim multi_WindRose.${kfig} ${ofign} |
---|
1065 | echo "* "${ofign} >> ${ofilefigs} |
---|
1066 | echo python ${pyHOME}/drawing.py -o draw_multiWindRose -f "'"${files}"'" \ |
---|
1067 | -S "'"${values}"'" >> ${ofilefigs} |
---|
1068 | echo " " >> ${ofilefigs} |
---|
1069 | fi |
---|
1070 | } |
---|
1071 | |
---|
1072 | ####### ####### |
---|
1073 | ## MAIN |
---|
1074 | ####### |
---|
1075 | |
---|
1076 | mkdir -p ${odir} |
---|
1077 | ofileins=${wdir}/allins_functions.inf |
---|
1078 | ofilefigs=${wdir}/allins_figures.inf |
---|
1079 | if ${fscratch}; then |
---|
1080 | echo "*** Instruction from all functions _______" > ${ofileins} |
---|
1081 | echo " " >> ${ofileins} |
---|
1082 | fi |
---|
1083 | if ${gscratch}; then |
---|
1084 | echo "*** Instruction from all figures _______" > ${ofilefigs} |
---|
1085 | echo " " >> ${ofilefigs} |
---|
1086 | fi |
---|
1087 | |
---|
1088 | # Files in sounding folder (from UWyoming_netcdf.py) |
---|
1089 | if test ! ${sndHf} = 'None'; then |
---|
1090 | sndfs=`ls -1 ${snddir}/${sndHf}* | tr '\n' ':'` |
---|
1091 | echo "Soundings files _______" |
---|
1092 | echo ${sndfs} | tr ':' '\n' |
---|
1093 | sndfiles=`echo ${sndfs} | tr ':' ' '` |
---|
1094 | else |
---|
1095 | sndfiles='None' |
---|
1096 | fi |
---|
1097 | |
---|
1098 | # Files in sounding folder (from UWyoming_netcdf.py) |
---|
1099 | if test ! ${sfcHf} = 'None'; then |
---|
1100 | sfcfs=`ls -1 ${sfcdir}/${sfcHf}** | tr '\n' ':'` |
---|
1101 | echo "Surface files _______" |
---|
1102 | echo ${sfcfs} | tr ':' '\n' |
---|
1103 | sfcfiles=`echo ${sfcfs} | tr ':' ' '` |
---|
1104 | else |
---|
1105 | sfcfiles='None' |
---|
1106 | fi |
---|
1107 | |
---|
1108 | exps=`echo ${sims} | tr ':' ' '` |
---|
1109 | simH=`echo ${simHMT} | tr ',' ' ' | awk '{print $1}'` |
---|
1110 | simM=`echo ${simHMT} | tr ',' ' ' | awk '{print $2}'` |
---|
1111 | simT=`echo ${simHMT} | tr ',' ' ' | awk '{print $3}'` |
---|
1112 | |
---|
1113 | ### |
---|
1114 | ## Preparing simulations |
---|
1115 | ### |
---|
1116 | |
---|
1117 | # sounding data |
---|
1118 | iost=1 |
---|
1119 | obstype='sounding' |
---|
1120 | prn='snd' |
---|
1121 | if test ! ${sndHf} = 'None'; then |
---|
1122 | listfiles=${sndfiles} |
---|
1123 | else |
---|
1124 | listfiles=' ' |
---|
1125 | fi |
---|
1126 | wrfdiags=${wrfsnddiags} |
---|
1127 | simdiagd=${simsnddiagd} |
---|
1128 | for ostf in ${listfiles}; do |
---|
1129 | stid=`python $pyHOME/nc_var.py -o grattr -f ${ostf} -S Station_number` |
---|
1130 | ostlon=`ncdump -h ${ostf} | grep Station_longitude | awk '{print $3}'` |
---|
1131 | ostlat=`ncdump -h ${ostf} | grep Station_latitude | awk '{print $3}'` |
---|
1132 | ostheight=`ncdump -h ${ostf} | grep Station_elevation | awk '{print $3}'` |
---|
1133 | |
---|
1134 | if test ${iost} -eq 1; then |
---|
1135 | oststids=${stid}'@'${ostf} |
---|
1136 | echo ${prn}","${stid}","${ostlon}","${ostlat}","${ostheight} > ${wdir}/stations.inf |
---|
1137 | else |
---|
1138 | oststids=${oststids}':'${stid}'@'${ostf} |
---|
1139 | echo ${prn}","${stid}","${ostlon}","${ostlat}","${ostheight} >> ${wdir}/stations.inf |
---|
1140 | fi |
---|
1141 | |
---|
1142 | iexp=1 |
---|
1143 | for exp in ${exps}; do |
---|
1144 | expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'` |
---|
1145 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
1146 | expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` |
---|
1147 | expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` |
---|
1148 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
1149 | |
---|
1150 | simfiles=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT}` |
---|
1151 | |
---|
1152 | ofile=${odir}/simout_${prn}vars_${stid}_${expl}.nc |
---|
1153 | if ${fscratch}; then rm ${ofile} >& /dev/null; fi |
---|
1154 | if test ! -f ${ofile}; then |
---|
1155 | for simf in ${simfiles}; do |
---|
1156 | simfn=`basename ${simf}` |
---|
1157 | fdate=`echo ${simfn} | tr '.' ' ' | awk '{print $1}' | tr '_' ' ' | \ |
---|
1158 | awk '{print $3"_"$4}'` |
---|
1159 | |
---|
1160 | simsndptf=${odir}'/simout_vars_'${prn}'pt_'${stid}'_'${expl}'_'${fdate}'.nc' |
---|
1161 | simsnddiagsf=${odir}'/simout_'${prn}'diags_'${stid}'_'${expl}'_'${fdate}'.nc' |
---|
1162 | |
---|
1163 | fvals=${ostlon}'#'${ostlat}'#'${simf}'#XLONG#XLAT#'${wrfdiags}'#' |
---|
1164 | fvals=${fvals}${simdiagd} |
---|
1165 | get_WRFsounding_data ${fvals} |
---|
1166 | |
---|
1167 | # end of files |
---|
1168 | done |
---|
1169 | |
---|
1170 | # Concatenating files |
---|
1171 | Nconfc=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc | wc -l | \ |
---|
1172 | awk '{print $1}'` |
---|
1173 | if test ${Nconfc} -gt 1; then |
---|
1174 | values=${odir}',Time,time' |
---|
1175 | HMT='simout_'${prn}'diags_,'${stid}'_'${expn},'nc' |
---|
1176 | python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \ |
---|
1177 | -f ${HMT} -v all |
---|
1178 | if test $? -ne 0; then |
---|
1179 | echo ${errmsg} |
---|
1180 | echo " python failed!!" |
---|
1181 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}\ |
---|
1182 | -f ${HMT} -v all |
---|
1183 | exit |
---|
1184 | fi |
---|
1185 | echo " * Concatenating "${obstype}" data at point: "${ostlon}", "${ostlat} >> ${ofileins} |
---|
1186 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S \ |
---|
1187 | "'"${values}"'" -f ${HMT} -v all >> ${ofileins} |
---|
1188 | echo " " >> ${ofileins} |
---|
1189 | mv netcdf_fold_concatenated_HMT.nc ${ofile} |
---|
1190 | else |
---|
1191 | ffilen=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc` |
---|
1192 | cp ${ffilen} ${ofile} |
---|
1193 | fi |
---|
1194 | fi |
---|
1195 | iexp=`expr ${iexp} + 1` |
---|
1196 | # end of experiments |
---|
1197 | done |
---|
1198 | |
---|
1199 | iost=`expr ${iost} + 1` |
---|
1200 | done |
---|
1201 | if test ! ${sndHf} = 'None'; then sndstids=${oststids}; fi |
---|
1202 | |
---|
1203 | # surface data at station |
---|
1204 | iost=1 |
---|
1205 | obstype='surface' |
---|
1206 | prn='sfc' |
---|
1207 | if test ! ${sfcHf} = 'None'; then |
---|
1208 | listfiles=${sndfiles} |
---|
1209 | else |
---|
1210 | listfiles=' ' |
---|
1211 | fi |
---|
1212 | wrfdiags=${wrfsfcdiags} |
---|
1213 | simdiagd=${simsfcdiagd} |
---|
1214 | for ostf in ${listfiles}; do |
---|
1215 | stid=`python $pyHOME/nc_var.py -o varout -f ${ostf} -S 'time:0' -v id | grep NC \ |
---|
1216 | | awk '{printf("%d",$2)}'` |
---|
1217 | ostlon=`python $pyHOME/nc_var.py -o varout -f ${ostf} -S 'time:0' -v lon | grep NC \ |
---|
1218 | | awk '{print $2}'` |
---|
1219 | ostlat=`python $pyHOME/nc_var.py -o varout -f ${ostf} -S 'time:0' -v lat | grep NC \ |
---|
1220 | | awk '{print $2}'` |
---|
1221 | ostheight=`python $pyHOME/nc_var.py -o varout -f ${ostf} -S 'time:0' -v height | \ |
---|
1222 | grep NC | awk '{print $2}'` |
---|
1223 | |
---|
1224 | if test ! ${wdir}/stations.inf; then |
---|
1225 | oststids=${stid}'@'${ostf} |
---|
1226 | echo ${prn}","${stid}","${ostlon}","${ostlat}","${ostheight} > ${wdir}/stations.inf |
---|
1227 | else |
---|
1228 | oststids=${oststids}':'${stid}'@'${ostf} |
---|
1229 | echo ${prn}","${stid}","${ostlon}","${ostlat}","${ostheight} >> ${wdir}/stations.inf |
---|
1230 | fi |
---|
1231 | |
---|
1232 | iexp=1 |
---|
1233 | for exp in ${exps}; do |
---|
1234 | expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'` |
---|
1235 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
1236 | expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` |
---|
1237 | expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` |
---|
1238 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
1239 | |
---|
1240 | simfiles=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT}` |
---|
1241 | |
---|
1242 | for simf in ${simfiles}; do |
---|
1243 | simfn=`basename ${simf}` |
---|
1244 | fdate=`echo ${simfn} | tr '.' ' ' | awk '{print $1}' | tr '_' ' ' | \ |
---|
1245 | awk '{print $3"_"$4}'` |
---|
1246 | |
---|
1247 | simsfcptf=${odir}'/simout_vars_'${prn}'pt_'${stid}'_'${expl}'_'${fdate}'.nc' |
---|
1248 | simsfcdiagsf=${odir}'/simout_'${prn}'diags_'${stid}'_'${expl}'_'${fdate}'.nc' |
---|
1249 | |
---|
1250 | fvals=${ostlon}'#'${ostlat}'#'${simf}'#XLONG#XLAT#'${wrfdiags}'#' |
---|
1251 | fvals=${fvals}${wrfsfcnondiags}'#'${simdiagd} |
---|
1252 | get_WRFsurface_data ${fvals} |
---|
1253 | |
---|
1254 | # end of files |
---|
1255 | done |
---|
1256 | |
---|
1257 | # Concatenating files |
---|
1258 | ofile=${odir}/simout_${prn}vars_${stid}_${expl}.nc |
---|
1259 | if ${fscratch}; then rm ${ofile} >& /dev/null; fi |
---|
1260 | if test ! -f ${ofile}; then |
---|
1261 | Nconfc=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc | wc -l | awk '{print $1}'` |
---|
1262 | if test ${Nconfc} -gt 1; then |
---|
1263 | values=${odir}',Time,time' |
---|
1264 | HMT='simout_'${prn}'diags_,'${stid}'_'${expn},'nc' |
---|
1265 | python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \ |
---|
1266 | -f ${HMT} -v all |
---|
1267 | if test $? -ne 0; then |
---|
1268 | echo ${errmsg} |
---|
1269 | echo " python failed!!" |
---|
1270 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}\ |
---|
1271 | -f ${HMT} -v all |
---|
1272 | exit |
---|
1273 | fi |
---|
1274 | echo " * Concatenating "${obstype}" data at point: "${ostlon}", "${ostlat} >> ${ofileins} |
---|
1275 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S \ |
---|
1276 | "'"${values}"'" -f ${HMT} -v all >> ${ofileins} |
---|
1277 | echo " " >> ${ofileins} |
---|
1278 | mv netcdf_fold_concatenated_HMT.nc ${ofile} |
---|
1279 | else |
---|
1280 | ffilen=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc` |
---|
1281 | cp ${ffilen} ${ofile} |
---|
1282 | fi |
---|
1283 | fi |
---|
1284 | iexp=`expr ${iexp} + 1` |
---|
1285 | # end of experiments |
---|
1286 | done |
---|
1287 | |
---|
1288 | iost=`expr ${iost} + 1` |
---|
1289 | done |
---|
1290 | if test ! ${sfcHf} = 'None'; then sfcstids=${oststids}; fi |
---|
1291 | |
---|
1292 | # surface data for maps |
---|
1293 | iost=1 |
---|
1294 | obstype='surface_map' |
---|
1295 | prn='sfc' |
---|
1296 | listfiles=${sfcfiles} |
---|
1297 | wrfdiags=${wrfsfcdiags} |
---|
1298 | simdiagd=${simsfcmapdiagd} |
---|
1299 | iexp=1 |
---|
1300 | for exp in ${exps}; do |
---|
1301 | expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'` |
---|
1302 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
1303 | expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` |
---|
1304 | expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` |
---|
1305 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
1306 | |
---|
1307 | simfiles=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT}` |
---|
1308 | |
---|
1309 | for simf in ${simfiles}; do |
---|
1310 | simfn=`basename ${simf}` |
---|
1311 | fdate=`echo ${simfn} | tr '.' ' ' | awk '{print $1}' | tr '_' ' ' | \ |
---|
1312 | awk '{print $3"_"$4}'` |
---|
1313 | |
---|
1314 | simsfcmapf=${odir}'/simout_vars_'${prn}'map_'${expl}'_'${fdate}'.nc' |
---|
1315 | simsfcmapdiagsf=${odir}'/simout_'${prn}'mapdiags_'${expl}'_'${fdate}'.nc' |
---|
1316 | |
---|
1317 | fvals=${simf}'#'${wrfdiags}'#'${wrfsfcnondiags}'#'${simdiagd} |
---|
1318 | get_WRFsfc2D_data ${fvals} |
---|
1319 | |
---|
1320 | # end of files |
---|
1321 | done |
---|
1322 | |
---|
1323 | # Concatenating files |
---|
1324 | ofile=${odir}/simout_${prn}mapvars_${expl}.nc |
---|
1325 | if ${fscratch}; then rm ${ofile} >& /dev/null; fi |
---|
1326 | if test ! -f ${ofile}; then |
---|
1327 | Nconfc=`ls -1 ${odir}/simout_${prn}mapdiags_*${expl}*.nc | wc -l | awk '{print $1}'` |
---|
1328 | if test ${Nconfc} -gt 1; then |
---|
1329 | values=${odir}',Time,time' |
---|
1330 | HMT='simout_'${prn}'mapdiags_,'${expn},'nc' |
---|
1331 | python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \ |
---|
1332 | -f ${HMT} -v all |
---|
1333 | if test $? -ne 0; then |
---|
1334 | echo ${errmsg} |
---|
1335 | echo " python failed!!" |
---|
1336 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}\ |
---|
1337 | -f ${HMT} -v all |
---|
1338 | exit |
---|
1339 | fi |
---|
1340 | echo " * Concatenating "${obstype}" data: " >> ${ofileins} |
---|
1341 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S \ |
---|
1342 | "'"${values}"'" -f ${HMT} -v all >> ${ofileins} |
---|
1343 | echo " " >> ${ofileins} |
---|
1344 | mv netcdf_fold_concatenated_HMT.nc ${ofile} |
---|
1345 | else |
---|
1346 | ffilen=`ls -1 ${odir}/simout_${prn}mapdiags_*${expl}*.nc` |
---|
1347 | cp ${ffilen} ${ofile} |
---|
1348 | fi |
---|
1349 | fi |
---|
1350 | iexp=`expr ${iexp} + 1` |
---|
1351 | # end of experiments |
---|
1352 | done |
---|
1353 | |
---|
1354 | ### |
---|
1355 | ## |
---|
1356 | # Figures |
---|
1357 | ## |
---|
1358 | ### |
---|
1359 | |
---|
1360 | mkdir -p ${ofigdir} |
---|
1361 | |
---|
1362 | ## |
---|
1363 | # Stations maps |
---|
1364 | ## |
---|
1365 | ofig=${ofigdir}/stations.png |
---|
1366 | if ${gscratch}; then rm ${ofig} >& /dev/null; fi |
---|
1367 | if test ! -f ${ofig}; then |
---|
1368 | fivals=${mapstchar}':'${mapv}':lonlatxtrms:'${figexperimentname}'!stations:' |
---|
1369 | fivals=${fivals}${kfig}':true' |
---|
1370 | python ${pyHOME}/drawing.py -o draw_stations_map -f ${wdir}/stations.inf \ |
---|
1371 | -S ${fivals} |
---|
1372 | if test $? -ne 0; then |
---|
1373 | echo ${errmsg} |
---|
1374 | echo " python failed!!" |
---|
1375 | echo python ${pyHOME}/drawing.py -o draw_stations_map -f ${wdir}/stations.inf \ |
---|
1376 | -S "'"${fivals}"'" |
---|
1377 | exit |
---|
1378 | fi |
---|
1379 | echo " * Map of the stations: " >> ${ofilefigs} |
---|
1380 | echo python ${pyHOME}/drawing.py -o draw_stations_map -f ${wdir}/stations.inf \ |
---|
1381 | -S "'"${fivals}"'" >> ${ofilefigs} |
---|
1382 | echo " " >> ${ofilefigs} |
---|
1383 | convert -trim stations_map.${kfig} ${ofig} |
---|
1384 | fi |
---|
1385 | |
---|
1386 | ### |
---|
1387 | ## Soundings figures |
---|
1388 | ### |
---|
1389 | |
---|
1390 | isnd=1 |
---|
1391 | for sndf in ${sndfiles}; do |
---|
1392 | stid=`python $pyHOME/nc_var.py -o grattr -f ${sndf} -S Station_number` |
---|
1393 | |
---|
1394 | # Getting wind components |
---|
1395 | ouavasndf=${odir}'/sounding_uava_'${stid}'.nc' |
---|
1396 | if ${fscratch}; then rm ${ouavasndf}; fi |
---|
1397 | if test ! -f ${ouavasndf}; then |
---|
1398 | python ${pyHOME}/diagnostics.py -f ${sndf} -d 'time@time,pres@pres' \ |
---|
1399 | -v 'uavaFROMobswswd|ws@wd' |
---|
1400 | if test $? -ne 0; then |
---|
1401 | echo ${errmsg} |
---|
1402 | echo " python failed!!" |
---|
1403 | echo python ${pyHOME}/diagnostics.py -f ${sndf} -d 'time@time,pres@pres' \ |
---|
1404 | -v 'uavaFROMobswswd|ws@wd' |
---|
1405 | exit |
---|
1406 | fi |
---|
1407 | echo " * Getting ua,va winds from station "${stid}": " >> ${ofileins} |
---|
1408 | echo python ${pyHOME}/diagnostics.py -f ${sndf} -d "'"time@time,pres@pres"'" \ |
---|
1409 | -v "'"uavaFROMobswswd|ws@wd"'" >> ${ofileins} |
---|
1410 | echo " " >> ${ofileins} |
---|
1411 | mv diagnostics.nc ${ouavasndf} |
---|
1412 | fi |
---|
1413 | done |
---|
1414 | |
---|
1415 | sndids=`echo ${sndstids} | tr ':' ' '` |
---|
1416 | |
---|
1417 | for stidf in ${sndids}; do |
---|
1418 | stid=`echo ${stidf} | tr '@' ' ' | awk '{print $1}'` |
---|
1419 | sndorigfn=`echo ${stidf} | tr '@' ' ' | awk '{print $2}'` |
---|
1420 | echo ${stid}" ..." |
---|
1421 | it=0 |
---|
1422 | tatda_evol_values='' |
---|
1423 | tatda_evol_files='' |
---|
1424 | sndtimes='' |
---|
1425 | snddates='' |
---|
1426 | sndFdates='' |
---|
1427 | snddimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime -f ${sndorigfn} -v time | \ |
---|
1428 | grep 'dimt:' | awk '{print $2-1}'` |
---|
1429 | |
---|
1430 | # Time characteristics |
---|
1431 | tunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${sndorigfn} | \ |
---|
1432 | grep -v allvattrs | grep units | awk '{print $3}'` |
---|
1433 | Tu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` |
---|
1434 | Dref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` |
---|
1435 | Dref=${Dref0:0:4}${Dref0:5:2}${Dref0:8:2} |
---|
1436 | |
---|
1437 | # Getting values for evolution plot |
---|
1438 | col=`echo ${icolta} | tr ':' ' ' | awk '{print $1}'` |
---|
1439 | col2=`echo ${icolta} | tr ':' ' ' | awk '{print $2}'` |
---|
1440 | while test ${it} -le ${snddimt}; do |
---|
1441 | timev=`python $pyHOME/nc_var.py -o varout -S time:${it} -f ${sndorigfn} -v time | \ |
---|
1442 | grep NC | awk '{printf ("%d", $2)}'` |
---|
1443 | timeS=`date +${figsndTfmt} -d"${Dref} ${timev} ${Tu}"` |
---|
1444 | timeS2=`date +%d"$^{"%H"}$" -d"${Dref} ${timev} ${Tu}"` |
---|
1445 | timeS3=`date +%Y"-"%b -d"${Dref} ${timev} ${Tu}"` |
---|
1446 | timeS4=`date +%Y -d"${Dref} ${timev} ${Tu}"` |
---|
1447 | echo " "${it}" "${timev}" "${Dref}" '"${timev}"' "${Tu}" "$(echo ${timeS} | tr '!' ' ') |
---|
1448 | timefS=`date +%Y%m%d%H%M%S -d"${Dref} ${timev} ${Tu}"` |
---|
1449 | |
---|
1450 | sndstn=`python $pyHOME/nc_var.py -o grattr -f ${sndorigfn} -S Station_name | \ |
---|
1451 | tr ' ' '!'` |
---|
1452 | |
---|
1453 | fivals=${it}'#'${stid}'#'${sndstn}'#'${timeS}'#'${ofigdir}'#'${timefS}'#' |
---|
1454 | fivals=${fivals}${ouavasndf}'#WindRose_obs' |
---|
1455 | WindRose_plot ${fivals} |
---|
1456 | |
---|
1457 | fivals=${it}'#'${stid}'#'${sndstn}'#'${timeS}'#'${ofigdir}'#'${timefS}'#' |
---|
1458 | fivals=${fivals}${sndorigfn}'#SkewT-logP_obs_ta-tda' |
---|
1459 | SkewT_logP_plot ${fivals} |
---|
1460 | |
---|
1461 | colH=`num_hex ${col}` |
---|
1462 | colH2=`num_hex ${col2}` |
---|
1463 | if test ${it} -eq 0; then |
---|
1464 | sndtimes=${timev} |
---|
1465 | snddates=${timeS} |
---|
1466 | sndFdates=${timefS} |
---|
1467 | tatda_evol_files=${sndorigfn}':pres|-1,time|'${it}':ta,pres;' |
---|
1468 | tatda_evol_files=${tatda_evol_files}${sndorigfn}':pres|-1,time|'${it}':tda,pres' |
---|
1469 | tatda_evol_labs='ta_'${timeS2}',tda' |
---|
1470 | tatda_evol_cols='#'${colH}${colH2}${colH2}',#'${colH2}${colH2}${colH} |
---|
1471 | else |
---|
1472 | sndtimes=${sndtimes}','${timev} |
---|
1473 | snddates=${snddates}','${timeS} |
---|
1474 | sndFdates=${sndFdates}','${timefS} |
---|
1475 | tatda_evol_files=${tatda_evol_files}';'${sndorigfn}':pres|-1,time|'${it}':ta,pres' |
---|
1476 | tatda_evol_files=${tatda_evol_files}';'${sndorigfn}':pres|-1,time|'${it}':tda,pres' |
---|
1477 | if test $(expr ${it} % 2) -eq 0; then |
---|
1478 | tatda_evol_labs=${tatda_evol_labs}','${timeS2}',None' |
---|
1479 | else |
---|
1480 | tatda_evol_labs=${tatda_evol_labs}',None,None' |
---|
1481 | fi |
---|
1482 | tatda_evol_cols=${tatda_evol_cols}',#'${colH}${colH2}${colH2}',#'${colH2}${colH2}${colH} |
---|
1483 | fi |
---|
1484 | col=`expr ${col} - ${ddcol}` |
---|
1485 | col2=`expr ${col2} - ${ddcol}` |
---|
1486 | |
---|
1487 | it=`expr ${it} + 1` |
---|
1488 | done |
---|
1489 | |
---|
1490 | fivals=${stid}'@'${sndstn}'@'${tatda_evol_labs}'@'${tatda_evol_cols}'@' |
---|
1491 | fivals=${fivals}${tatda_evol_files}'@'${timeS3}'@'${ofigdir}'@SkewT-logP_obs_evol' |
---|
1492 | multi_soundings_plot ${fivals} |
---|
1493 | |
---|
1494 | # End of soundings |
---|
1495 | done |
---|
1496 | |
---|
1497 | # snd-sims comparison |
---|
1498 | |
---|
1499 | for stidf in ${sndids}; do |
---|
1500 | stid=`echo ${stidf} | tr '@' ' ' | awk '{print $1}'` |
---|
1501 | sndorigfn=`echo ${stidf} | tr '@' ' ' | awk '{print $2}'` |
---|
1502 | echo "snd: "${stid} |
---|
1503 | |
---|
1504 | sndlon=`ncdump -h ${sndorigfn} | grep Station_longitude | awk '{print $3}'` |
---|
1505 | sndlat=`ncdump -h ${sndorigfn} | grep Station_latitude | awk '{print $3}'` |
---|
1506 | sndts=`echo ${sndtimes} | tr ',' ' '` |
---|
1507 | sndstn=`python $pyHOME/nc_var.py -o grattr -f ${sndorigfn} -S Station_name | \ |
---|
1508 | tr ' ' '!'` |
---|
1509 | |
---|
1510 | # Time characteristics |
---|
1511 | tunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${sndorigfn} | \ |
---|
1512 | grep -v allvattrs | grep units | awk '{print $3}'` |
---|
1513 | Tu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` |
---|
1514 | Dref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` |
---|
1515 | Dref=${Dref0:0:4}${Dref0:5:2}${Dref0:8:2} |
---|
1516 | |
---|
1517 | obsdimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime, -v time -f ${sndorigfn} | \ |
---|
1518 | grep dimt | awk '{print $2-1}'` |
---|
1519 | |
---|
1520 | # Plotting |
---|
1521 | it=0 |
---|
1522 | while test ${it} -le ${obsdimt}; do |
---|
1523 | |
---|
1524 | otimev=`python $pyHOME/nc_var.py -o varout -S time:${it} -f ${sndorigfn} -v time |\ |
---|
1525 | grep NC | awk '{printf ("%d", $2)}'` |
---|
1526 | dateS=`date +${figsndTfmt} -d"${Dref} ${otimev} ${Tu}"` |
---|
1527 | timeS2=`date +%d"$^{"%H"}$" -d"${Dref} ${otimev} ${Tu}"` |
---|
1528 | timeS3=`date +%Y"-"%b -d"${Dref} ${otimev} ${Tu}"` |
---|
1529 | timeS4=`date +%Y -d"${Dref} ${otimev} ${Tu}"` |
---|
1530 | datefS=`date +%Y%m%d%H%M%S -d"${Dref} ${otimev} ${Tu}"` |
---|
1531 | |
---|
1532 | iexp=1 |
---|
1533 | for exp in ${exps}; do |
---|
1534 | expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'` |
---|
1535 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
1536 | expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` |
---|
1537 | expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` |
---|
1538 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
1539 | |
---|
1540 | #simjoinselvars=${odir}'/simout_vars_'${expl}'.nc' |
---|
1541 | #simdiagsf=${odir}'/simout_snddiags_'${expl}'.nc' |
---|
1542 | #simfiles=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT}` |
---|
1543 | simjoinselvars=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT} | head -n 1` |
---|
1544 | simdiagsf=${odir}'/simout_sndvars_'${stid}'_'${expl}'.nc' |
---|
1545 | simsndptf=${odir}'/simout_sndvars_'${stid}'_'${expl}'.nc' |
---|
1546 | |
---|
1547 | gridsndv=`python ${pyHOME}/nc_var.py -o get_point -f ${simjoinselvars} \ |
---|
1548 | -S 'XLONG:XLAT:Time|0' -v ${sndlon}','${sndlat} | tr ' ' '!'` |
---|
1549 | xsnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $1}' | tr ',' ' ' | \ |
---|
1550 | awk '{print $1}'` |
---|
1551 | ysnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $1}' | tr ',' ' ' | \ |
---|
1552 | awk '{print $2}'` |
---|
1553 | dsnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $2}'` |
---|
1554 | if test ${it} -eq 0 && test ${iexp} -eq 1; then |
---|
1555 | echo " Equivalent simulated sounding grid point: "${gridsnd}" distance: "\ |
---|
1556 | ${dsnd} |
---|
1557 | fi |
---|
1558 | |
---|
1559 | # Time information from simulation |
---|
1560 | simdimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime, -v time \ |
---|
1561 | -f ${simdiagsf} | grep dimt | awk '{print $2}'` |
---|
1562 | simtunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${simdiagsf} | \ |
---|
1563 | grep -v allvattrs | grep units | awk '{print $3}'` |
---|
1564 | simTu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` |
---|
1565 | simDref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` |
---|
1566 | simDref=${simDref0:0:4}${simDref0:5:2}${simDref0:8:2} |
---|
1567 | |
---|
1568 | # Time step from simulated file |
---|
1569 | timestepv=`python ${pyHOME}/nc_var.py -o get_time -f ${simsndptf} \ |
---|
1570 | -S ${otimev}';'${tunits} -v time | tr ' ' '@'` |
---|
1571 | timestep=`echo ${timestepv} | tr '@' ' ' | awk '{print $1}'` |
---|
1572 | timestepdiff=`echo ${timestepv} | tr '@' ' ' | awk '{print $2}'` |
---|
1573 | if test $? -ne 0; then |
---|
1574 | echo ${errmsg} |
---|
1575 | echo " python failed!!" |
---|
1576 | echo python ${pyHOME}/nc_var.py -o get_time -f ${simsndptf} \ |
---|
1577 | -S ${otimev}';'${tunits} -v time |
---|
1578 | exit |
---|
1579 | fi |
---|
1580 | |
---|
1581 | if test ${iexp} -eq 1; then |
---|
1582 | echo " "${it}": it="${timestep}" "$(echo ${dateS} | tr '!' ' ')" "${datefS} |
---|
1583 | tacomplabs='$ta^{obs}$,$ta^{'${expn}'}$' |
---|
1584 | tdacomplabs='$tda^{obs}$,$tda^{'${expn}'}$' |
---|
1585 | tacompcols='#FF6464,'${expc} |
---|
1586 | tdacompcols='#6464FF,'${expc} |
---|
1587 | tacompltyp='-,-' |
---|
1588 | tdacompltyp='-,-.' |
---|
1589 | tacompfiles=${sndorigfn}':pres|-1,time|'${it}':ta,pres;' |
---|
1590 | tacompfiles=${tacompfiles}${simsndptf}':bottom_top|-1,Time|'${timestep}':' |
---|
1591 | tacompfiles=${tacompfiles}'ta,pres' |
---|
1592 | tdacompfiles=${sndorigfn}':pres|-1,time|'${it}':tda,pres;' |
---|
1593 | tdacompfiles=${tdacompfiles}${simsndptf}':bottom_top|-1,Time|'${timestep}':' |
---|
1594 | tdacompfiles=${tdacompfiles}'tda,pres' |
---|
1595 | |
---|
1596 | # multi Wind-Rose |
---|
1597 | # Getting pressure level from observations to plot |
---|
1598 | if test ${it} -eq 0; then |
---|
1599 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
1600 | -f ${simsndptf} -v pres | grep MAT | grep pres` |
---|
1601 | nsimpres=`echo ${fstats} | awk '{printf ("%d",$3)}'` |
---|
1602 | fi |
---|
1603 | |
---|
1604 | obsuavaf=${odir}/sounding_uava_${stid}.nc |
---|
1605 | obspres=`python $pyHOME/nc_var.py -o varout -f ${obsuavaf} -S time:${it} \ |
---|
1606 | -v pres | awk '{print $2}' | tr '\n' ':'` |
---|
1607 | Lobspres1=`expr length ${obspres} | awk '{print $1-1}'` |
---|
1608 | vals=${obspres:0:${Lobspres1}}',threshold,:,'${nsimpres} |
---|
1609 | kobs=`python ${pyHOME}/generic.py -o inf_operSlist -S ${vals}` |
---|
1610 | if test $? -ne 0; then |
---|
1611 | echo ${errormsg} |
---|
1612 | echo " python failed !!" |
---|
1613 | echo python ${pyHOME}/generic.py -o inf_operSlist -S ${vals} |
---|
1614 | exit |
---|
1615 | fi |
---|
1616 | vals=${obspres:0:${Lobspres1}}',getvalue,:,'${kobs} |
---|
1617 | onpres=`python ${pyHOME}/generic.py -o inf_operSlist -S ${vals}` |
---|
1618 | echo " obs level of sim npres "${nsimpres}": "${kobs}" "${onpres} |
---|
1619 | |
---|
1620 | mWRcomplabs='obs,'${expn} |
---|
1621 | mWRcompfiles=${odir}'/sounding_uava_'${stid}'.nc@pres|1,'${kobs}',1;time|' |
---|
1622 | mWRcompfiles=${mWRcompfiles}${it}'@ua,va#'${simsndptf}'@bottom_top|-1;Time|' |
---|
1623 | mWRcompfiles=${mWRcompfiles}${timestep}'@ua,va' |
---|
1624 | mWRmarks='.@'${expm} |
---|
1625 | else |
---|
1626 | tacomplabs=${tacomplabs}',$ta^{'${expn}'}$' |
---|
1627 | tdacomplabs=${tdacomplabs}',$tda^{'${expn}'}$' |
---|
1628 | tacompcols=${tacompcols}','${expc} |
---|
1629 | tdacompcols=${tdacompcols}','${expc} |
---|
1630 | tacompltyp=${tacompltyp}',-' |
---|
1631 | tdacompltyp=${tdacompltyp}',-.' |
---|
1632 | tacompfiles=${tacompfiles}';'${simsndptf}':bottom_top|-1,Time|'${timestep}':' |
---|
1633 | tacompfiles=${tacompfiles}'ta,pres' |
---|
1634 | tdacompfiles=${tdacompfiles}';'${simsndptf}':bottom_top|-1,Time|'${timestep} |
---|
1635 | tdacompfiles=${tdacompfiles}':tda,pres' |
---|
1636 | # multi Wind-Rose |
---|
1637 | mWRcomplabs=${mWRcomplabs}','${expn} |
---|
1638 | mWRcompfiles=${mWRcompfiles}'#'${simsndptf}'@bottom_top|-1;Time|'${timestep} |
---|
1639 | mWRcompfiles=${mWRcompfiles}'@ua,va' |
---|
1640 | mWRmarks=${mWRmarks}'@'${expm} |
---|
1641 | fi |
---|
1642 | |
---|
1643 | if test ${it} -eq 0; then |
---|
1644 | # Hovmoeller maps |
---|
1645 | sndvs=`echo ${sndvars} | tr ':' ' '` |
---|
1646 | for sndv in ${sndvs}; do |
---|
1647 | |
---|
1648 | CFvarvals=`python $pyHOME/generic.py -o variables_values -S ${sndv}` |
---|
1649 | cbar=`echo ${CFvarvals} | tr ':' ' ' | awk '{print $7}'` |
---|
1650 | |
---|
1651 | fivals=${stid}'#'${sndstn}'#'${sndv}'#'${ofigdir}'#'${datefS}'#'${fmtTts} |
---|
1652 | fivals=${fivals}'#'${simsndptf}'#'${sndorigfn}'#'${expl}'#'${expn}'#'${cbar} |
---|
1653 | fivals=${fivals}'#SkewT-logP_obs-sim_evol' |
---|
1654 | |
---|
1655 | Hovmoeller_SkewT_map_plot ${fivals} |
---|
1656 | |
---|
1657 | # end sounding vars |
---|
1658 | done |
---|
1659 | fi |
---|
1660 | |
---|
1661 | iexp=`expr ${iexp} + 1` |
---|
1662 | # End experiments |
---|
1663 | done |
---|
1664 | |
---|
1665 | complabs=${tacomplabs}','${tdacomplabs} |
---|
1666 | compcols=${tacompcols}','${tdacompcols} |
---|
1667 | compltyp=${tacompltyp}','${tdacompltyp} |
---|
1668 | compfiles=${tacompfiles}';'${tdacompfiles} |
---|
1669 | |
---|
1670 | fivals=${stid}'@'${sndstn}'@'${complabs}'@'${compcols}'@'${compltyp}'@' |
---|
1671 | fivals=${fivals}${compfiles}'@'${dateS}'@'${ofigdir}'@'${datefS}'@' |
---|
1672 | fivals=${fivals}'SkewT-logP_obs-sim_step' |
---|
1673 | multi_SkewT_logP_plot ${fivals} |
---|
1674 | |
---|
1675 | # Wind Rose comparison |
---|
1676 | fivals=${stid}'%'${sndstn}'%'${ofigdir}'%'${mWRcompfiles}'%'${mWRcomplabs}'%' |
---|
1677 | fivals=${fivals}${mWRmarks}'%'${dateS}'%'${datefS}'%WindRose_obs-sim_step' |
---|
1678 | |
---|
1679 | multi_WindRose_plot ${fivals} |
---|
1680 | |
---|
1681 | it=`expr ${it} + 1` |
---|
1682 | # End sounding time-steps |
---|
1683 | done |
---|
1684 | |
---|
1685 | # End of soundings stations |
---|
1686 | done |
---|
1687 | |
---|
1688 | # Joining sounding 1D variables |
---|
1689 | obssnd1Dfile=${odir}'/all_sounding_1D.nc' |
---|
1690 | if test ! -f ${obssnd1Dfile}; then |
---|
1691 | python ${pyHOME}/nc_var.py -o join_sounding_obsfiles -S ${snddir}':UWyoming_snd' \ |
---|
1692 | -v all |
---|
1693 | if test $? -ne 0; then |
---|
1694 | echo ${errmsg} |
---|
1695 | echo " python failed!!" |
---|
1696 | echo python ${pyHOME}/nc_var.py -o join_sounding_obsfiles \ |
---|
1697 | -S ${snddir}':UWyoming_snd' -v all |
---|
1698 | fi |
---|
1699 | echo " * Joining all 1D variables from all sounding station files : " >> ${ofileins} |
---|
1700 | echo python ${pyHOME}/nc_var.py -o join_sounding_obsfiles \ |
---|
1701 | -S ${snddir}':UWyoming_snd' -v all >> ${ofileins} |
---|
1702 | echo " " >> ${ofileins} |
---|
1703 | mv joined_soundingstations.nc ${obssnd1Dfile} |
---|
1704 | fi |
---|
1705 | |
---|
1706 | exit |
---|
1707 | |
---|
1708 | ### |
---|
1709 | ## SFC figures |
---|
1710 | ### |
---|
1711 | |
---|
1712 | # Joining all observations |
---|
1713 | obssfcfile=${odir}'/all_single-stations.nc' |
---|
1714 | if test ! -f ${obssfcfile}; then |
---|
1715 | python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles -S \ |
---|
1716 | ${sfcdir}':OBSnetcdf' -v all |
---|
1717 | if test $? -ne 0; then |
---|
1718 | echo ${errmsg} |
---|
1719 | echo " python failed!!" |
---|
1720 | echo python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles \ |
---|
1721 | -S ${sfcdir}':OBSnetcdf' -v all |
---|
1722 | fi |
---|
1723 | echo " * Joining all surface station files : " >> ${ofileins} |
---|
1724 | echo python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles -S \ |
---|
1725 | ${sfcdir}':OBSnetcdf' -v all >> ${ofileins} |
---|
1726 | echo " " >> ${ofileins} |
---|
1727 | mv joined_singlestations.nc ${obssfcfile} |
---|
1728 | fi |
---|
1729 | |
---|
1730 | # getting min,max values |
---|
1731 | if test ${sfcvars} != 'None'; then |
---|
1732 | fcs=`echo ${sfcvars} | tr ':' ' '` |
---|
1733 | |
---|
1734 | iv=1 |
---|
1735 | for sfcpv in ${sfcs}; do |
---|
1736 | sfcv=`echo ${sfcpv} | tr '@' ' ' | awk '{print $1}'` |
---|
1737 | nsfc=`echo ${sfcpv} | tr '@' ' ' | awk '{print $2}'` |
---|
1738 | xsfc=`echo ${sfcpv} | tr '@' ' ' | awk '{print $3}'` |
---|
1739 | if test ${nsfc} = 'FROMobs'; then |
---|
1740 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
1741 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
1742 | nsfc=`echo ${fstats} | awk '{print $3}'` |
---|
1743 | elif test ${nsfc} = 'FROMsims'; then |
---|
1744 | iexp=1 |
---|
1745 | for exp in ${exps}; do |
---|
1746 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
1747 | for stidf in ${sndids}; do |
---|
1748 | stid=`echo ${stidf} | tr '@' ' ' | awk '{print $1}'` |
---|
1749 | simsfcdiagf=${odir}'/simout_sfcvars_'${stdi}'_'${expl}'.nc' |
---|
1750 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
1751 | -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
1752 | if test ${iexp} -eq 1; then |
---|
1753 | nsfc=`echo ${fstats} | awk '{print $3}'` |
---|
1754 | else |
---|
1755 | nsfc2=`echo ${fstats} | awk '{print $3}'` |
---|
1756 | nsfcf=`echo ${nsfc}" "${nsfc2} | awk '{if ($1 < $2) {print $1;} else {print $2;}}'` |
---|
1757 | fi |
---|
1758 | iexp=`expr ${iexp} + 1` |
---|
1759 | done |
---|
1760 | done |
---|
1761 | elif test ${nsfc} = 'FROMobssims'; then |
---|
1762 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
1763 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
1764 | nsfc=`echo ${fstats} | awk '{print $3}'` |
---|
1765 | for exp in ${exps}; do |
---|
1766 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
1767 | for stidf in ${sndids}; do |
---|
1768 | stid=`echo ${stidf} | tr '@' ' ' | awk '{print $1}'` |
---|
1769 | simsfcdiagf=${odir}'/simout_sfcvars_'${stdi}'_'${expl}'.nc' |
---|
1770 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
1771 | -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
1772 | nsfc2=`echo ${fstats} | awk '{print $3}'` |
---|
1773 | nsfc=`echo ${nsfc}" "${nsfc2} | awk '{if ($1 < $2) {print $1;} else {print $2;}}'` |
---|
1774 | done |
---|
1775 | done |
---|
1776 | fi |
---|
1777 | if test ${xsfc} = 'FROMobs'; then |
---|
1778 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
1779 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
1780 | xsfc=`echo ${fstats} | awk '{print $4}'` |
---|
1781 | elif test ${xsfc} = 'FROMsims'; then |
---|
1782 | iexp=1 |
---|
1783 | for exp in ${exps}; do |
---|
1784 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
1785 | for stidf in ${sndids}; do |
---|
1786 | stid=`echo ${stidf} | tr '@' ' ' | awk '{print $1}'` |
---|
1787 | simsfcdiagf=${odir}'/simout_sfcvars_'${stdi}'_'${expl}'.nc' |
---|
1788 | |
---|
1789 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
1790 | -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
1791 | if test ${iexp} -eq 1; then |
---|
1792 | xsfc=`echo ${fstats} | awk '{print $4}'` |
---|
1793 | else |
---|
1794 | xsfc2=`echo ${fstats} | awk '{print $4}'` |
---|
1795 | xsfcf=`echo ${xsfc}" "${xsfc2} | awk '{if ($1 > $2) {print $1;} else {print $2;}}'` |
---|
1796 | fi |
---|
1797 | iexp=`expr ${iexp} + 1` |
---|
1798 | done |
---|
1799 | done |
---|
1800 | elif test ${nsfc} = 'FROMobssims'; then |
---|
1801 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
1802 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
1803 | xsfc=`echo ${fstats} | awk '{print $4}'` |
---|
1804 | iexp=1 |
---|
1805 | for exp in ${exps}; do |
---|
1806 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
1807 | for stidf in ${sndids}; do |
---|
1808 | stid=`echo ${stidf} | tr '@' ' ' | awk '{print $1}'` |
---|
1809 | simsfcdiagf=${odir}'/simout_sfcvars_'${stdi}'_'${expl}'.nc' |
---|
1810 | |
---|
1811 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
1812 | -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
1813 | xsfc2=`echo ${fstats} | awk '{print $4}'` |
---|
1814 | xsfcf=`echo ${xsfc}" "${xsfc2} | awk '{if ($1 > $2) {print $1;} else {print $2;}}'` |
---|
1815 | done |
---|
1816 | done |
---|
1817 | fi |
---|
1818 | if test $iv -eq 1; then |
---|
1819 | newsfcvars=${sfcv}'@'${nsfc}'@'${xsfc} |
---|
1820 | else |
---|
1821 | newsfcvars=${newsfcvars}':'${sfcv}'@'${nsfc}'@'${xsfc} |
---|
1822 | fi |
---|
1823 | iv=`expr ${iv} + 1` |
---|
1824 | done |
---|
1825 | sfcs=`echo ${newsfcvars} | tr ':' ' '` |
---|
1826 | echo "new sfc variables: "${sfcs} |
---|
1827 | |
---|
1828 | # Time-series |
---|
1829 | |
---|
1830 | # stations |
---|
1831 | # FROM: https://stackoverflow.com/questions/2961635/using-awk-to-print-all-columns-from-the-nth-to-the-last |
---|
1832 | stsids=`python ${pyHOME}/nc_var.py -o varout -v id -f \ |
---|
1833 | ${obssfcfile} -S 'Nstations:-1|time:0' | awk '{$1=""; printf("%d:",substr($0,2))}'` |
---|
1834 | stsnames=`python ${pyHOME}/nc_var.py -o varout -v stsname -f \ |
---|
1835 | ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':' | \ |
---|
1836 | tr ' ' '!'` |
---|
1837 | stslons=`python ${pyHOME}/nc_var.py -o varout -v stslon -f \ |
---|
1838 | ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':'` |
---|
1839 | stslats=`python ${pyHOME}/nc_var.py -o varout -v stslat -f \ |
---|
1840 | ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':'` |
---|
1841 | |
---|
1842 | Nsts=`echo ${stsnames} | tr ':' ' ' | wc -w | awk '{print $1}'` |
---|
1843 | ist=1 |
---|
1844 | while test ${ist} -le ${Nsts}; do |
---|
1845 | sti=`echo ${stsids} | tr ':' '\n' | head -n ${ist} | tail -n 1` |
---|
1846 | stn=`echo ${stsnames} | tr ':' '\n' | head -n ${ist} | tail -n 1` |
---|
1847 | stl=`echo ${stslons} | tr ':' '\n' | head -n ${ist} | tail -n 1` |
---|
1848 | stL=`echo ${stslats} | tr ':' '\n' | head -n ${ist} | tail -n 1` |
---|
1849 | ist_1=`expr ${ist} - 1` |
---|
1850 | |
---|
1851 | sfccompfiles=${obssfcfile}'%time|-1;Nstations|'${ist_1} |
---|
1852 | sfccomplabs='obs' |
---|
1853 | sfccompcols='#000000' |
---|
1854 | |
---|
1855 | iexp=1 |
---|
1856 | for exp in ${exps}; do |
---|
1857 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
1858 | expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` |
---|
1859 | expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` |
---|
1860 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
1861 | |
---|
1862 | simsfcdiagf=${odir}'/simout_sfcvars_'${stdi}'_'${expl}'.nc' |
---|
1863 | |
---|
1864 | sfcstats=${sti}'@'${stn}'@'${stl}'@'${stL}'@'${gridsfc} |
---|
1865 | |
---|
1866 | sfccompfiles=${sfccompfiles}','${simsfcdiagf}'%time|-1' |
---|
1867 | sfccomplabs=${sfccomplabs}','${expn} |
---|
1868 | sfccompcols=${sfccompcols}','${expc} |
---|
1869 | done |
---|
1870 | # end experiments |
---|
1871 | |
---|
1872 | for sfcpv in ${sfcs}; do |
---|
1873 | sfcv=`echo ${sfcpv} | tr '@' ' ' | awk '{print $1}'` |
---|
1874 | nsfc=`echo ${sfcpv} | tr '@' ' ' | awk '{print $2}'` |
---|
1875 | xsfc=`echo ${sfcpv} | tr '@' ' ' | awk '{print $3}'` |
---|
1876 | |
---|
1877 | fivals=${sti}'@'${stn}'@'${sfcv}'@'${ofigdir}'@'${fmtTts}'@'${sfccompfiles}'@' |
---|
1878 | fivals=${fivals}${sfccomplabs}'@'${sfccompcols}'@'${nsfc}'@'${xsfc} |
---|
1879 | fivals=${fivals}'@obs-sim_evol_ts' |
---|
1880 | |
---|
1881 | multiple_time_series_plot ${fivals} |
---|
1882 | exit |
---|
1883 | |
---|
1884 | done |
---|
1885 | # end observations |
---|
1886 | |
---|
1887 | ist=`expr $ist + 1` |
---|
1888 | done |
---|
1889 | # end sfc statinos |
---|
1890 | |
---|
1891 | # Cont-disc comparison |
---|
1892 | iexp=1 |
---|
1893 | for exp in ${exps}; do |
---|
1894 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
1895 | expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` |
---|
1896 | expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` |
---|
1897 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
1898 | |
---|
1899 | simsfcdiagf=${odir}'/simout_sfcmapdiags_'${expl}'.nc' |
---|
1900 | |
---|
1901 | # Time information from simulation |
---|
1902 | simdimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime, -v time -f ${simsfcdiagf} \ |
---|
1903 | | grep dimt | awk '{print $2-1}'` |
---|
1904 | simtunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${simsfcdiagf} | \ |
---|
1905 | grep -v allvattrs | grep units | awk '{print $3}'` |
---|
1906 | simTu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` |
---|
1907 | simDref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` |
---|
1908 | simDref=${simDref0:0:4}${simDref0:5:2}${simDref0:8:2} |
---|
1909 | |
---|
1910 | it=0 |
---|
1911 | while test ${it} -le ${simdimt}; do |
---|
1912 | simtstep=`python ${pyHOME}/nc_var.py -o varout -f ${simsfcdiagf} -S \ |
---|
1913 | 'time:'${it} -v time | grep NC | awk '{printf ("%d",$2)}'` |
---|
1914 | if test $? -ne 0; then |
---|
1915 | echo ${errmsg} |
---|
1916 | echo " python failed!!" |
---|
1917 | echo python ${pyHOME}/nc_var.py -o varout -f ${simsfcdiagf} -S 'time:'${it} -v time |
---|
1918 | exit |
---|
1919 | fi |
---|
1920 | |
---|
1921 | timeS=`date +${figsndTfmt} -d"${simDref} ${simtstep} ${simTu}"` |
---|
1922 | echo ${it}" "${simtstep}" "${simDref}" "${simTu}" "$(echo ${timeS} | tr '!' ' ') |
---|
1923 | timefS=`date +%Y%m%d%H%M%S -d"${simDref} ${simtstep} ${simTu}"` |
---|
1924 | |
---|
1925 | # Looking for obs time |
---|
1926 | oitv=`python ${pyHOME}/nc_var.py -o get_time -f ${obssfcfile} \ |
---|
1927 | -S ${simtstep}';'${tunits} -v ststimes | grep -v differ | tr ' ' '@'` |
---|
1928 | oit=`echo ${oitv} | tr '@' ' ' | awk '{print $1}'` |
---|
1929 | |
---|
1930 | for sfcnxv in ${sfcs}; do |
---|
1931 | sfcv=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $1}'` |
---|
1932 | nsfc=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $2}'` |
---|
1933 | xsfc=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $3}'` |
---|
1934 | |
---|
1935 | fivals=${expl}'#'${expn}'#'${sfcv}'#'${ofigdir}'#'${obssfcfile}'#'${simsfcdiagf} |
---|
1936 | fivals=${fivals}'#'${it}'#'${oit}'#'${timeS}'#'${timefS}'#'${nsfc}'#'${xsfc}'#' |
---|
1937 | fivals=${fivals}${mapv}'#'${mapcover}'#map_obs-sim' |
---|
1938 | |
---|
1939 | shad_contdisc_map_plot ${fivals} |
---|
1940 | |
---|
1941 | # end of variables |
---|
1942 | done |
---|
1943 | |
---|
1944 | it=`expr ${it} + 1` |
---|
1945 | # end of time-steps |
---|
1946 | done |
---|
1947 | |
---|
1948 | # end of simulations |
---|
1949 | done |
---|
1950 | fi |
---|
1951 | |
---|
1952 | fi |
---|