Changeset 1983 in lmdz_wrf for trunk/tools
- Timestamp:
- Jul 25, 2018, 10:29:50 PM (7 years ago)
- Location:
- trunk/tools
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/obs-sim_Comparison.bash
r1975 r1983 6 6 # 7 7 8 # Name of the file with the configuration 9 configfname='/home/lluis/estudios/ChemGBsAs/tests/199501/obs_simComparison.conf' 10 11 ####### ###### ##### #### ### ## # 12 13 function uploadvars() { 14 # Function to upload variables to the system from an ASCII file as: 15 # [varname] = [value] 16 fileval=$1 17 errormsg='ERROR -- error -- ERROR -- error' 18 19 if test ! -f ${fileval}; then 20 echo ${errormsg} 21 echo " "${fname}": file '"${fileval}"' does not exist!!" 22 exit 23 fi 24 25 Nlin=`wc -l ${fileval} | awk '{print $1}'` 26 27 ilin=1 28 while test ${ilin} -le ${Nlin}; do 29 line=`head -n ${ilin} ${fileval} | tail -n 1` 30 varname=`echo ${line} | tr '=' ' ' | awk '{print $1}'` 31 value=`echo ${line} | tr '=' ' ' | awk '{print $2}'` 32 Lvarname=`expr length ${varname}'0'` 33 34 if test ${Lvarname} -gt 1 && test ! ${varname:0:1} = '#'; then 35 export ${varname}=${value} 36 fi 37 ilin=`expr ${ilin} + 1` 38 done 39 } 40 41 uploadvars ${configfname} 42 # END upload -- end UPLOAD -- END upload -- end UPLOAD 43 8 44 # files from scratch 9 fscratch=false 45 if test; then ${fscratch} = 'true'; fscratch=true 46 else fscratch=false; fi 10 47 11 48 # figures from scratch 12 gscratch=true 13 14 # Working directory 15 wdir='/home/lluis/estudios/ChemGBsAs/tests/199501' 16 17 ## U. Wyoming file (respect wdir) 18 snddir='obs/snd' 19 sndorigfn='UWyoming_snd_87576.nc' 20 snddimt=6 21 sndstn='Ezeiza' 22 23 # Kind of graphical file output 24 kfig='png' 25 26 # Color for SkewT_evol 27 col=255 28 col2=200 29 fraccol=16 30 fraccol2=16 31 32 # Simulation dir 33 simdir='/home/lluis/PY' 34 35 # Variables from the simulations 36 simvars='XLONG,XLAT,T,P,PB,PH,PHB,QVAPOR,U,V,MU,MUB,SINALPHA,COSALPHA,T2,U10,V10,' 37 simvars=${simvars}'PSFC,Q2' 38 39 # Diagnotics for the soundigns 40 wrfsnddiags='WRFt:WRFtda:WRFp:WRFua:WRFva:ws' 41 42 # Figures output directory 43 ofigdir=${wdir}/figs 44 45 # Sounding comparison vars 46 sndvars='ta:tda:ws' 47 48 # Observations surface files 49 sfcobsdir='obs/sfc_CAM/' 50 obsHf='OBSnetcdf_' 51 # Surface variables [varn1]@[minv1]@[maxv1]:[varn2]@[minv2]@[maxv2]:... 52 #sfcvars='tas:wds:wss:psl:clt:tdas' 53 sfcvars='tas@FROMobs@FROMobs:wds@0.@6.28:wss@0.@@FROMobs:tdas@FROMobs@FROMobs' 54 #wrfsfcdiags='wds:wss:WRFpsl_ecmwf:clt:WRFtdas' 55 wrfsfcdiags='T2:wds:wss:WRFtdas' 56 57 # map values 58 mapv='cyl,f' 59 60 # map coverage for cont-disc 61 mapcover='sponge,0.1,0.1' 62 63 # Format of time-axis for time-series 64 fmtTts='exct,12,h|%d$^{%H}$' 65 66 ####### ###### ##### #### ### ## # 49 if test; then ${gscratch} = 'true'; gscratch=true 50 else gscratch=false; fi 67 51 68 52 function num_hex(){ … … 139 123 } 140 124 125 function WindRose_plot() { 126 # Function to plot a Wind rose 127 # it: time-step to use from the file 128 # sndstid: id of the sounding station 129 # sndstn: name of the sounding station to appear in plot ('!' for spaces) 130 # timeS: String with the format of the actual time ('!' for spaces) 131 # ofigdir: folder for the output of the figure 132 # timefS: date of the plot to be used for the figure name 133 # filen: file to use 134 135 valuesfig=$1 136 137 it=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` 138 sndstid=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` 139 sndstn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` 140 timeS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` 141 ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` 142 timefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` 143 filen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` 144 145 values='pres|-1;time|'${it}':linepoint;multicol;pres;auto;auto;rainbow;auto:' 146 values=${values}${sndstn}'!sounding!WindRose!on!'${timeS}'!local!time:'${kfig} 147 values=${values}':cardinals:False:WindRose:True' 148 ofign=${ofigdir}'/WindRose_'${sndstid}'_'${timefS}'.'${kfig} 149 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 150 if test ! -f ${ofign}; then 151 echo " Wind Rose on: "${timeS} 152 python ${pyHOME}/drawing.py -o draw_WindRose -S ${values} -v ua,va -f ${filen} >& /dev/null 153 if test $? -ne 0; then 154 echo ${errmsg} 155 echo " python failed!!" 156 echo python ${pyHOME}/drawing.py -o draw_WindRose -S ${values} -v ua,va -f ${filen} 157 exit 158 fi 159 mv WindRose.png ${ofign} 160 echo "* "${ofign} >> ${ofilefigs} 161 echo python ${pyHOME}/drawing.py -o draw_WindRose -S "'"${values}"'" -v ua,va -f "'"${filen}"'" >> ${ofilefigs} 162 echo " " >> ${ofilefigs} 163 fi 164 } 165 166 function SkewT_logP_plot() { 167 # Function to plot a SkewT_logP plot 168 # it: time step to use from file 169 # sndstid: id of the sounding station 170 # sndstn: name of the sounding station to appear in plot ('!' for spaces) 171 # timeS: String with the format of the actual time ('!' for spaces) 172 # ofigdir: folder for the output of the figure 173 # timefS: date of the plot to be used for the figure name 174 # filen: file to use 175 176 valuesfig=$1 177 178 it=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` 179 sndstid=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` 180 sndstn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` 181 timeS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` 182 ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` 183 timefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` 184 filen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` 185 186 values='time|'${it}',pres|-1:auto:auto:'${sndstn}'!sounding!on!'${timeS}'!local!' 187 values=${values}'time:'${kfig}':True' 188 ofign=${ofigdir}'/SkewT-logP_'${sndstid}'_'${timefS}'.'${kfig} 189 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 190 if test ! -f ${ofign}; then 191 echo " Sounding on: "$(echo ${timeS} | tr '!' ' ') 192 python ${pyHOME}/drawing.py -o draw_SkewT -S ${values} -v ta,tda,pres -f ${filen} >& /dev/null 193 if test $? -ne 0; then 194 echo ${errmsg} 195 echo " python failed!!" 196 echo python ${pyHOME}/drawing.py -o draw_SkewT -S ${values} -v ta,tda,pres -f ${filen} 197 exit 198 fi 199 mv SkewT.png ${ofign} 200 echo "* "${ofign} >> ${ofilefigs} 201 echo python ${pyHOME}/drawing.py -o draw_SkewT -S "'"${values}"'" -v ta,tda,pres -f "'"${filen}"'" >> ${ofilefigs} 202 echo " " >> ${ofilefigs} 203 fi 204 } 205 206 function multi_soundings_plot() { 207 # Function to plot a multi_sounding figure 208 # sndstid: id of the sounding station 209 # sndstn: name of the sounding station to appear in plot ('!' for spaces) 210 # tatda_evol_labs: labels for the figure 211 # tatda_evol_cols: colors of the lines for the figure 212 # timeS3: date in the figure 213 # ofigdir: folder for the output figure 214 215 valuesfig=$1 216 217 sndstid=`echo ${valuesfig} | tr '@' ' ' | awk '{print $1}'` 218 sndstn=`echo ${valuesfig} | tr '@' ' ' | awk '{print $2}'` 219 tatda_evol_labs=`echo ${valuesfig} | tr '@' ' ' | awk '{print $3}'` 220 tatda_evol_cols=`echo ${valuesfig} | tr '@' ' ' | awk '{print $4}'` 221 tatda_evol_files=`echo ${valuesfig} | tr '@' ' ' | awk '{print $5}'` 222 timeS3=`echo ${valuesfig} | tr '@' ' ' | awk '{print $6}'` 223 ofigdir=`echo ${valuesfig} | tr '@' ' ' | awk '{print $7}'` 224 225 tatda_evol_values='auto:auto:multilines!'${tatda_evol_labs}'!'${tatda_evol_cols}'!' 226 tatda_evol_values=${tatda_evol_values}'-!,!2:0,auto:'${ststn}'!sounding!evolution!on!' 227 tatda_evol_values=${tatda_evol_values}${timeS3}'!local!time:'${kfig}':True' 228 229 ofign=${ofigdir}'/SkewT-logP_'${stid}'_evol.'${kfig} 230 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 231 if test ! -f ${ofign}; then 232 echo " Sounding on: "$(echo ${timeS} | tr '!' ' ') 233 python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${tatda_evol_values} -f ${tatda_evol_files} >& /dev/null 234 if test $? -ne 0; then 235 echo ${errmsg} 236 echo " python failed!!" 237 python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${tatda_evol_values} -f ${tatda_evol_files} 238 exit 239 fi 240 mv multi_SkewT.png ${ofign} 241 echo "* "${ofign} >> ${ofilefigs} 242 echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${tatda_evol_values} -f ${tatda_evol_files} >> ${ofilefigs} 243 echo " " >> ${ofilefigs} 244 fi 245 } 246 247 function multi_SkewT_logP_plot() { 248 # Function to plot a multi_SkewT_logP plot with multiple lines 249 # sndstid: id of the sounding station 250 # sndstn: name of the sounding station to appear in plot ('!' for spaces) 251 # complabs: labels for the plot 252 # compcols: colors for the plot 253 # complines: type of lines for the plot 254 # compfiles: files to use for the plot 255 # dateS: String with the format of the actual time ('!' for spaces) 256 # ofigdir: folder for the output of the figure 257 # datefS: date of the plot to be used for the figure name 258 259 valuesfig=$1 260 sndstid=`echo ${valuesfig} | tr '@' ' ' | awk '{print $1}'` 261 sndstn=`echo ${valuesfig} | tr '@' ' ' | awk '{print $2}'` 262 complabs=`echo ${valuesfig} | tr '@' ' ' | awk '{print $3}'` 263 compcols=`echo ${valuesfig} | tr '@' ' ' | awk '{print $4}'` 264 complines=`echo ${valuesfig} | tr '@' ' ' | awk '{print $5}'` 265 compfiles=`echo ${valuesfig} | tr '@' ' ' | awk '{print $6}'` 266 dateS=`echo ${valuesfig} | tr '@' ' ' | awk '{print $7}'` 267 ofigdir=`echo ${valuesfig} | tr '@' ' ' | awk '{print $8}'` 268 datefS=`echo ${valuesfig} | tr '@' ' ' | awk '{print $9}'` 269 270 values='auto:auto:multilines!'${complabs}'!'${compcols}'!' 271 values=${values}${complines}'!,!2:0,auto:'${ststn}'!sounding!obs!,!sim!' 272 values=${values}'comparison!on!'${dateS}'!UTC:png:True' 273 274 ofign=${ofigdir}'/SkewT-logP_obs-sim_'${sndstid}'_'${datefS}'.'${kfig} 275 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 276 if test ! -f ${ofign}; then 277 echo " Sounding on: "$(echo ${dateS} | tr '!' ' ') 278 python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${values} -f ${compfiles} >& /dev/null 279 if test $? -ne 0; then 280 echo ${errmsg} 281 echo " python failed!!" 282 echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${values} -f ${compfiles} 283 exit 284 fi 285 mv multi_SkewT.png ${ofign} 286 echo "* "${ofign} >> ${ofilefigs} 287 echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${values} -f ${compfiles} >> ${ofilefigs} 288 echo " " >> ${ofilefigs} 289 fi 290 } 291 292 function Homoeller_SkewT_map_plot() { 293 # Function to plot a Hovmoeller SkewT_map 294 # sndstid: id of the sounding station 295 # sndstn: name of the sounding station to appear in plot ('!' for spaces) 296 # sndv: variable to plot 297 # ofigdir: folder for the output of the figure 298 # datefS: date of the plot to be used for the figure name 299 # timevals: values to use for the time-axis in the plot 300 # simfilen: name of the simulation file at the given point 301 # sndfilen: name of the sounding file 302 # expl: label of the experiment 303 # expn: name of the experiment 304 # cbar: color bar 305 306 valuesfig=$1 307 sndstid=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` 308 sndstn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` 309 sndv=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` 310 ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` 311 datefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` 312 timevals=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` 313 simfilen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` 314 sndfilen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` 315 expl=`echo ${valuesfig} | tr '#' ' ' | awk '{print $9}'` 316 expn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $10}'` 317 cbar=`echo ${valuesfig} | tr '#' ' ' | awk '{print $11}'` 318 319 cfiles=${simfilen}';'${sndv}';time;pres;time|-1,pres|-1@' 320 cfiles=${cfiles}${sndfilen}';'${sndv}';time;pres;time|-1,pres|-1' 321 cvalues=${sndv}';y;auto|'${timevals}';Vfix,auto,50.,auto' 322 cvalues=${cvalues}';'${cbar}',auto,auto;Srange,Srange;auto;obs!,!'${expn}'!' 323 cvalues=${cvalues}${sndstn}'!sounding;'${kfig}';flip@y;None;yes' 324 325 ofign=${ofigdir}'/SkewT-logP_obs-sim_'${expl}'_evol_'${sndstid}'_'${sndv}'.'${kfig} 326 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 327 if test ! -f ${ofign}; then 328 python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f ${cfiles} -S ${cvalues} 329 if test $? -ne 0; then 330 echo ${errmsg} 331 echo " python failed!!" 332 echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f ${cfiles} -S ${cvalues} 333 exit 334 fi 335 mv 2Dshad_obs-sim_comparison_time.png ${ofign} 336 echo "* "${ofign} >> ${ofilefigs} 337 echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f ${cfiles} -S ${cvalues} >> ${ofilefigs} 338 echo " " >> ${ofilefigs} 339 fi 340 } 341 342 function multiple_time_series_plot(){ 343 # Function to plot multiple time-series 344 # sti: id of the surface station 345 # stn: name of the surface station to appear in plot ('!' for spaces) 346 # sfcv: name of variable to plot 347 # ofigdir: folder for the output of the figure 348 # timevals: values of the time-axis to use 349 # files: files to use 350 # labs: labels of the legend 351 # lcol: color of lines to use 352 # nsfc: minimum value to plot 353 # xsfc: maximum value to plot 354 355 valuesfig=$1 356 stid=`echo ${valuesfig} | tr '@' ' ' | awk '{print $1}'` 357 stn=`echo ${valuesfig} | tr '@' ' ' | awk '{print $2}'` 358 sfcv=`echo ${valuesfig} | tr '@' ' ' | awk '{print $3}'` 359 ofigdir=`echo ${valuesfig} | tr '@' ' ' | awk '{print $4}'` 360 timevals=`echo ${valuesfig} | tr '@' ' ' | awk '{print $5}'` 361 files=`echo ${valuesfig} | tr '@' ' ' | awk '{print $6}'` 362 labs=`echo ${valuesfig} | tr '@' ' ' | awk '{print $7}'` 363 lcol=`echo ${valuesfig} | tr '@' ' ' | awk '{print $8}'` 364 nsfc=`echo ${valuesfig} | tr '@' ' ' | awk '{print $9}'` 365 xsfc=`echo ${valuesfig} | tr '@' ' ' | awk '{print $10}'` 366 367 timen=`echo ${timevals} | tr '|' ' ' | awk '{print $3}'` 368 fmtT=`echo ${timevals} | tr '|' ' ' | awk '{print $1"|"$2}'` 369 370 values='ststimes,time;y;'${timen}';auto;'${labs}';'${sfcv}';'${sfcv} 371 values=${values}'|evolution|at|'$(echo ${stn} | tr '!' '|')';'${nsfc}','${xsfc}';' 372 values=${values}'time|'${fmtT}';0|12;' 373 values=${values}${kfig}';-;'${lcol}';.;2.;2.;all;-1;True' 374 375 ofign=${ofigdir}'/obs-sim_evol_'${sfcv}_${sti}'.'${kfig} 376 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 377 if test ! -f ${ofign}; then 378 python ${pyHOME}/drawing.py -o draw_lines_time -f ${files} -S ${values} -v ${sfcv} 379 if test $? -ne 0; then 380 echo ${errmsg} 381 echo " python failed!!" 382 python ${pyHOME}/drawing.py -o draw_lines_time -f ${files} -S ${values} -v ${sfcv} 383 exit 384 fi 385 mv lines_time.${kfig} ${ofign} 386 echo "* "${ofign} >> ${ofilefigs} 387 echo python ${pyHOME}/drawing.py -o draw_lines_time -f ${files} -S ${values} -v ${sfcv} >> ${ofilefigs} 388 echo " "${ofign} >> ${ofilefigs} 389 fi 390 } 391 392 function shad_contdisc_map_plot(){ 393 # Function to plot a map of a continuos and a discontinuos variable 394 # expl: label of the experiment 395 # expn: name of the experiment in the title of the plot 396 # sfcv: name of variable to plot 397 # ofigdir: folder for the output of the figure 398 # obsfiles: observtional file to use 399 # simfile: simulation file to use 400 # it: time-step from simulation 401 # oit: time-step from observations 402 # timeS: format of time to appear in the title 403 # timefS: format of time to be used for the file name 404 # nsfc: minimum value to plot 405 # xsfc: maximum value to plot 406 # mapv: map values 407 # mapcover: cover of the map 408 409 valuesfig=$1 410 411 expl=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` 412 expn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` 413 sfcv=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` 414 ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` 415 obsfile=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` 416 simfile=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` 417 it=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` 418 oit=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` 419 timeS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $9}'` 420 timefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $10}'` 421 nsfc=`echo ${valuesfig} | tr '#' ' ' | awk '{print $11}'` 422 xsfc=`echo ${valuesfig} | tr '#' ' ' | awk '{print $12}'` 423 mapv=`echo ${valuesfig} | tr '#' ' ' | awk '{print $13}'` 424 mapcover=`echo ${valuesfig} | tr '#' ' ' | awk '{print $14}'` 425 426 CFvarvals=`python $pyHOME/generic.py -o variables_values -S ${sfcv}` 427 cbar=`echo ${CFvarvals} | tr ':' ' ' | awk '{print $7}'` 428 429 cfiles=${simfile}';'${sfcv}';XLONG;XLAT;Time|'${it}',time|'${it}',' 430 cfiles=${cfiles}'west_east|-1,south_north|-1@'${obsfile}';'${sfcv} 431 cfiles=${cfiles}';stslon;stslat;time|'${oit}',lon|-1,lat|-1' 432 cvalues=${sfcv}':west_east,south_north:auto:'${cbar}',auto,auto:'${nsfc}',' 433 cvalues=${cvalues}${xsfc}':''auto:obs!,!'${expn}'!'${sfcv}'!on!'${timeS}'!UTC:' 434 cvalues=${cvalues}${kfig}':None:'${mapv}':'${mapcover}':yes' 435 436 ofign=${ofigdir}'/map_obs-sim_'${timefS}'_'${sfcv}'_'${expl}'.'${kfig} 437 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 438 if test ! -f ${ofign}; then 439 python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f ${cfiles} -S ${cvalues} 440 if test $? -ne 0; then 441 echo ${errmsg} 442 echo " python failed!!" 443 echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f ${cfiles} -S ${cvalues} 444 fi 445 mv 2Dshad_obs-sim_comparison.png ${ofign} 446 echo "* "${ofign} >> ${ofilefigs} 447 echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f ${cfiles} -S ${cvalues} >> ${ofilefigs} 448 echo " " >> ${ofilefigs} 449 fi 450 } 451 141 452 ####### ####### 142 453 ## MAIN 143 454 ####### 455 456 mkdir -p ${odir} 457 144 458 ofilefigs=${wdir}/allins_figures.inf 145 echo "*** INstruction from all figures" > ${ofilefigs} 146 147 mkdir -p ${ofigdir} 148 149 # Soundings plots 150 cd ${wdir}/${snddir} 151 152 # Time characteristics 153 tunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${sndorigfn} | grep -v allvattrs | grep units | awk '{print $3}'` 154 Tu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` 155 Dref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` 156 Dref=${Dref0:0:4}${Dref0:5:2}${Dref0:8:2} 157 158 # Sounding 159 160 # Getting wind components 161 ofile='sounding_uava.nc' 162 if ${fscratch}; then rm ${ofile}; fi 163 if test ! -f ${ofile}; then 164 python ${pyHOME}/diagnostics.py -f ${sndorigfn} -d 'time@time,pres@pres' -v 'uavaFROMwswd|ws@wd' 165 if test $? -ne 0; then 166 echo ${errmsg} 167 echo " python failed!!" 168 echo python ${pyHOME}/diagnostics.py -f ${sndorigfn} -d 'time@time,pres@pres' -v 'uavaFROMwswd|ws@wd' 169 exit 170 fi 171 mv diagnostics.nc ${ofile} 459 if ${fscratch}; then 460 echo "*** Instruction from all figures" > ${ofilefigs} 172 461 fi 173 462 174 it=0 175 tatda_evol_values='' 176 tatda_evol_files='' 177 sndtimes='' 178 snddates='' 179 sndFdates='' 180 while test ${it} -le ${snddimt}; do 181 timev=`python $pyHOME/nc_var.py -o varout -S time:${it} -f ${sndorigfn} -v time | grep NC | awk '{printf ("%d", $2)}'` 182 timeS=`date +%Y"/"%m"/"%d"!"%H -d"${Dref} ${timev} ${Tu}"` 183 timeS2=`date +%d"$^{"%H"}$" -d"${Dref} ${timev} ${Tu}"` 184 timeS3=`date +%Y"-"%b -d"${Dref} ${timev} ${Tu}"` 185 timeS4=`date +%Y -d"${Dref} ${timev} ${Tu}"` 186 echo ${it}" "${timev}" "${Dref}" '"${timev}"' "${Tu}" "$(echo ${timeS} | tr '!' ' ') 187 timefS=`date +%Y%m%d%H%M%S -d"${Dref} ${timev} ${Tu}"` 188 # Wind rose 189 values='pres|-1;time|'${it}':linepoint;multicol;pres;auto;auto;rainbow;auto:' 190 values=${values}${sndstn}'!sounding!WindRose!on!'${timeS}'!local!time:png:cardinals:False:WindRose:True' 191 ofign=${ofigdir}'/WindRose_'${timefS}'.png' 192 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 193 if test ! -f ${ofign}; then 194 echo " Wind Rose on: "${timeS} 195 python ${pyHOME}/drawing.py -o draw_WindRose -S ${values} -v ua,va -f ${ofile} >& /dev/null 196 if test $? -ne 0; then 197 echo ${errmsg} 198 echo " python failed!!" 199 echo python ${pyHOME}/drawing.py -o draw_WindRose -S ${values} -v ua,va -f ${ofile} 200 exit 201 fi 202 mv WindRose.png ${ofign} 203 echo "* "${ofign} >> ${ofilefigs} 204 echo python ${pyHOME}/drawing.py -o draw_WindRose -S ${values} -v ua,va -f ${ofile} >> ${ofilefigs} 205 fi 206 207 # Sounding 208 echo ${sndorigfn} 209 values='time|'${it}',pres|-1:auto:auto:'${sndstn}'!sounding!on!'${timeS}'!local!time:png:True' 210 ofign=${ofigdir}'/SkewT-logP_'${timefS}'.png' 211 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 212 if test ! -f ${ofign}; then 213 echo " Sounding on: "$(echo ${timeS} | tr '!' ' ') 214 python ${pyHOME}/drawing.py -o draw_SkewT -S ${values} -v ta,tda,pres -f ${sndorigfn} >& /dev/null 215 if test $? -ne 0; then 216 echo ${errmsg} 217 echo " python failed!!" 218 echo python ${pyHOME}/drawing.py -o draw_SkewT -S ${values} -v ta,tda,pres -f ${sndorigfn} 219 exit 220 fi 221 mv SkewT.png ${ofign} 222 echo "* "${ofign} >> ${ofilefigs} 223 echo python ${pyHOME}/drawing.py -o draw_SkewT -S ${values} -v ta,tda,pres -f ${sndorigfn} >> ${ofilefigs} 224 fi 225 226 colH=`num_hex ${col}` 227 colH2=`num_hex ${col2}` 228 if test ${it} -eq 0; then 229 sndtimes=${timev} 230 snddates=${timeS} 231 sndFdates=${timefS} 232 tatda_evol_files=${sndorigfn}':pres|-1,time|'${it}':ta,pres;' 233 tatda_evol_files=${tatda_evol_files}${sndorigfn}':pres|-1,time|'${it}':tda,pres' 234 tatda_evol_labs='ta_'${timeS2}',tda' 235 tatda_evol_cols='#'${colH}${colH2}${colH2}',#'${colH2}${colH2}${colH} 236 else 237 sndtimes=${sndtimes}','${timev} 238 snddates=${snddates}','${timeS} 239 sndFdates=${sndFdates}','${timefS} 240 tatda_evol_files=${tatda_evol_files}';'${sndorigfn}':pres|-1,time|'${it}':ta,pres' 241 tatda_evol_files=${tatda_evol_files}';'${sndorigfn}':pres|-1,time|'${it}':tda,pres' 242 if test $(expr ${it} % 2) -eq 0; then 243 tatda_evol_labs=${tatda_evol_labs}','${timeS2}',None' 244 else 245 tatda_evol_labs=${tatda_evol_labs}',None,None' 246 fi 247 tatda_evol_cols=${tatda_evol_cols}',#'${colH}${colH2}${colH2}',#'${colH2}${colH2}${colH} 248 fi 249 col=`expr ${col} - ${fraccol}` 250 col2=`expr ${col2} - ${fraccol2}` 251 252 #exit 253 254 it=`expr ${it} + 1` 255 done 256 257 # multi_sounding 258 tatda_evol_values='auto:auto:multilines!'${tatda_evol_labs}'!'${tatda_evol_cols}'!' 259 tatda_evol_values=${tatda_evol_values}'-!,!2:0,auto:!sounding!evolution!on!' 260 tatda_evol_values=${tatda_evol_values}${timeS3}'!local!time:png:True' 261 ofign=${ofigdir}'/SkewT-logP_evol.png' 262 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 263 if test ! -f ${ofign}; then 264 echo " Sounding on: "$(echo ${timeS} | tr '!' ' ') 265 python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${tatda_evol_values} -f ${tatda_evol_files} >& /dev/null 266 if test $? -ne 0; then 267 echo ${errmsg} 268 echo " python failed!!" 269 python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${tatda_evol_values} -f ${tatda_evol_files} 270 exit 271 fi 272 mv multi_SkewT.png ${ofign} 273 echo "* "${ofign} >> ${ofilefigs} 274 echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${tatda_evol_values} -f ${tatda_evol_files} >> ${ofilefigs} 275 fi 276 277 # comparison 278 cd ${wdir} 279 sndlon=`ncdump -h ${wdir}/${snddir}/${sndorigfn} | grep Station_longitude | awk '{print $3}'` 280 sndlat=`ncdump -h ${wdir}/${snddir}/${sndorigfn} | grep Station_latitude | awk '{print $3}'` 281 sndts=`echo ${sndtimes} | tr ',' ' '` 282 283 # Joining files 284 ofile0='simout_vars.nc' 285 if test ! -f ${ofile0}; then 286 values=${simdir}',Time,WRFtime' 287 HMT='wrfout,'${timeS4},'00' 288 python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} -f ${HMT} \ 289 -v ${simvars} 290 if test $? -ne 0; then 291 echo ${errmsg} 292 echo " python failed!!" 293 echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \ 294 -f ${HMT} -v ${simvars} 295 exit 296 fi 297 mv netcdf_fold_concatenated_HMT.nc ${wdir}/${ofile0} 298 fi 299 300 gridsnd=`python ${pyHOME}/nc_var.py -o get_point -f ${wdir}/${ofile0} \ 301 -S 'XLONG:XLAT:Time|0' -v ${sndlon}','${sndlat}` 302 xsnd=`echo ${gridsnd} | tr ',' ' ' | awk '{print $1}'` 303 ysnd=`echo ${gridsnd} | tr ',' ' ' | awk '{print $2}'` 304 echo "Equivalent simulated sounding grid point: "${gridsnd} 305 306 # Computing sounding diagnostics 463 ### 464 ## Preparing simulations 465 ### 466 467 # sounding diags 307 468 diagns=`echo ${wrfsnddiags} | tr ':' ' '` 308 diagd='time@time,bottom_top@P,south_north@XLAT,west_east@XLONG'469 snddiagd='time@time,bottom_top@P,south_north@XLAT,west_east@XLONG' 309 470 diagvals='' 310 471 idiag=1 … … 320 481 done 321 482 322 ofile='simout_snddiags.nc' 323 if test ! -f ${ofile}; then 324 python ${pyHOME}/diagnostics.py -f ${ofile0} -d ${diagd} -v ${diagvals} 325 if test $? -ne 0; then 326 echo ${errmsg} 327 echo " python failed!!" 328 echo python ${pyHOME}/diagnostics.py -f ${ofile0} -d ${diagd} -v ${diagvals} 329 exit 330 fi 331 mv diagnostics.nc simout_snddiags.nc 332 #To deg 333 python ${pyHOME}/nc_var.py -o valmod -S subc,273.15 -f ${ofile} -v ta 334 #To Pa 335 python ${pyHOME}/nc_var.py -o valmod -S divc,100. -f ${ofile} -v pres 336 fi 337 338 # Getting values at the sounding point 339 ofile2='simout_vars_sndpt.nc' 340 if test ! -f ${ofile2}; then 341 values='time,0,-1,1@bottom_top,0,-1,1@south_north,'${ysnd}','${ysnd}',1@' 342 values=${values}'west_east,'${xsnd}','${xsnd}',1' 343 python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${wdir}/${ofile} \ 344 -S ${values} -v all 345 if test $? -ne 0; then 346 echo ${errmsg} 347 echo " python failed!!" 348 echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${wdir}/${ofile} \ 349 -S ${values} -v all 350 exit 351 fi 352 ofilen=`ls -rt1 | tail -n 1` 353 mv ${ofilen} ${ofile2} 354 fi 355 356 # Time information from simulation 357 simdimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime, -v time -f simout_snddiags.nc\ 358 | grep dimt | awk '{print $2}'` 359 simtunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f simout_snddiags.nc | \ 360 grep -v allvattrs | grep units | awk '{print $3}'` 361 simTu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` 362 simDref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` 363 simDref=${simDref0:0:4}${simDref0:5:2}${simDref0:8:2} 364 365 # Plotting 366 complabs='$ta^{obs}$,$ta^{sim}$,$tda^{obs}$,$tda^{sim}$' 367 compcols='#FF6464,#FF6464,#6464FF,#6464FF' 368 it=0 369 for its in ${sndts}; do 370 timestep=`python ${pyHOME}/nc_var.py -o get_time -f ${wdir}/${ofile2} \ 371 -S ${its}';'${tunits} -v time` 372 if test $? -ne 0; then 373 echo ${errmsg} 374 echo " python failed!!" 375 echo python ${pyHOME}/nc_var.py -o get_time -f ${wdir}/${ofile2} \ 376 -S ${its}';'${tunits} -v time 377 fi 378 379 dateS=`echo ${snddates} | tr ',' '\n' | head -n ${it} | tail -n 1` 380 datefS=`echo ${sndFdates} | tr ',' '\n' | head -n ${it} | tail -n 1` 381 echo ${its}": it="${timestep}" "$(echo ${dateS} | tr '!' ' ')" "${datefS} 382 383 values='auto:auto:multilines!'${complabs}'!'${compcols}'!' 384 values=${values}'-,-.,-,-.!,!2:0,auto:!sounding!evolution!on!' 385 values=${values}${dateS}'!local!time:png:True' 386 387 compfiles=${wdir}/${snddir}/${sndorigfn}':pres|-1,time|'${it}':ta,pres;' 388 compfiles=${compfiles}${ofile2}':bottom_top|-1,time|'${timestep}':ta,pres;' 389 compfiles=${compfiles}${wdir}/${snddir}/${sndorigfn}':pres|-1,time|'${it}':tda,pres;' 390 compfiles=${compfiles}${ofile2}':bottom_top|-1,time|'${timestep}':tda,pres' 391 392 ofign=${ofigdir}'/SkewT-logP_obs-sim_'${datefS}'.png' 393 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 394 if test ! -f ${ofign}; then 395 echo " Sounding on: "$(echo ${dateS} | tr '!' ' ') 396 python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${values} -f ${compfiles} >& /dev/null 397 if test $? -ne 0; then 398 echo ${errmsg} 399 echo " python failed!!" 400 echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${values} -f ${compfiles} 401 exit 402 fi 403 mv multi_SkewT.png ${ofign} 404 echo "* "${ofign} >> ${ofilefigs} 405 echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${values} -f ${compfiles} >> ${ofilefigs} 406 407 fi 408 it=`expr ${it} + 1` 409 done 410 411 # Plotting snd comparison 412 413 # Soundings 414 sndvs=`echo ${sndvars} | tr ':' ' '` 415 for sndv in ${sndvs}; do 416 ofign=${ofigdir}'/SkewT-logP_obs-sim_evol_'${sndv}'.png' 417 418 cfiles='simout_vars_sndpt.nc;'${sndv}';time;pres;time|-1,pres|-1@' 419 cfiles=${cfiles}'obs/snd/UWyoming_snd_87576.nc;'${sndv}';time;pres;time|-1,pres|-1' 420 cvalues=${sndv}';y;auto|exct,12,h|%d$^{%H}$|time!($[DD]^{[HH]}$);Vfix,auto,50.,auto' 421 cvalues=${cvalues}';auto;Srange,Srange;auto;obs!&!sim!Ezeiza!airport!sounding;png;' 422 cvalues=${cvalues}'flip@y;None;yes' 423 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 424 if test ! -f ${ofign}; then 425 python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f ${cfiles} -S ${cvalues} 426 if test $? -ne 0; then 427 echo ${errmsg} 428 echo " python failed!!" 429 echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f ${cfiles} -S ${cvalues} 430 exit 431 fi 432 mv 2Dshad_obs-sim_comparison_time.png ${ofign} 433 echo "* "${ofign} >> ${ofilefigs} 434 echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f ${cfiles} -S ${cvalues} >> ${ofilefigs} 435 fi 436 done 437 438 # Plotting map comparison 439 cd $wdir 440 441 # Joining all observations 442 obssfcfile='all_single-stations.nc' 443 if test ! -f ${wdir}/${sfcobsdir}/${obssfcfile}; then 444 python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles -S \ 445 ${sfcobsdir}':OBSnetcdf' -v all 446 if test $? -ne 0; then 447 echo ${errmsg} 448 echo " python failed!!" 449 echo python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles \ 450 -S ${sfcobsdir}':OBSnetcdf' -v all 451 fi 452 mv joined_singlestations.nc ${wdir}/${sfcobsdir}/${obssfcfile} 453 fi 454 455 # Computing surface diagnostics 483 484 # surface diags 456 485 diagns=`echo ${wrfsfcdiags} | tr ':' ' '` 457 diagd='time@time,south_north@XLAT,west_east@XLONG'486 sfcdiagd='time@time,south_north@XLAT,west_east@XLONG' 458 487 diagvals='' 459 488 idiag=1 … … 478 507 done 479 508 480 osfcdiagfile='simout_sfcdiags.nc' 481 if test ! -f ${osfcdiagfile}; then 482 python ${pyHOME}/diagnostics.py -f ${ofile0} -d ${diagd} -v ${diagvals} 509 exps=`echo ${sims} | tr ':' ' '` 510 511 iexp=1 512 for exp in ${exps}; do 513 expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'` 514 expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` 515 expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` 516 expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` 517 518 # Joining files 519 simjoinselvars=${odir}'/simout_vars_'${expl}'.nc' 520 if ${fscratch}; then rm ${simjoinselvars}; fi 521 if test ! -f ${simjoinselvars}; then 522 values=${simdir}',Time,WRFtime' 523 HMT='wrfout,'${timeS4},'00' 524 python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \ 525 -f ${HMT} -v ${simvars} 526 if test $? -ne 0; then 527 echo ${errmsg} 528 echo " python failed!!" 529 echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \ 530 -f ${HMT} -v ${simvars} 531 exit 532 fi 533 mv netcdf_fold_concatenated_HMT.nc ${simjoinselvars} 534 fi 535 536 # Computing sounding diagnostics 537 simdiagsf=${odir}'/simout_snddiags_'${expl}'.nc' 538 if ${fscratch}; then rm ${simdiagsf}; fi 539 if test ! -f ${simdiagsf}; then 540 python ${pyHOME}/diagnostics.py -f ${simjoinselvars} -d ${snddiagd} -v ${diagvals} 541 if test $? -ne 0; then 542 echo ${errmsg} 543 echo " python failed!!" 544 echo python ${pyHOME}/diagnostics.py -f ${simjoinselvars} -d ${snddiagd} -v ${diagvals} 545 exit 546 fi 547 mv diagnostics.nc ${simdiagsf} 548 #To deg 549 python ${pyHOME}/nc_var.py -o valmod -S subc,273.15 -f ${simdiagsf} -v ta 550 #To Pa 551 python ${pyHOME}/nc_var.py -o valmod -S divc,100. -f ${simdiagsf} -v pres 552 fi 553 554 # Computing surface diagnostics 555 simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' 556 if ${fscratch}; then rm ${simsfcdiagf}; fi 557 if test ! -f ${simsfcdiagf}; then 558 python ${pyHOME}/diagnostics.py -f ${simjoinselvars} -d ${sfcdiagd} -v ${diagvals} 559 if test $? -ne 0; then 560 echo ${errmsg} 561 echo " python failed!!" 562 echo python ${pyHOME}/diagnostics.py -f ${simjoinselvars} -d ${sfcdiagd} -v ${diagvals} 563 exit 564 fi 565 mv diagnostics.nc ${simsfcdiagf} 566 #To rad 567 python ${pyHOME}/nc_var.py -o valmod -S mulc,0.0174532925199 -f ${simsfcdiagf} -v wds 568 python ${pyHOME}/nc_var.py -o varaddattr -S 'units|rad' -f ${simsfcdiagf} -v wds 569 fi 570 571 #Adding non-diagnostic variables 572 if test ${iadv} -ne 1; then 573 varsadd=`echo ${advs} | tr ',' ' '` 574 for vadd in ${varsadd}; do 575 python ${pyHOME}/nc_var.py -o fvaradd -S ${simjoinselvars},${vadd} -f ${simsfcdiagf} 576 if test $? -ne 0; then 577 echo ${errmsg} 578 echo " python failed!!" 579 echo python ${pyHOME}/nc_var.py -o fvaradd -S ${simjoinselvars},${vadd} -f ${simsfcdiagf} 580 exit 581 rm ${simsfcdiagf} 582 fi 583 # CF varname 584 CFvarn=`python $pyHOME/generic.py -o variables_values -S ${vadd} | tr ':' ' ' | \ 585 awk '{print $1}'` 586 if test $? -ne 0; then 587 echo ${errmsg} 588 echo " python failed!!" 589 echo python $pyHOME/generic.py -o variables_values -S ${vadd} 590 exit 591 rm ${simsfcdiagf} 592 fi 593 python $pyHOME/nc_var.py -o chvarname -S ${CFvarn} -f ${simsfcdiagf} -v ${vadd} 594 if test $? -ne 0; then 595 echo ${errmsg} 596 echo " python failed!!" 597 echo python ${pyHOME}/nc_var.py -o chvarname -S ${CFvarn} -f ${simsfcdiagf} -v ${vadd} 598 exit 599 rm ${simsfcdiagf} 600 fi 601 done 602 fi 603 604 iexp=`expr ${iexp} + 1` 605 606 # End experiments 607 done 608 609 mkdir -p ${ofigdir} 610 611 ### 612 ## Soundings figures 613 ### 614 615 # Files in sounding folder (from UWyoming_netcdf.py) 616 sndfiles=`ls -1 ${snddir}/${sndHf}*` 617 618 echo "Soundings files:"${sndfiles} 619 620 isnd=1 621 for sndf in ${sndfiles}; do 622 stid=`python $pyHOME/nc_var.py -o grattr -f ${sndf} -S Station_number` 623 624 # Getting wind components 625 ouavasndf=${odir}'/sounding_uava_'${stid}'.nc' 626 if ${fscratch}; then rm ${ouavasndf}; fi 627 if test ! -f ${ouavasndf}; then 628 python ${pyHOME}/diagnostics.py -f ${sndf} -d 'time@time,pres@pres' -v 'uavaFROMwswd|ws@wd' 629 if test $? -ne 0; then 630 echo ${errmsg} 631 echo " python failed!!" 632 echo python ${pyHOME}/diagnostics.py -f ${sndf} -d 'time@time,pres@pres' -v 'uavaFROMwswd|ws@wd' 633 exit 634 fi 635 mv diagnostics.nc ${ouavasndf} 636 fi 637 if test ${isnd} -eq 1; then sndstids=${stid}'@'${sndf} 638 else sndstids=${sndstids}':'${stid}'@'${sndf}; fi 639 isnd=`expr ${isnd} + 1` 640 done 641 642 sndids=`echo ${sndstids} | tr ':' ' '` 643 644 for stidf in ${sndids}; do 645 stid=`echo ${stidf} | tr '@' ' ' | awk '{print $1}'` 646 sndorigfn=`echo ${stidf} | tr '@' ' ' | awk '{print $2}'` 647 it=0 648 tatda_evol_values='' 649 tatda_evol_files='' 650 sndtimes='' 651 snddates='' 652 sndFdates='' 653 snddimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime -f ${sndorigfn} -v time | \ 654 grep 'dimt:' | awk '{print $2-1}'` 655 656 # Time characteristics 657 tunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${sndorigfn} | \ 658 grep -v allvattrs | grep units | awk '{print $3}'` 659 Tu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` 660 Dref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` 661 Dref=${Dref0:0:4}${Dref0:5:2}${Dref0:8:2} 662 663 # Getting values for evolution plot 664 col=`echo ${icolta} | tr ':' ' ' | awk '{print $1}'` 665 col2=`echo ${icolta} | tr ':' ' ' | awk '{print $2}'` 666 while test ${it} -le ${snddimt}; do 667 timev=`python $pyHOME/nc_var.py -o varout -S time:${it} -f ${sndorigfn} -v time | \ 668 grep NC | awk '{printf ("%d", $2)}'` 669 timeS=`date +${figsndTfmt} -d"${Dref} ${timev} ${Tu}"` 670 timeS2=`date +%d"$^{"%H"}$" -d"${Dref} ${timev} ${Tu}"` 671 timeS3=`date +%Y"-"%b -d"${Dref} ${timev} ${Tu}"` 672 timeS4=`date +%Y -d"${Dref} ${timev} ${Tu}"` 673 echo ${it}" "${timev}" "${Dref}" '"${timev}"' "${Tu}" "$(echo ${timeS} | tr '!' ' ') 674 timefS=`date +%Y%m%d%H%M%S -d"${Dref} ${timev} ${Tu}"` 675 676 infile=${snddir}'/sounding_uava_'${stid}'.nc' 677 # for now... 678 sndstn=${stid} 679 680 WindRose_plot ${it}'#'${stid}'#'${sndstn}'#'${timeS}'#'${ofigdir}'#'${timefS}'#'${infile} 681 682 SkewT_logP_plot ${it}'#'${stid}'#'${sndstn}'#'${timeS}'#'${ofigdir}'#'${timefS}'#'${sndorigfn} 683 684 colH=`num_hex ${col}` 685 colH2=`num_hex ${col2}` 686 if test ${it} -eq 0; then 687 sndtimes=${timev} 688 snddates=${timeS} 689 sndFdates=${timefS} 690 tatda_evol_files=${sndorigfn}':pres|-1,time|'${it}':ta,pres;' 691 tatda_evol_files=${tatda_evol_files}${sndorigfn}':pres|-1,time|'${it}':tda,pres' 692 tatda_evol_labs='ta_'${timeS2}',tda' 693 tatda_evol_cols='#'${colH}${colH2}${colH2}',#'${colH2}${colH2}${colH} 694 else 695 sndtimes=${sndtimes}','${timev} 696 snddates=${snddates}','${timeS} 697 sndFdates=${sndFdates}','${timefS} 698 tatda_evol_files=${tatda_evol_files}';'${sndorigfn}':pres|-1,time|'${it}':ta,pres' 699 tatda_evol_files=${tatda_evol_files}';'${sndorigfn}':pres|-1,time|'${it}':tda,pres' 700 if test $(expr ${it} % 2) -eq 0; then 701 tatda_evol_labs=${tatda_evol_labs}','${timeS2}',None' 702 else 703 tatda_evol_labs=${tatda_evol_labs}',None,None' 704 fi 705 tatda_evol_cols=${tatda_evol_cols}',#'${colH}${colH2}${colH2}',#'${colH2}${colH2}${colH} 706 fi 707 col=`expr ${col} - ${ddcol}` 708 col2=`expr ${col2} - ${ddcol}` 709 710 #exit 711 it=`expr ${it} + 1` 712 done 713 714 vals=${sndstid}'@'${sndstn}'@'${tatda_evol_labs}'@'${tatda_evol_cols}'@'${tatda_evol_files}'@'${timeS3}'@'${ofigdir} 715 multi_soundings_plot ${vals} 716 717 # End of soundings 718 done 719 720 # snd-sims comparison 721 722 for stidf in ${sndids}; do 723 stid=`echo ${stidf} | tr '@' ' ' | awk '{print $1}'` 724 sndorigfn=`echo ${stidf} | tr '@' ' ' | awk '{print $2}'` 725 echo "snd: "${stid} 726 727 sndlon=`ncdump -h ${sndorigfn} | grep Station_longitude | awk '{print $3}'` 728 sndlat=`ncdump -h ${sndorigfn} | grep Station_latitude | awk '{print $3}'` 729 sndts=`echo ${sndtimes} | tr ',' ' '` 730 731 # Time characteristics 732 tunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${sndorigfn} | \ 733 grep -v allvattrs | grep units | awk '{print $3}'` 734 Tu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` 735 Dref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` 736 Dref=${Dref0:0:4}${Dref0:5:2}${Dref0:8:2} 737 738 # Plotting 739 it=0 740 for its in ${sndts}; do 741 742 timev=`python $pyHOME/nc_var.py -o varout -S time:${it} -f ${sndorigfn} -v time | \ 743 grep NC | awk '{printf ("%d", $2)}'` 744 dateS=`date +${figsndTfmt} -d"${Dref} ${timev} ${Tu}"` 745 timeS2=`date +%d"$^{"%H"}$" -d"${Dref} ${timev} ${Tu}"` 746 timeS3=`date +%Y"-"%b -d"${Dref} ${timev} ${Tu}"` 747 timeS4=`date +%Y -d"${Dref} ${timev} ${Tu}"` 748 datefS=`date +%Y%m%d%H%M%S -d"${Dref} ${timev} ${Tu}"` 749 750 iexp=1 751 for exp in ${exps}; do 752 expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'` 753 expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` 754 expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` 755 expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` 756 757 simjoinselvars=${odir}'/simout_vars_'${expl}'.nc' 758 simdiagsf=${odir}'/simout_snddiags_'${expl}'.nc' 759 760 gridsnd=`python ${pyHOME}/nc_var.py -o get_point -f ${simjoinselvars} \ 761 -S 'XLONG:XLAT:Time|0' -v ${sndlon}','${sndlat}` 762 xsnd=`echo ${gridsnd} | tr ',' ' ' | awk '{print $1}'` 763 ysnd=`echo ${gridsnd} | tr ',' ' ' | awk '{print $2}'` 764 echo " Equivalent simulated sounding grid point: "${gridsnd} 765 766 # Getting values at the sounding point 767 simsndptf=${odir}'/simout_vars_sndpt_'${expl}'.nc' 768 if ${fscratch}; then rm ${simsndptf} >& /dev/null; fi 769 if test ! -f ${simsndptf}; then 770 values='time,0,-1,1@bottom_top,0,-1,1@south_north,'${ysnd}','${ysnd}',1@' 771 values=${values}'west_east,'${xsnd}','${xsnd}',1' 772 python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${simdiagsf} \ 773 -S ${values} -v all 774 if test $? -ne 0; then 775 echo ${errmsg} 776 echo " python failed!!" 777 echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${simdiagsf}\ 778 -S ${values} -v all 779 exit 780 fi 781 ofilen=`ls -rt1 ${odir} | tail -n 1` 782 mv ${odir}/${ofilen} ${simsndptf} 783 fi 784 785 # Time information from simulation 786 simdimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime, -v time \ 787 -f ${simdiagsf} | grep dimt | awk '{print $2}'` 788 simtunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${simdiagsf} | \ 789 grep -v allvattrs | grep units | awk '{print $3}'` 790 simTu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` 791 simDref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` 792 simDref=${simDref0:0:4}${simDref0:5:2}${simDref0:8:2} 793 794 # Time step from simulated file 795 timestep=`python ${pyHOME}/nc_var.py -o get_time -f ${simsndptf} \ 796 -S ${its}';'${tunits} -v time` 797 if test $? -ne 0; then 798 echo ${errmsg} 799 echo " python failed!!" 800 echo python ${pyHOME}/nc_var.py -o get_time -f ${simsndptf} \ 801 -S ${its}';'${tunits} -v time 802 exit 803 fi 804 805 if test ${iexp} -eq 1; then 806 echo " "${its}": it="${timestep}" "$(echo ${dateS} | tr '!' ' ')" "${datefS} 807 tacomplabs='$ta^{obs}$,$ta^{'${expn}'}$' 808 tdacomplabs='$tda^{obs}$,$tda^{'${expn}'}$' 809 tacompcols='#FF6464,'${expc} 810 tdacompcols='#6464FF,'${expc} 811 tacompltyp='-,-' 812 tdacompltyp='-,-.' 813 tacompfiles=${sndorigfn}':pres|-1,time|'${it}':ta,pres;' 814 tacompfiles=${tacompfiles}${simsndptf}':bottom_top|-1,time|'${timestep}':' 815 tacompfiles=${tacompfiles}'ta,pres' 816 tdacompfiles=${sndorigfn}':pres|-1,time|'${it}':tda,pres;' 817 tdacompfiles=${tdacompfiles}${simsndptf}':bottom_top|-1,time|'${timestep}':' 818 tdacompfiles=${tdacompfiles}'tda,pres' 819 else 820 tacomplabs=${tacomplabs}',$ta^{'${expn}'}$' 821 tdacomplabs=${tdacomplabs}',$tda^{'${expn}'}$' 822 tacompcols=${tacompcols}','${expc} 823 tdacompcols=${tdacompcols}','${expc} 824 tacompltyp=${tacompltyp}',-' 825 tdacompltyp=${tdacompltyp}',-.' 826 tacompfiles=${tacompfiles}';'${simsndptf}':bottom_top|-1,time|'${timestep}':' 827 tacompfiles=${tacompfiles}'ta,pres' 828 tdacompfiles=${tdacompfiles}';'${simsndptf}':bottom_top|-1,time|'${timestep} 829 tdacompfiles=${tdacompfiles}':tda,pres' 830 fi 831 832 # Hovmoeller maps 833 sndvs=`echo ${sndvars} | tr ':' ' '` 834 for sndv in ${sndvs}; do 835 836 CFvarvals=`python $pyHOME/generic.py -o variables_values -S ${sndv}` 837 cbar=`echo ${CFvarvals} | tr ':' ' ' | awk '{print $7}'` 838 839 fivals=${sndstid}'#'${sndstn}'#'${sndv}'#'${ofigdir}'#'${datefS}'#'${fmtTts} 840 fivals=${fivals}'#'${simsndptf}'#'${sndorigfn}'#'${expl}'#'${expn}'#'${cbar} 841 842 Homoeller_SkewT_map_plot ${fivals} 843 844 # end sounding vars 845 done 846 847 iexp=`expr ${iexp} + 1` 848 # End experiments 849 done 850 851 complabs=${tacomplabs}','${tdacomplabs} 852 compcols=${tacompcols}','${tdacompcols} 853 compltyp=${tacompltyp}','${tdacompltyp} 854 compfiles=${tacompfiles}';'${tdacompfiles} 855 856 fivals=${sndstid}'@'${sndstn}'@'${complabs}'@'${compcols}'@'${compltyp}'@' 857 fivals=${fivals}${compfiles}'@'${dateS}'@'${ofigdir}'@'${datefS}'@'${ofigdir} 858 859 multi_SkewT_logP_plot ${fivals} 860 861 it=`expr ${it} + 1` 862 # End sounding time-steps 863 done 864 865 # End of soundings stations 866 done 867 868 ### 869 ## SFC figures 870 ### 871 872 # Joining all observations 873 obssfcfile=${odir}'/all_single-stations.nc' 874 if test ! -f ${wdir}/${sfcobsdir}/${obssfcfile}; then 875 python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles -S \ 876 ${sfcobsdir}':OBSnetcdf' -v all 483 877 if test $? -ne 0; then 484 878 echo ${errmsg} 485 879 echo " python failed!!" 486 echo python ${pyHOME}/diagnostics.py -f ${ofile0} -d ${diagd} -v ${diagvals} 487 exit 488 fi 489 mv diagnostics.nc ${osfcdiagfile} 490 #To rad 491 python ${pyHOME}/nc_var.py -o valmod -S mulc,0.0174532925199 -f ${osfcdiagfile} -v wds 492 python ${pyHOME}/nc_var.py -o varaddattr -S 'units|rad' -f ${osfcdiagfile} -v wds 493 fi 494 495 #Adding non-diagnostic variables 496 if test ${iadv} -ne 1; then 497 varsadd=`echo ${advs} | tr ',' ' '` 498 for vadd in ${varsadd}; do 499 python ${pyHOME}/nc_var.py -o fvaradd -S ${ofile0},${vadd} -f ${osfcdiagfile} 500 if test $? -ne 0; then 501 echo ${errmsg} 502 echo " python failed!!" 503 echo python ${pyHOME}/nc_var.py -o fvaradd -S ${osfcdiagfile},${vadd} -f ${ofile0} 504 exit 505 rm ${osfcdiagfile} 506 fi 507 # CF varname 508 CFvarn=`python $pyHOME/generic.py -o variables_values -S ${vadd} | tr ':' ' ' | \ 509 awk '{print $1}'` 510 if test $? -ne 0; then 511 echo ${errmsg} 512 echo " python failed!!" 513 echo python $pyHOME/generic.py -o variables_values -S ${vadd} 514 exit 515 rm ${osfcdiagfile} 516 fi 517 python $pyHOME/nc_var.py -o chvarname -S ${CFvarn} -f ${osfcdiagfile} -v ${vadd} 518 if test $? -ne 0; then 519 echo ${errmsg} 520 echo " python failed!!" 521 echo python ${pyHOME}/nc_var.py -o chvarname -S ${CFvarn} -f ${osfcdiagfile} -v ${vadd} 522 exit 523 rm ${osfcdiagfile} 524 fi 525 done 880 echo python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles \ 881 -S ${sfcobsdir}':OBSnetcdf' -v all 882 fi 883 mv joined_singlestations.nc ${obssfcfile} 526 884 fi 527 885 … … 536 894 if test ${nsfc} = 'FROMobs'; then 537 895 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 538 -f ${ wdir}/${sfcobsdir}/${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}`896 -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` 539 897 nsfc=`echo ${fstats} | awk '{print $3}'` 540 898 elif test ${nsfc} = 'FROMsims'; then 541 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 542 -f ${osfcdiagfile} -v ${sfcv} | grep MAT | grep ${sfcv}` 543 nsfc=`echo ${fstats} | awk '{print $3}'` 899 iexp=1 900 for exp in ${exps}; do 901 expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` 902 simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' 903 904 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 905 -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` 906 if test ${iexp} -eq 1; then 907 nsfc=`echo ${fstats} | awk '{print $3}'` 908 else 909 nsfc2=`echo ${fstats} | awk '{print $3}'` 910 nsfcf=`echo ${nsfc}" "${nsfc2} | awk '{if ($1 < $2) {print $1;} else {print $2;}}'` 911 fi 912 done 544 913 elif test ${nsfc} = 'FROMobssims'; then 545 914 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 546 -f ${wdir}/${sfcobsdir}/${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` 547 nsfc1=`echo ${fstats} | awk '{print $3}'` 548 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 549 -f ${osfcdiagfile} -v ${sfcv} | grep MAT | grep ${sfcv}` 550 nsfc2=`echo ${fstats} | awk '{print $3}'` 551 echo ${nsfc1}" "${nsfc2} | awk '{if ($1 < $2) {print $1;} else {print $2;}}' 915 -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` 916 nsfc=`echo ${fstats} | awk '{print $3}'` 917 for exp in ${exps}; do 918 expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` 919 simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' 920 921 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 922 -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` 923 nsfc2=`echo ${fstats} | awk '{print $3}'` 924 nsfc=`echo ${nsfc}" "${nsfc2} | awk '{if ($1 < $2) {print $1;} else {print $2;}}'` 925 done 552 926 fi 553 927 if test ${xsfc} = 'FROMobs'; then 554 928 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 555 -f ${ wdir}/${sfcobsdir}/${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}`929 -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` 556 930 xsfc=`echo ${fstats} | awk '{print $4}'` 557 931 elif test ${xsfc} = 'FROMsims'; then 558 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 559 -f ${osfcdiagfile} -v ${sfcv} | grep MAT | grep ${sfcv}` 560 xsfc=`echo ${fstats} | awk '{print $4}'` 932 iexp=1 933 for exp in ${exps}; do 934 expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` 935 simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' 936 937 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 938 -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` 939 if test ${iexp} -eq 1; then 940 xsfc=`echo ${fstats} | awk '{print $4}'` 941 else 942 xsfc2=`echo ${fstats} | awk '{print $4}'` 943 xsfcf=`echo ${xsfc}" "${xsfc2} | awk '{if ($1 > $2) {print $1;} else {print $2;}}'` 944 fi 945 done 561 946 elif test ${nsfc} = 'FROMobssims'; then 562 947 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 563 -f ${wdir}/${sfcobsdir}/${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` 564 nsfc1=`echo ${fstats} | awk '{print $3}'` 565 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 566 -f ${osfcdiagfile} -v ${sfcv} | grep MAT | grep ${sfcv}` 567 nsfc2=`echo ${fstats} | awk '{print $3}'` 568 echo ${nsfc1}" "${nsfc2} | awk '{if ($1 > $2) {print $1;} else {print $2;}}' 948 -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` 949 xsfc=`echo ${fstats} | awk '{print $4}'` 950 iexp=1 951 for exp in ${exps}; do 952 expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` 953 simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' 954 955 fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ 956 -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` 957 xsfc2=`echo ${fstats} | awk '{print $4}'` 958 xsfcf=`echo ${xsfc}" "${xsfc2} | awk '{if ($1 > $2) {print $1;} else {print $2;}}'` 959 done 569 960 fi 570 961 if test $iv -eq 1; then … … 583 974 # FROM: https://stackoverflow.com/questions/2961635/using-awk-to-print-all-columns-from-the-nth-to-the-last 584 975 stsids=`python ${pyHOME}/nc_var.py -o varout -v id -f \ 585 ${wdir}/${sfcobsdir}/${obssfcfile} -S 'Nstations:-1|time:0' | \ 586 awk '{$1=""; printf("%d:",substr($0,2))}'` 976 ${obssfcfile} -S 'Nstations:-1|time:0' | awk '{$1=""; printf("%d:",substr($0,2))}'` 587 977 stsnames=`python ${pyHOME}/nc_var.py -o varout -v stsname -f \ 588 ${ wdir}/${sfcobsdir}/${obssfcfile} -S Nstations:-1| \589 awk '{$1=""; print substr($0,2)}' | tr '\n' ':' |tr ' ' '!'`978 ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':' | \ 979 tr ' ' '!'` 590 980 stslons=`python ${pyHOME}/nc_var.py -o varout -v stslon -f \ 591 ${wdir}/${sfcobsdir}/${obssfcfile} -S Nstations:-1 | \ 592 awk '{$1=""; print substr($0,2)}' | tr '\n' ':'` 981 ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':'` 593 982 stslats=`python ${pyHOME}/nc_var.py -o varout -v stslat -f \ 594 ${wdir}/${sfcobsdir}/${obssfcfile} -S Nstations:-1 | \ 595 awk '{$1=""; print substr($0,2)}' | tr '\n' ':'` 983 ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':'` 596 984 597 985 Nsts=`echo ${stsnames} | tr ':' ' ' | wc -w | awk '{print $1}'` … … 602 990 stl=`echo ${stslons} | tr ':' '\n' | head -n ${ist} | tail -n 1` 603 991 stL=`echo ${stslats} | tr ':' '\n' | head -n ${ist} | tail -n 1` 604 gridsfc=`python ${pyHOME}/nc_var.py -o get_point -f ${osfcdiagfile} \605 -S 'XLONG:XLAT:Time|0' -v ${stl}','${stL}`606 xgrid=`echo ${gridsfc} | tr ',' ' ' | awk '{print $1}'`607 ygrid=`echo ${gridsfc} | tr ',' ' ' | awk '{print $2}'`608 sfcstats=${sti}'@'${stn}'@'${stl}'@'${stL}'@'${gridsfc}609 992 ist_1=`expr ${ist} - 1` 993 994 sfccompfiles=${obssfcfile}'%time|-1;Nstations|'${ist_1} 995 sfccomplabs='obs' 996 sfccompcols='#000000' 997 998 iexp=1 999 for exp in ${exps}; do 1000 expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` 1001 expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` 1002 expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` 1003 1004 simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' 1005 1006 gridsfc=`python ${pyHOME}/nc_var.py -o get_point -f ${simsfcdiagf} \ 1007 -S 'XLONG:XLAT:Time|0' -v ${stl}','${stL}` 1008 xgrid=`echo ${gridsfc} | tr ',' ' ' | awk '{print $1}'` 1009 ygrid=`echo ${gridsfc} | tr ',' ' ' | awk '{print $2}'` 1010 1011 sfcstats=${sti}'@'${stn}'@'${stl}'@'${stL}'@'${gridsfc} 1012 1013 sfccompfiles=${sfccompfiles}','${simsfcdiagf}'%time|-1;south_north|'${ygrid}';west_east|' 1014 sfccompfiles=${sfccompfiles}${xgrid} 1015 sfccomplabs=${sfccomplabs}','${expn} 1016 sfccompcols=${sfccompcols}','${expc} 1017 done 1018 # end experiments 610 1019 611 1020 for sfcpv in ${sfcs}; do … … 614 1023 xsfc=`echo ${sfcpv} | tr '@' ' ' | awk '{print $3}'` 615 1024 616 ofign=${ofigdir}'/obs-sim_evol_'${sfcv}_${sti}'.'${kfig} 617 files=${wdir}/${sfcobsdir}/${obssfcfile}'%time|-1;Nstations|'${ist_1}',' 618 files=${files}${osfcdiagfile}'%time|-1;south_north|'${ygrid}';west_east|'${xgrid} 619 values='ststimes,time;y;time!([DD]$^{[HH]}$);auto;obs,sim;'${sfcv}';'${sfcv} 620 values=${values}'|evolution|at|'$(echo ${stn} | tr '!' '|')';'${nsfc}','${xsfc}';' 621 values=${values}'time|'${fmtTts}';0|12;' 622 values=${values}${kfig}';-;k,b;.;2.;2.;all;-1;True' 623 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 624 if test ! -f ${ofign}; then 625 python ${pyHOME}/drawing.py -o draw_lines_time -f ${files} -S ${values} -v ${sfcv} 626 if test $? -ne 0; then 627 echo ${errmsg} 628 echo " python failed!!" 629 python ${pyHOME}/drawing.py -o draw_lines_time -f ${files} -S ${values} -v ${sfcv} 630 exit 631 fi 632 mv lines_time.${kfig} ${ofign} 633 echo "* "${ofign} >> ${ofilefigs} 634 echo python ${pyHOME}/drawing.py -o draw_lines_time -f ${files} -S ${values} -v ${sfcv} >> ${ofilefigs} 635 fi 636 #exit 1025 fivals=${sti}'@'${stn}'@'${sfcv}'@'${ofigdir}'@'${fmtTts}'@'${sfccompfiles}'@' 1026 fivals=${fivals}${sfccomplabs}'@'${sfccompcols}'@'${nsfc}'@'${xsfc} 1027 1028 multiple_time_series_plot ${fivals} 1029 637 1030 done 1031 # end observations 1032 638 1033 ist=`expr $ist + 1` 639 #exit640 1034 done 641 exit 1035 # end sfc statinos 642 1036 643 1037 # Cont-disc comparison 644 it=0 645 while test ${it} -le ${simdimt}; do 646 simtstep=`python ${pyHOME}/nc_var.py -o varout -f ${wdir}/${osfcdiagfile} -S \ 647 'time:'${it} -v time | grep NC | awk '{printf ("%d",$2)}'` 648 if test $? -ne 0; then 649 echo ${errmsg} 650 echo " python failed!!" 651 echo python ${pyHOME}/nc_var.py -o varout -f ${wdir}/${osfcdiagfile} -S \ 652 'time:'${it} -v time 653 fi 654 655 timeS=`date +%Y"/"%m"/"%d"!"%H -d"${simDref} ${simtstep} ${simTu}"` 656 timeS2=`date +%d"$^{"%H"}$" -d"${simDref} ${simtstep} ${simTu}"` 657 timeS3=`date +%Y"-"%b -d"${simDref} ${simtstep} ${simTu}"` 658 timeS4=`date +%Y -d"${simDref} ${simtstep} ${simTu}"` 659 echo ${it}" "${simtstep}" "${simDref}" "${simTu}" "$(echo ${timeS} | tr '!' ' ') 660 timefS=`date +%Y%m%d%H%M%S -d"${simDref} ${simtstep} ${simTu}"` 661 662 # Looking for obs time 663 obsf=${wdir}/${sfcobsdir}/${obsfile} 664 oit=`python ${pyHOME}/nc_var.py -o get_time -f ${wdir}/${sfcobsdir}/${obssfcfile} \ 665 -S ${simtstep}';'${tunits} -v ststimes | grep -v differ` 666 667 for sfcnxv in ${sfcs}; do 668 sfcv=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $1}'` 669 nsfc=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $2}'` 670 xsfc=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $3}'` 671 672 ofign=${ofigdir}'/map_obs-sim_'${timefS}'_'${sfcv}'.png' 673 674 CFvarvals=`python $pyHOME/generic.py -o variables_values -S ${sfcv}` 675 cbar=`echo ${CFvarvals} | tr ':' ' ' | awk '{print $7}'` 676 677 cfiles=${wdir}/${osfcdiagfile}';'${sfcv}';XLONG;XLAT;Time|'${it}',time|'${it}',' 678 cfiles=${cfiles}'west_east|-1,south_north|-1@'${wdir}/${sfcobsdir}/${obssfcfile} 679 cfiles=${cfiles}';'${sfcv}';stslon;stslat;time|'${oit}',lon|-1,lat|-1' 680 cvalues=${sfcv}':west_east,south_north:auto:'${cbar}',auto,auto:'${nsfc}',' 681 cvalues=${cvalues}${xsfc}':''auto:obs!&!sim!'${sfcv}'!on!'${timeS}'!UTC:png:None:' 682 cvalues=${cvalues}${mapv}':'${mapcover}':yes' 683 684 if ${gscratch}; then rm ${ofign} >& /dev/null; fi 685 if test ! -f ${ofign}; then 686 python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f ${cfiles} -S ${cvalues} 687 if test $? -ne 0; then 688 echo ${errmsg} 689 echo " python failed!!" 690 echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f ${cfiles} -S ${cvalues} 691 fi 692 mv 2Dshad_obs-sim_comparison.png ${ofign} 693 echo "* "${ofign} >> ${ofilefigs} 694 echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f ${cfiles} -S ${cvalues} >> ${ofilefigs} 695 696 fi 697 #exit 1038 iexp=1 1039 for exp in ${exps}; do 1040 expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` 1041 expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` 1042 expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` 1043 1044 simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' 1045 1046 # Time information from simulation 1047 simdimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime, -v time -f ${simsfcdiagf} \ 1048 | grep dimt | awk '{print $2}'` 1049 simtunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${simsfcdiagf} | \ 1050 grep -v allvattrs | grep units | awk '{print $3}'` 1051 simTu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` 1052 simDref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` 1053 simDref=${simDref0:0:4}${simDref0:5:2}${simDref0:8:2} 1054 1055 it=0 1056 while test ${it} -le ${simdimt}; do 1057 simtstep=`python ${pyHOME}/nc_var.py -o varout -f ${simsfcdiagf} -S \ 1058 'time:'${it} -v time | grep NC | awk '{printf ("%d",$2)}'` 1059 if test $? -ne 0; then 1060 echo ${errmsg} 1061 echo " python failed!!" 1062 echo python ${pyHOME}/nc_var.py -o varout -f ${simsfcdiagf} -S 'time:'${it} -v time 1063 exit 1064 fi 1065 1066 timeS=`date +${figsndTfmt} -d"${simDref} ${simtstep} ${simTu}"` 1067 echo ${it}" "${simtstep}" "${simDref}" "${simTu}" "$(echo ${timeS} | tr '!' ' ') 1068 timefS=`date +%Y%m%d%H%M%S -d"${simDref} ${simtstep} ${simTu}"` 1069 1070 # Looking for obs time 1071 oit=`python ${pyHOME}/nc_var.py -o get_time -f ${obssfcfile} \ 1072 -S ${simtstep}';'${tunits} -v ststimes | grep -v differ` 1073 1074 for sfcnxv in ${sfcs}; do 1075 sfcv=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $1}'` 1076 nsfc=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $2}'` 1077 xsfc=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $3}'` 1078 1079 fivals=${expl}'#'${expn}'#'${sfcv}'#'${ofigdir}'#'${obssfcfile}'#'${simsfcdiagf} 1080 fivals=${fivals}'#'${it}'#'${oit}'#'${timeS}'#'${timefS}'#'${nsfc}'#'${xsfc}'#' 1081 fivals=${fivals}${mapv}'#'${mapcover} 1082 1083 shad_contdisc_map_plot ${fivals} 1084 1085 # end of variables 1086 done 1087 1088 it=`expr ${it} + 1` 1089 # end of time-steps 698 1090 done 699 #exit 700 it=`expr ${it} + 1` 1091 1092 # end of simulations 701 1093 done
Note: See TracChangeset
for help on using the changeset viewer.