[2024] | 1 | #!/bin/bash |
---|
[1975] | 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 | |
---|
[1983] | 8 | # Name of the file with the configuration |
---|
[1984] | 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` |
---|
[1975] | 18 | |
---|
[1984] | 19 | configfname=$1 |
---|
| 20 | |
---|
[1983] | 21 | ####### ###### ##### #### ### ## # |
---|
[1975] | 22 | |
---|
[1983] | 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' |
---|
[1975] | 28 | |
---|
[1983] | 29 | if test ! -f ${fileval}; then |
---|
| 30 | echo ${errormsg} |
---|
| 31 | echo " "${fname}": file '"${fileval}"' does not exist!!" |
---|
| 32 | exit |
---|
| 33 | fi |
---|
[1975] | 34 | |
---|
[1983] | 35 | Nlin=`wc -l ${fileval} | awk '{print $1}'` |
---|
[1975] | 36 | |
---|
[1983] | 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'` |
---|
[1975] | 43 | |
---|
[1983] | 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 | } |
---|
[1975] | 50 | |
---|
[1983] | 51 | uploadvars ${configfname} |
---|
[1984] | 52 | echo "END upload -- end UPLOAD -- END upload -- end UPLOAD" |
---|
[1975] | 53 | |
---|
[1983] | 54 | # files from scratch |
---|
[2017] | 55 | if test ${fscratch} = 'true'; then fscratch=true |
---|
[1983] | 56 | else fscratch=false; fi |
---|
[1975] | 57 | |
---|
[1983] | 58 | # figures from scratch |
---|
[2017] | 59 | if test ${gscratch} = 'true'; then gscratch=true |
---|
[1983] | 60 | else gscratch=false; fi |
---|
[1975] | 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 | |
---|
[2006] | 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}',' |
---|
[2007] | 191 | values=${values}${ysnd1}',1@west_east_stag,'${xsnd}','${xsnd1}',1:False' |
---|
[2006] | 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 | |
---|
[2007] | 215 | ofilen='newfile_multidims.nc' |
---|
[2006] | 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}',' |
---|
[2007] | 305 | values=${values}${ysnd1}',1@west_east_stag,'${xsnd}','${xsnd1}',1:False' |
---|
[2006] | 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 | |
---|
[2007] | 324 | ofilen='newfile_multidims.nc' |
---|
[2006] | 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 | |
---|
[2016] | 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} |
---|
[2006] | 381 | echo python ${pyHOME}/nc_var.py -o fvaradd -S "'"${simsfcptf},${vadd}"'" \ |
---|
[2016] | 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} \ |
---|
[2006] | 395 | -v ${vadd} |
---|
[2016] | 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 |
---|
[2006] | 406 | fi |
---|
| 407 | } |
---|
| 408 | |
---|
[2019] | 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 | |
---|
[2043] | 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 |
---|
[2019] | 553 | |
---|
[2043] | 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 | |
---|
[1983] | 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 |
---|
[1995] | 684 | # figheader: header of the figure's file name |
---|
[1975] | 685 | |
---|
[1983] | 686 | valuesfig=$1 |
---|
[1975] | 687 | |
---|
[1983] | 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}'` |
---|
[1995] | 695 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` |
---|
[1975] | 696 | |
---|
[1983] | 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' |
---|
[1995] | 700 | ofign=${ofigdir}'/'${figheader}'_'${sndstid}'_'${timefS}'.'${kfig} |
---|
[1983] | 701 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 702 | if test ! -f ${ofign}; then |
---|
[2017] | 703 | echo " Wind Rose on: "$(echo ${timeS} | tr '!' ' ') |
---|
[1983] | 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!!" |
---|
[1995] | 708 | echo python ${pyHOME}/drawing.py -o draw_WindRose -S "'"${values}"'" -v ua,va -f ${filen} |
---|
[1983] | 709 | exit |
---|
| 710 | fi |
---|
[1989] | 711 | convert -trim WindRose.png ${ofign} |
---|
[1983] | 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 | } |
---|
[1975] | 717 | |
---|
[1983] | 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 |
---|
[1995] | 727 | # figheader: header of the figure's file name |
---|
[1975] | 728 | |
---|
[1983] | 729 | valuesfig=$1 |
---|
[1975] | 730 | |
---|
[1983] | 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}'` |
---|
[1995] | 738 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` |
---|
[1983] | 739 | |
---|
| 740 | values='time|'${it}',pres|-1:auto:auto:'${sndstn}'!sounding!on!'${timeS}'!local!' |
---|
| 741 | values=${values}'time:'${kfig}':True' |
---|
[1995] | 742 | ofign=${ofigdir}'/'${figheader}'_'${sndstid}'_'${timefS}'.'${kfig} |
---|
[1983] | 743 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 744 | if test ! -f ${ofign}; then |
---|
[2017] | 745 | echo " Sounding on: "$(echo ${timeS} | tr '!' ' ') |
---|
[1983] | 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!!" |
---|
[1995] | 750 | echo python ${pyHOME}/drawing.py -o draw_SkewT -S "'"${values}"'" -v ta,tda,pres -f ${filen} |
---|
[1983] | 751 | exit |
---|
| 752 | fi |
---|
[1989] | 753 | convert -trim SkewT.png ${ofign} |
---|
[1983] | 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 |
---|
[1995] | 768 | # figheader: header of the figure's file name |
---|
[1983] | 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}'` |
---|
[1995] | 779 | figheader=`echo ${valuesfig} | tr '@' ' ' | awk '{print $8}'` |
---|
[1983] | 780 | |
---|
| 781 | tatda_evol_values='auto:auto:multilines!'${tatda_evol_labs}'!'${tatda_evol_cols}'!' |
---|
[1995] | 782 | tatda_evol_values=${tatda_evol_values}'-!,!2:0,auto:'${sndstn}'!sounding!evolution!on!' |
---|
[1983] | 783 | tatda_evol_values=${tatda_evol_values}${timeS3}'!local!time:'${kfig}':True' |
---|
| 784 | |
---|
[1995] | 785 | ofign=${ofigdir}'/'${figheader}'_'${stid}'.'${kfig} |
---|
[1975] | 786 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 787 | if test ! -f ${ofign}; then |
---|
[2017] | 788 | echo " Sounding on: "$(echo ${timeS} | tr '!' ' ') |
---|
[1983] | 789 | python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${tatda_evol_values} -f ${tatda_evol_files} >& /dev/null |
---|
[1975] | 790 | if test $? -ne 0; then |
---|
| 791 | echo ${errmsg} |
---|
| 792 | echo " python failed!!" |
---|
[1995] | 793 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${tatda_evol_values}"'" -f "'"${tatda_evol_files}"'" |
---|
[1975] | 794 | exit |
---|
| 795 | fi |
---|
[1989] | 796 | convert -trim multi_SkewT.png ${ofign} |
---|
[1975] | 797 | echo "* "${ofign} >> ${ofilefigs} |
---|
[1995] | 798 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${tatda_evol_values}"'" -f "'"${tatda_evol_files}"'" >> ${ofilefigs} |
---|
[1983] | 799 | echo " " >> ${ofilefigs} |
---|
[1975] | 800 | fi |
---|
[1983] | 801 | } |
---|
[1975] | 802 | |
---|
[1983] | 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 |
---|
[1995] | 814 | # figheader: header of the figure's file name |
---|
[1983] | 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}'` |
---|
[1995] | 826 | figheader=`echo ${valuesfig} | tr '@' ' ' | awk '{print $10}'` |
---|
[1983] | 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 | |
---|
[1995] | 832 | ofign=${ofigdir}'/'${figheader}'_'${sndstid}'_'${datefS}'.'${kfig} |
---|
[1983] | 833 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 834 | if test ! -f ${ofign}; then |
---|
[2017] | 835 | echo " Sounding on: "$(echo ${dateS} | tr '!' ' ') |
---|
[1983] | 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!!" |
---|
[1995] | 840 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${values}"'" -f "'"${compfiles}"'" |
---|
[1983] | 841 | exit |
---|
| 842 | fi |
---|
[1989] | 843 | convert -trim multi_SkewT.png ${ofign} |
---|
[1983] | 844 | echo "* "${ofign} >> ${ofilefigs} |
---|
[1995] | 845 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${values}"'" -f "'"${compfiles}"'" >> ${ofilefigs} |
---|
[1983] | 846 | echo " " >> ${ofilefigs} |
---|
| 847 | fi |
---|
| 848 | } |
---|
| 849 | |
---|
[2024] | 850 | function Hovmoeller_SkewT_map_plot() { |
---|
[1983] | 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 |
---|
[1995] | 863 | # figheader: header of the figure's file name |
---|
[1983] | 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}'` |
---|
[1995] | 877 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $12}'` |
---|
[1983] | 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 | |
---|
[1995] | 885 | ofign=${ofigdir}'/'${figheader}'_'${expl}'_'${sndstid}'_'${sndv}'.'${kfig} |
---|
[1975] | 886 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 887 | if test ! -f ${ofign}; then |
---|
[2017] | 888 | echo " Sounding comparison on : "${sndstid}" by "${expl} |
---|
[1983] | 889 | python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f ${cfiles} -S ${cvalues} |
---|
[1975] | 890 | if test $? -ne 0; then |
---|
| 891 | echo ${errmsg} |
---|
| 892 | echo " python failed!!" |
---|
[1995] | 893 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f "'"${cfiles}"'" -S "'"${cvalues}"'" |
---|
[1975] | 894 | exit |
---|
| 895 | fi |
---|
[1989] | 896 | convert -trim 2Dshad_obs-sim_comparison_time.png ${ofign} |
---|
[1975] | 897 | echo "* "${ofign} >> ${ofilefigs} |
---|
[1995] | 898 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f "'"${cfiles}"'" -S "'"${cvalues}"'" >> ${ofilefigs} |
---|
[1983] | 899 | echo " " >> ${ofilefigs} |
---|
[1975] | 900 | fi |
---|
[1983] | 901 | } |
---|
[1975] | 902 | |
---|
[1983] | 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 |
---|
[1995] | 915 | # figheader: header of the figure's file name |
---|
[1983] | 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}'` |
---|
[1995] | 928 | figheader=`echo ${valuesfig} | tr '@' ' ' | awk '{print $11}'` |
---|
[1983] | 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 | |
---|
[1995] | 938 | ofign=${ofigdir}'/'${figheader}'_'${sfcv}_${sti}'.'${kfig} |
---|
[1983] | 939 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 940 | if test ! -f ${ofign}; then |
---|
[2017] | 941 | echo " Time-Series comparison on : "${sti}" for "${sfcv} |
---|
[1983] | 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!!" |
---|
[1995] | 946 | echo python ${pyHOME}/drawing.py -o draw_lines_time -f "'"${files}"'" -S "'"${values}"'" -v ${sfcv} |
---|
[1983] | 947 | exit |
---|
| 948 | fi |
---|
[1989] | 949 | convert -trim lines_time.${kfig} ${ofign} |
---|
[1983] | 950 | echo "* "${ofign} >> ${ofilefigs} |
---|
[1995] | 951 | echo python ${pyHOME}/drawing.py -o draw_lines_time -f "'"${files}"'" -S "'"${values}"'" -v ${sfcv} >> ${ofilefigs} |
---|
[1983] | 952 | echo " "${ofign} >> ${ofilefigs} |
---|
[1975] | 953 | fi |
---|
[1983] | 954 | } |
---|
[1975] | 955 | |
---|
[1983] | 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 |
---|
[1995] | 972 | # figheader: header of the figure's file name |
---|
[1975] | 973 | |
---|
[1983] | 974 | valuesfig=$1 |
---|
[1975] | 975 | |
---|
[1983] | 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}'` |
---|
[1995] | 990 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $15}'` |
---|
[1975] | 991 | |
---|
[1983] | 992 | CFvarvals=`python $pyHOME/generic.py -o variables_values -S ${sfcv}` |
---|
| 993 | cbar=`echo ${CFvarvals} | tr ':' ' ' | awk '{print $7}'` |
---|
[1975] | 994 | |
---|
[1983] | 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 | |
---|
[1995] | 1002 | ofign=${ofigdir}'/'${figheader}'_'${timefS}'_'${sfcv}'_'${expl}'.'${kfig} |
---|
[1983] | 1003 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 1004 | if test ! -f ${ofign}; then |
---|
[2017] | 1005 | echo " Map comparison on : "$(echo ${timeS} | tr '!' ' ')" by "${expl}" for "${sfcv} |
---|
[1983] | 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!!" |
---|
[1995] | 1010 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f "'"${cfiles}"'" -S "'"${cvalues}"'" |
---|
[1983] | 1011 | fi |
---|
[1989] | 1012 | convert -trim 2Dshad_obs-sim_comparison.png ${ofign} |
---|
[1983] | 1013 | echo "* "${ofign} >> ${ofilefigs} |
---|
[1995] | 1014 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f "'"${cfiles}"'" -S "'"${cvalues}"'" >> ${ofilefigs} |
---|
[1983] | 1015 | echo " " >> ${ofilefigs} |
---|
| 1016 | fi |
---|
| 1017 | } |
---|
| 1018 | |
---|
[2024] | 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 | |
---|
[2033] | 1043 | Nfiles=`echo ${labs} | tr ',' ' ' | wc -w | awk '{print $1-1}'` |
---|
[2032] | 1044 | frqm='1' |
---|
| 1045 | iff=1 |
---|
[2033] | 1046 | while test ${iff} -le ${Nfiles}; do frqm=${frqm}'@10'; iff=`expr ${iff} + 1`; done |
---|
[2032] | 1047 | |
---|
[2033] | 1048 | values='linepoint;multicol;pres;-;'${lmark}';'${frqm}';spectral;auto:'${labs}':' |
---|
[2024] | 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}"'" \ |
---|
[2031] | 1067 | -S "'"${values}"'" >> ${ofilefigs} |
---|
[2032] | 1068 | echo " " >> ${ofilefigs} |
---|
[2024] | 1069 | fi |
---|
| 1070 | } |
---|
| 1071 | |
---|
[1983] | 1072 | ####### ####### |
---|
| 1073 | ## MAIN |
---|
| 1074 | ####### |
---|
| 1075 | |
---|
| 1076 | mkdir -p ${odir} |
---|
[2006] | 1077 | ofileins=${wdir}/allins_functions.inf |
---|
[1983] | 1078 | ofilefigs=${wdir}/allins_figures.inf |
---|
| 1079 | if ${fscratch}; then |
---|
[2006] | 1080 | echo "*** Instruction from all functions _______" > ${ofileins} |
---|
| 1081 | echo " " >> ${ofileins} |
---|
[2016] | 1082 | fi |
---|
| 1083 | if ${gscratch}; then |
---|
[2006] | 1084 | echo "*** Instruction from all figures _______" > ${ofilefigs} |
---|
| 1085 | echo " " >> ${ofilefigs} |
---|
[1975] | 1086 | fi |
---|
| 1087 | |
---|
[2006] | 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 | |
---|
[1983] | 1113 | ### |
---|
| 1114 | ## Preparing simulations |
---|
| 1115 | ### |
---|
[1975] | 1116 | |
---|
[2006] | 1117 | # sounding data |
---|
[2012] | 1118 | iost=1 |
---|
| 1119 | obstype='sounding' |
---|
| 1120 | prn='snd' |
---|
[2024] | 1121 | if test ! ${sndHf} = 'None'; then |
---|
| 1122 | listfiles=${sndfiles} |
---|
| 1123 | else |
---|
| 1124 | listfiles=' ' |
---|
| 1125 | fi |
---|
[2012] | 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}'` |
---|
[2006] | 1133 | |
---|
[2012] | 1134 | if test ${iost} -eq 1; then |
---|
| 1135 | oststids=${stid}'@'${ostf} |
---|
| 1136 | echo ${prn}","${stid}","${ostlon}","${ostlat}","${ostheight} > ${wdir}/stations.inf |
---|
[2006] | 1137 | else |
---|
[2012] | 1138 | oststids=${oststids}':'${stid}'@'${ostf} |
---|
| 1139 | echo ${prn}","${stid}","${ostlon}","${ostlat}","${ostheight} >> ${wdir}/stations.inf |
---|
[2006] | 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}'` |
---|
[2024] | 1148 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
[2006] | 1149 | |
---|
| 1150 | simfiles=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT}` |
---|
| 1151 | |
---|
[2024] | 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}'` |
---|
[2006] | 1159 | |
---|
[2024] | 1160 | simsndptf=${odir}'/simout_vars_'${prn}'pt_'${stid}'_'${expl}'_'${fdate}'.nc' |
---|
| 1161 | simsnddiagsf=${odir}'/simout_'${prn}'diags_'${stid}'_'${expl}'_'${fdate}'.nc' |
---|
[2006] | 1162 | |
---|
[2024] | 1163 | fvals=${ostlon}'#'${ostlat}'#'${simf}'#XLONG#XLAT#'${wrfdiags}'#' |
---|
| 1164 | fvals=${fvals}${simdiagd} |
---|
| 1165 | get_WRFsounding_data ${fvals} |
---|
[2006] | 1166 | |
---|
[2024] | 1167 | # end of files |
---|
| 1168 | done |
---|
[2006] | 1169 | |
---|
[2024] | 1170 | # Concatenating files |
---|
| 1171 | Nconfc=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc | wc -l | \ |
---|
| 1172 | awk '{print $1}'` |
---|
[2006] | 1173 | if test ${Nconfc} -gt 1; then |
---|
| 1174 | values=${odir}',Time,time' |
---|
[2012] | 1175 | HMT='simout_'${prn}'diags_,'${stid}'_'${expn},'nc' |
---|
[2006] | 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 |
---|
[2012] | 1185 | echo " * Concatenating "${obstype}" data at point: "${ostlon}", "${ostlat} >> ${ofileins} |
---|
[2006] | 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 |
---|
[2012] | 1191 | ffilen=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc` |
---|
[2006] | 1192 | cp ${ffilen} ${ofile} |
---|
| 1193 | fi |
---|
| 1194 | fi |
---|
[2007] | 1195 | iexp=`expr ${iexp} + 1` |
---|
[2006] | 1196 | # end of experiments |
---|
| 1197 | done |
---|
| 1198 | |
---|
[2012] | 1199 | iost=`expr ${iost} + 1` |
---|
[2006] | 1200 | done |
---|
[2024] | 1201 | if test ! ${sndHf} = 'None'; then sndstids=${oststids}; fi |
---|
[2013] | 1202 | |
---|
[2019] | 1203 | # surface data at station |
---|
[2013] | 1204 | iost=1 |
---|
| 1205 | obstype='surface' |
---|
| 1206 | prn='sfc' |
---|
[2024] | 1207 | if test ! ${sfcHf} = 'None'; then |
---|
| 1208 | listfiles=${sndfiles} |
---|
| 1209 | else |
---|
| 1210 | listfiles=' ' |
---|
| 1211 | fi |
---|
[2013] | 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 | |
---|
[2016] | 1224 | if test ! ${wdir}/stations.inf; then |
---|
[2013] | 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}'` |
---|
[2024] | 1238 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
[2013] | 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 |
---|
[2024] | 1290 | if test ! ${sfcHf} = 'None'; then sfcstids=${oststids}; fi |
---|
[2013] | 1291 | |
---|
[2019] | 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}'` |
---|
[2024] | 1305 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
[2019] | 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 | |
---|
[2016] | 1354 | ### |
---|
| 1355 | ## |
---|
| 1356 | # Figures |
---|
| 1357 | ## |
---|
| 1358 | ### |
---|
[2006] | 1359 | |
---|
[2016] | 1360 | mkdir -p ${ofigdir} |
---|
[1975] | 1361 | |
---|
[2016] | 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 |
---|
[1975] | 1373 | echo ${errmsg} |
---|
[2016] | 1374 | echo " python failed!!" |
---|
| 1375 | echo python ${pyHOME}/drawing.py -o draw_stations_map -f ${wdir}/stations.inf \ |
---|
| 1376 | -S "'"${fivals}"'" |
---|
| 1377 | exit |
---|
[1975] | 1378 | fi |
---|
[2016] | 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} |
---|
[1984] | 1384 | fi |
---|
[1975] | 1385 | |
---|
[1983] | 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 |
---|
[2033] | 1398 | python ${pyHOME}/diagnostics.py -f ${sndf} -d 'time@time,pres@pres' \ |
---|
| 1399 | -v 'uavaFROMobswswd|ws@wd' |
---|
[1975] | 1400 | if test $? -ne 0; then |
---|
| 1401 | echo ${errmsg} |
---|
| 1402 | echo " python failed!!" |
---|
[2033] | 1403 | echo python ${pyHOME}/diagnostics.py -f ${sndf} -d 'time@time,pres@pres' \ |
---|
| 1404 | -v 'uavaFROMobswswd|ws@wd' |
---|
[1975] | 1405 | exit |
---|
[2017] | 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"'" \ |
---|
[2033] | 1409 | -v "'"uavaFROMobswswd|ws@wd"'" >> ${ofileins} |
---|
[2017] | 1410 | echo " " >> ${ofileins} |
---|
[1983] | 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}'` |
---|
[1989] | 1420 | echo ${stid}" ..." |
---|
[1983] | 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}"` |
---|
[1989] | 1447 | echo " "${it}" "${timev}" "${Dref}" '"${timev}"' "${Tu}" "$(echo ${timeS} | tr '!' ' ') |
---|
[1983] | 1448 | timefS=`date +%Y%m%d%H%M%S -d"${Dref} ${timev} ${Tu}"` |
---|
| 1449 | |
---|
[2062] | 1450 | sndstn=`python $pyHOME/nc_var.py -o grattr -f ${sndorigfn} -S Station_name | \ |
---|
| 1451 | tr ' ' '!'` |
---|
[1983] | 1452 | |
---|
[1995] | 1453 | fivals=${it}'#'${stid}'#'${sndstn}'#'${timeS}'#'${ofigdir}'#'${timefS}'#' |
---|
[2034] | 1454 | fivals=${fivals}${ouavasndf}'#WindRose_obs' |
---|
[1995] | 1455 | WindRose_plot ${fivals} |
---|
[1983] | 1456 | |
---|
[1995] | 1457 | fivals=${it}'#'${stid}'#'${sndstn}'#'${timeS}'#'${ofigdir}'#'${timefS}'#' |
---|
| 1458 | fivals=${fivals}${sndorigfn}'#SkewT-logP_obs_ta-tda' |
---|
| 1459 | SkewT_logP_plot ${fivals} |
---|
[1983] | 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} |
---|
[1975] | 1483 | fi |
---|
[1983] | 1484 | col=`expr ${col} - ${ddcol}` |
---|
| 1485 | col2=`expr ${col2} - ${ddcol}` |
---|
| 1486 | |
---|
| 1487 | it=`expr ${it} + 1` |
---|
[1975] | 1488 | done |
---|
[1983] | 1489 | |
---|
[1995] | 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} |
---|
[1983] | 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 ',' ' '` |
---|
[2062] | 1507 | sndstn=`python $pyHOME/nc_var.py -o grattr -f ${sndorigfn} -S Station_name | \ |
---|
| 1508 | tr ' ' '!'` |
---|
[1983] | 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 | |
---|
[1989] | 1517 | obsdimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime, -v time -f ${sndorigfn} | \ |
---|
| 1518 | grep dimt | awk '{print $2-1}'` |
---|
| 1519 | |
---|
[1983] | 1520 | # Plotting |
---|
| 1521 | it=0 |
---|
[1989] | 1522 | while test ${it} -le ${obsdimt}; do |
---|
[1983] | 1523 | |
---|
[1989] | 1524 | otimev=`python $pyHOME/nc_var.py -o varout -S time:${it} -f ${sndorigfn} -v time |\ |
---|
[1983] | 1525 | grep NC | awk '{printf ("%d", $2)}'` |
---|
[1989] | 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}"` |
---|
[1983] | 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}'` |
---|
[2024] | 1538 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
[1983] | 1539 | |
---|
[2017] | 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' |
---|
[1983] | 1546 | |
---|
[1989] | 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 |
---|
[1983] | 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 |
---|
[1989] | 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}'` |
---|
[2017] | 1572 | timestepdiff=`echo ${timestepv} | tr '@' ' ' | awk '{print $2}'` |
---|
[1983] | 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} \ |
---|
[1989] | 1577 | -S ${otimev}';'${tunits} -v time |
---|
[1983] | 1578 | exit |
---|
| 1579 | fi |
---|
| 1580 | |
---|
| 1581 | if test ${iexp} -eq 1; then |
---|
[1989] | 1582 | echo " "${it}": it="${timestep}" "$(echo ${dateS} | tr '!' ' ')" "${datefS} |
---|
[1983] | 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;' |
---|
[2024] | 1590 | tacompfiles=${tacompfiles}${simsndptf}':bottom_top|-1,Time|'${timestep}':' |
---|
[1983] | 1591 | tacompfiles=${tacompfiles}'ta,pres' |
---|
| 1592 | tdacompfiles=${sndorigfn}':pres|-1,time|'${it}':tda,pres;' |
---|
[2024] | 1593 | tdacompfiles=${tdacompfiles}${simsndptf}':bottom_top|-1,Time|'${timestep}':' |
---|
[1983] | 1594 | tdacompfiles=${tdacompfiles}'tda,pres' |
---|
[2024] | 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` |
---|
[2031] | 1601 | nsimpres=`echo ${fstats} | awk '{printf ("%d",$3)}'` |
---|
[2024] | 1602 | fi |
---|
| 1603 | |
---|
| 1604 | obsuavaf=${odir}/sounding_uava_${stid}.nc |
---|
| 1605 | obspres=`python $pyHOME/nc_var.py -o varout -f ${obsuavaf} -S time:${it} \ |
---|
[2028] | 1606 | -v pres | awk '{print $2}' | tr '\n' ':'` |
---|
[2031] | 1607 | Lobspres1=`expr length ${obspres} | awk '{print $1-1}'` |
---|
| 1608 | vals=${obspres:0:${Lobspres1}}',threshold,:,'${nsimpres} |
---|
[2028] | 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 |
---|
[2031] | 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} |
---|
[2024] | 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} |
---|
[1983] | 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}',-.' |
---|
[2024] | 1632 | tacompfiles=${tacompfiles}';'${simsndptf}':bottom_top|-1,Time|'${timestep}':' |
---|
[1983] | 1633 | tacompfiles=${tacompfiles}'ta,pres' |
---|
[2024] | 1634 | tdacompfiles=${tdacompfiles}';'${simsndptf}':bottom_top|-1,Time|'${timestep} |
---|
[1983] | 1635 | tdacompfiles=${tdacompfiles}':tda,pres' |
---|
[2024] | 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} |
---|
[1983] | 1641 | fi |
---|
| 1642 | |
---|
[2024] | 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}'` |
---|
[1983] | 1650 | |
---|
[2024] | 1651 | fivals=${stid}'#'${sndstn}'#'${sndv}'#'${ofigdir}'#'${datefS}'#'${fmtTts} |
---|
| 1652 | fivals=${fivals}'#'${simsndptf}'#'${sndorigfn}'#'${expl}'#'${expn}'#'${cbar} |
---|
| 1653 | fivals=${fivals}'#SkewT-logP_obs-sim_evol' |
---|
[1983] | 1654 | |
---|
[2024] | 1655 | Hovmoeller_SkewT_map_plot ${fivals} |
---|
[1983] | 1656 | |
---|
[2024] | 1657 | # end sounding vars |
---|
| 1658 | done |
---|
| 1659 | fi |
---|
[1983] | 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 | |
---|
[1989] | 1670 | fivals=${stid}'@'${sndstn}'@'${complabs}'@'${compcols}'@'${compltyp}'@' |
---|
[2024] | 1671 | fivals=${fivals}${compfiles}'@'${dateS}'@'${ofigdir}'@'${datefS}'@' |
---|
[1995] | 1672 | fivals=${fivals}'SkewT-logP_obs-sim_step' |
---|
[1983] | 1673 | multi_SkewT_logP_plot ${fivals} |
---|
| 1674 | |
---|
[1995] | 1675 | # Wind Rose comparison |
---|
[2024] | 1676 | fivals=${stid}'%'${sndstn}'%'${ofigdir}'%'${mWRcompfiles}'%'${mWRcomplabs}'%' |
---|
| 1677 | fivals=${fivals}${mWRmarks}'%'${dateS}'%'${datefS}'%WindRose_obs-sim_step' |
---|
| 1678 | |
---|
[1995] | 1679 | multi_WindRose_plot ${fivals} |
---|
| 1680 | |
---|
[1983] | 1681 | it=`expr ${it} + 1` |
---|
| 1682 | # End sounding time-steps |
---|
| 1683 | done |
---|
| 1684 | |
---|
| 1685 | # End of soundings stations |
---|
| 1686 | done |
---|
[2062] | 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 | |
---|
[2024] | 1706 | exit |
---|
[1983] | 1707 | |
---|
| 1708 | ### |
---|
| 1709 | ## SFC figures |
---|
| 1710 | ### |
---|
| 1711 | |
---|
| 1712 | # Joining all observations |
---|
| 1713 | obssfcfile=${odir}'/all_single-stations.nc' |
---|
[2019] | 1714 | if test ! -f ${obssfcfile}; then |
---|
[1983] | 1715 | python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles -S \ |
---|
[2006] | 1716 | ${sfcdir}':OBSnetcdf' -v all |
---|
[1983] | 1717 | if test $? -ne 0; then |
---|
| 1718 | echo ${errmsg} |
---|
| 1719 | echo " python failed!!" |
---|
| 1720 | echo python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles \ |
---|
[2006] | 1721 | -S ${sfcdir}':OBSnetcdf' -v all |
---|
[1983] | 1722 | fi |
---|
[2020] | 1723 | echo " * Joining all surface station files : " >> ${ofileins} |
---|
| 1724 | echo python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles -S \ |
---|
[2062] | 1725 | ${sfcdir}':OBSnetcdf' -v all >> ${ofileins} |
---|
[2020] | 1726 | echo " " >> ${ofileins} |
---|
[1983] | 1727 | mv joined_singlestations.nc ${obssfcfile} |
---|
[1975] | 1728 | fi |
---|
| 1729 | |
---|
[1984] | 1730 | # getting min,max values |
---|
| 1731 | if test ${sfcvars} != 'None'; then |
---|
| 1732 | fcs=`echo ${sfcvars} | tr ':' ' '` |
---|
[1975] | 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 \ |
---|
[1983] | 1741 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
[1975] | 1742 | nsfc=`echo ${fstats} | awk '{print $3}'` |
---|
| 1743 | elif test ${nsfc} = 'FROMsims'; then |
---|
[1983] | 1744 | iexp=1 |
---|
| 1745 | for exp in ${exps}; do |
---|
| 1746 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
[2020] | 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 |
---|
[1983] | 1760 | done |
---|
| 1761 | elif test ${nsfc} = 'FROMobssims'; then |
---|
[1975] | 1762 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
[1983] | 1763 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
[1975] | 1764 | nsfc=`echo ${fstats} | awk '{print $3}'` |
---|
[1983] | 1765 | for exp in ${exps}; do |
---|
| 1766 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
[2020] | 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 |
---|
[1983] | 1775 | done |
---|
[1975] | 1776 | fi |
---|
| 1777 | if test ${xsfc} = 'FROMobs'; then |
---|
| 1778 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
[1983] | 1779 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
[1975] | 1780 | xsfc=`echo ${fstats} | awk '{print $4}'` |
---|
| 1781 | elif test ${xsfc} = 'FROMsims'; then |
---|
[1983] | 1782 | iexp=1 |
---|
| 1783 | for exp in ${exps}; do |
---|
[2020] | 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' |
---|
[1983] | 1788 | |
---|
[2020] | 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 |
---|
[1983] | 1799 | done |
---|
| 1800 | elif test ${nsfc} = 'FROMobssims'; then |
---|
[1975] | 1801 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
[1983] | 1802 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
[1975] | 1803 | xsfc=`echo ${fstats} | awk '{print $4}'` |
---|
[1983] | 1804 | iexp=1 |
---|
| 1805 | for exp in ${exps}; do |
---|
| 1806 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
[2020] | 1807 | for stidf in ${sndids}; do |
---|
| 1808 | stid=`echo ${stidf} | tr '@' ' ' | awk '{print $1}'` |
---|
| 1809 | simsfcdiagf=${odir}'/simout_sfcvars_'${stdi}'_'${expl}'.nc' |
---|
[1983] | 1810 | |
---|
[2020] | 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 |
---|
[1983] | 1816 | done |
---|
[1975] | 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 \ |
---|
[1983] | 1833 | ${obssfcfile} -S 'Nstations:-1|time:0' | awk '{$1=""; printf("%d:",substr($0,2))}'` |
---|
[1975] | 1834 | stsnames=`python ${pyHOME}/nc_var.py -o varout -v stsname -f \ |
---|
[1983] | 1835 | ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':' | \ |
---|
| 1836 | tr ' ' '!'` |
---|
[1975] | 1837 | stslons=`python ${pyHOME}/nc_var.py -o varout -v stslon -f \ |
---|
[1983] | 1838 | ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':'` |
---|
[1975] | 1839 | stslats=`python ${pyHOME}/nc_var.py -o varout -v stslat -f \ |
---|
[1983] | 1840 | ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':'` |
---|
[1975] | 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 | |
---|
[1983] | 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}'` |
---|
[2024] | 1860 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
[1983] | 1861 | |
---|
[2020] | 1862 | simsfcdiagf=${odir}'/simout_sfcvars_'${stdi}'_'${expl}'.nc' |
---|
[1983] | 1863 | |
---|
| 1864 | sfcstats=${sti}'@'${stn}'@'${stl}'@'${stL}'@'${gridsfc} |
---|
| 1865 | |
---|
[2020] | 1866 | sfccompfiles=${sfccompfiles}','${simsfcdiagf}'%time|-1' |
---|
[1983] | 1867 | sfccomplabs=${sfccomplabs}','${expn} |
---|
| 1868 | sfccompcols=${sfccompcols}','${expc} |
---|
| 1869 | done |
---|
| 1870 | # end experiments |
---|
| 1871 | |
---|
[1975] | 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 | |
---|
[1983] | 1877 | fivals=${sti}'@'${stn}'@'${sfcv}'@'${ofigdir}'@'${fmtTts}'@'${sfccompfiles}'@' |
---|
| 1878 | fivals=${fivals}${sfccomplabs}'@'${sfccompcols}'@'${nsfc}'@'${xsfc} |
---|
[1995] | 1879 | fivals=${fivals}'@obs-sim_evol_ts' |
---|
[1983] | 1880 | |
---|
| 1881 | multiple_time_series_plot ${fivals} |
---|
[2020] | 1882 | exit |
---|
[1983] | 1883 | |
---|
[1975] | 1884 | done |
---|
[1983] | 1885 | # end observations |
---|
| 1886 | |
---|
[1975] | 1887 | ist=`expr $ist + 1` |
---|
| 1888 | done |
---|
[1983] | 1889 | # end sfc statinos |
---|
[1975] | 1890 | |
---|
| 1891 | # Cont-disc comparison |
---|
[1983] | 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}'` |
---|
[2024] | 1897 | expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'` |
---|
[1975] | 1898 | |
---|
[2020] | 1899 | simsfcdiagf=${odir}'/simout_sfcmapdiags_'${expl}'.nc' |
---|
[1975] | 1900 | |
---|
[1983] | 1901 | # Time information from simulation |
---|
| 1902 | simdimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime, -v time -f ${simsfcdiagf} \ |
---|
[1995] | 1903 | | grep dimt | awk '{print $2-1}'` |
---|
[1983] | 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} |
---|
[1975] | 1909 | |
---|
[1983] | 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 |
---|
[1975] | 1920 | |
---|
[1983] | 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}"` |
---|
[1975] | 1924 | |
---|
[1983] | 1925 | # Looking for obs time |
---|
[1989] | 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}'` |
---|
[1975] | 1929 | |
---|
[1983] | 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}'` |
---|
[1975] | 1934 | |
---|
[1983] | 1935 | fivals=${expl}'#'${expn}'#'${sfcv}'#'${ofigdir}'#'${obssfcfile}'#'${simsfcdiagf} |
---|
| 1936 | fivals=${fivals}'#'${it}'#'${oit}'#'${timeS}'#'${timefS}'#'${nsfc}'#'${xsfc}'#' |
---|
[1995] | 1937 | fivals=${fivals}${mapv}'#'${mapcover}'#map_obs-sim' |
---|
[1975] | 1938 | |
---|
[1983] | 1939 | shad_contdisc_map_plot ${fivals} |
---|
| 1940 | |
---|
| 1941 | # end of variables |
---|
| 1942 | done |
---|
| 1943 | |
---|
| 1944 | it=`expr ${it} + 1` |
---|
| 1945 | # end of time-steps |
---|
[1975] | 1946 | done |
---|
[1983] | 1947 | |
---|
| 1948 | # end of simulations |
---|
[1975] | 1949 | done |
---|
[1984] | 1950 | fi |
---|
| 1951 | |
---|
| 1952 | fi |
---|