[2016] | 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 | |
---|
[1983] | 409 | function WindRose_plot() { |
---|
| 410 | # Function to plot a Wind rose |
---|
| 411 | # it: time-step to use from the file |
---|
| 412 | # sndstid: id of the sounding station |
---|
| 413 | # sndstn: name of the sounding station to appear in plot ('!' for spaces) |
---|
| 414 | # timeS: String with the format of the actual time ('!' for spaces) |
---|
| 415 | # ofigdir: folder for the output of the figure |
---|
| 416 | # timefS: date of the plot to be used for the figure name |
---|
| 417 | # filen: file to use |
---|
[1995] | 418 | # figheader: header of the figure's file name |
---|
[1975] | 419 | |
---|
[1983] | 420 | valuesfig=$1 |
---|
[1975] | 421 | |
---|
[1983] | 422 | it=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` |
---|
| 423 | sndstid=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` |
---|
| 424 | sndstn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` |
---|
| 425 | timeS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` |
---|
| 426 | ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` |
---|
| 427 | timefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` |
---|
| 428 | filen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` |
---|
[1995] | 429 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` |
---|
[1975] | 430 | |
---|
[1983] | 431 | values='pres|-1;time|'${it}':linepoint;multicol;pres;auto;auto;rainbow;auto:' |
---|
| 432 | values=${values}${sndstn}'!sounding!WindRose!on!'${timeS}'!local!time:'${kfig} |
---|
| 433 | values=${values}':cardinals:False:WindRose:True' |
---|
[1995] | 434 | ofign=${ofigdir}'/'${figheader}'_'${sndstid}'_'${timefS}'.'${kfig} |
---|
[1983] | 435 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 436 | if test ! -f ${ofign}; then |
---|
[2017] | 437 | echo " Wind Rose on: "$(echo ${timeS} | tr '!' ' ') |
---|
[1983] | 438 | python ${pyHOME}/drawing.py -o draw_WindRose -S ${values} -v ua,va -f ${filen} >& /dev/null |
---|
| 439 | if test $? -ne 0; then |
---|
| 440 | echo ${errmsg} |
---|
| 441 | echo " python failed!!" |
---|
[1995] | 442 | echo python ${pyHOME}/drawing.py -o draw_WindRose -S "'"${values}"'" -v ua,va -f ${filen} |
---|
[1983] | 443 | exit |
---|
| 444 | fi |
---|
[1989] | 445 | convert -trim WindRose.png ${ofign} |
---|
[1983] | 446 | echo "* "${ofign} >> ${ofilefigs} |
---|
| 447 | echo python ${pyHOME}/drawing.py -o draw_WindRose -S "'"${values}"'" -v ua,va -f "'"${filen}"'" >> ${ofilefigs} |
---|
| 448 | echo " " >> ${ofilefigs} |
---|
| 449 | fi |
---|
| 450 | } |
---|
[1975] | 451 | |
---|
[1983] | 452 | function SkewT_logP_plot() { |
---|
| 453 | # Function to plot a SkewT_logP plot |
---|
| 454 | # it: time step to use from file |
---|
| 455 | # sndstid: id of the sounding station |
---|
| 456 | # sndstn: name of the sounding station to appear in plot ('!' for spaces) |
---|
| 457 | # timeS: String with the format of the actual time ('!' for spaces) |
---|
| 458 | # ofigdir: folder for the output of the figure |
---|
| 459 | # timefS: date of the plot to be used for the figure name |
---|
| 460 | # filen: file to use |
---|
[1995] | 461 | # figheader: header of the figure's file name |
---|
[1975] | 462 | |
---|
[1983] | 463 | valuesfig=$1 |
---|
[1975] | 464 | |
---|
[1983] | 465 | it=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` |
---|
| 466 | sndstid=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` |
---|
| 467 | sndstn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` |
---|
| 468 | timeS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` |
---|
| 469 | ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` |
---|
| 470 | timefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` |
---|
| 471 | filen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` |
---|
[1995] | 472 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` |
---|
[1983] | 473 | |
---|
| 474 | values='time|'${it}',pres|-1:auto:auto:'${sndstn}'!sounding!on!'${timeS}'!local!' |
---|
| 475 | values=${values}'time:'${kfig}':True' |
---|
[1995] | 476 | ofign=${ofigdir}'/'${figheader}'_'${sndstid}'_'${timefS}'.'${kfig} |
---|
[1983] | 477 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 478 | if test ! -f ${ofign}; then |
---|
[2017] | 479 | echo " Sounding on: "$(echo ${timeS} | tr '!' ' ') |
---|
[1983] | 480 | python ${pyHOME}/drawing.py -o draw_SkewT -S ${values} -v ta,tda,pres -f ${filen} >& /dev/null |
---|
| 481 | if test $? -ne 0; then |
---|
| 482 | echo ${errmsg} |
---|
| 483 | echo " python failed!!" |
---|
[1995] | 484 | echo python ${pyHOME}/drawing.py -o draw_SkewT -S "'"${values}"'" -v ta,tda,pres -f ${filen} |
---|
[1983] | 485 | exit |
---|
| 486 | fi |
---|
[1989] | 487 | convert -trim SkewT.png ${ofign} |
---|
[1983] | 488 | echo "* "${ofign} >> ${ofilefigs} |
---|
| 489 | echo python ${pyHOME}/drawing.py -o draw_SkewT -S "'"${values}"'" -v ta,tda,pres -f "'"${filen}"'" >> ${ofilefigs} |
---|
| 490 | echo " " >> ${ofilefigs} |
---|
| 491 | fi |
---|
| 492 | } |
---|
| 493 | |
---|
| 494 | function multi_soundings_plot() { |
---|
| 495 | # Function to plot a multi_sounding figure |
---|
| 496 | # sndstid: id of the sounding station |
---|
| 497 | # sndstn: name of the sounding station to appear in plot ('!' for spaces) |
---|
| 498 | # tatda_evol_labs: labels for the figure |
---|
| 499 | # tatda_evol_cols: colors of the lines for the figure |
---|
| 500 | # timeS3: date in the figure |
---|
| 501 | # ofigdir: folder for the output figure |
---|
[1995] | 502 | # figheader: header of the figure's file name |
---|
[1983] | 503 | |
---|
| 504 | valuesfig=$1 |
---|
| 505 | |
---|
| 506 | sndstid=`echo ${valuesfig} | tr '@' ' ' | awk '{print $1}'` |
---|
| 507 | sndstn=`echo ${valuesfig} | tr '@' ' ' | awk '{print $2}'` |
---|
| 508 | tatda_evol_labs=`echo ${valuesfig} | tr '@' ' ' | awk '{print $3}'` |
---|
| 509 | tatda_evol_cols=`echo ${valuesfig} | tr '@' ' ' | awk '{print $4}'` |
---|
| 510 | tatda_evol_files=`echo ${valuesfig} | tr '@' ' ' | awk '{print $5}'` |
---|
| 511 | timeS3=`echo ${valuesfig} | tr '@' ' ' | awk '{print $6}'` |
---|
| 512 | ofigdir=`echo ${valuesfig} | tr '@' ' ' | awk '{print $7}'` |
---|
[1995] | 513 | figheader=`echo ${valuesfig} | tr '@' ' ' | awk '{print $8}'` |
---|
[1983] | 514 | |
---|
| 515 | tatda_evol_values='auto:auto:multilines!'${tatda_evol_labs}'!'${tatda_evol_cols}'!' |
---|
[1995] | 516 | tatda_evol_values=${tatda_evol_values}'-!,!2:0,auto:'${sndstn}'!sounding!evolution!on!' |
---|
[1983] | 517 | tatda_evol_values=${tatda_evol_values}${timeS3}'!local!time:'${kfig}':True' |
---|
| 518 | |
---|
[1995] | 519 | ofign=${ofigdir}'/'${figheader}'_'${stid}'.'${kfig} |
---|
[1975] | 520 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 521 | if test ! -f ${ofign}; then |
---|
[2017] | 522 | echo " Sounding on: "$(echo ${timeS} | tr '!' ' ') |
---|
[1983] | 523 | python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${tatda_evol_values} -f ${tatda_evol_files} >& /dev/null |
---|
[1975] | 524 | if test $? -ne 0; then |
---|
| 525 | echo ${errmsg} |
---|
| 526 | echo " python failed!!" |
---|
[1995] | 527 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${tatda_evol_values}"'" -f "'"${tatda_evol_files}"'" |
---|
[1975] | 528 | exit |
---|
| 529 | fi |
---|
[1989] | 530 | convert -trim multi_SkewT.png ${ofign} |
---|
[1975] | 531 | echo "* "${ofign} >> ${ofilefigs} |
---|
[1995] | 532 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${tatda_evol_values}"'" -f "'"${tatda_evol_files}"'" >> ${ofilefigs} |
---|
[1983] | 533 | echo " " >> ${ofilefigs} |
---|
[1975] | 534 | fi |
---|
[1983] | 535 | } |
---|
[1975] | 536 | |
---|
[1983] | 537 | function multi_SkewT_logP_plot() { |
---|
| 538 | # Function to plot a multi_SkewT_logP plot with multiple lines |
---|
| 539 | # sndstid: id of the sounding station |
---|
| 540 | # sndstn: name of the sounding station to appear in plot ('!' for spaces) |
---|
| 541 | # complabs: labels for the plot |
---|
| 542 | # compcols: colors for the plot |
---|
| 543 | # complines: type of lines for the plot |
---|
| 544 | # compfiles: files to use for the plot |
---|
| 545 | # dateS: String with the format of the actual time ('!' for spaces) |
---|
| 546 | # ofigdir: folder for the output of the figure |
---|
| 547 | # datefS: date of the plot to be used for the figure name |
---|
[1995] | 548 | # figheader: header of the figure's file name |
---|
[1983] | 549 | |
---|
| 550 | valuesfig=$1 |
---|
| 551 | sndstid=`echo ${valuesfig} | tr '@' ' ' | awk '{print $1}'` |
---|
| 552 | sndstn=`echo ${valuesfig} | tr '@' ' ' | awk '{print $2}'` |
---|
| 553 | complabs=`echo ${valuesfig} | tr '@' ' ' | awk '{print $3}'` |
---|
| 554 | compcols=`echo ${valuesfig} | tr '@' ' ' | awk '{print $4}'` |
---|
| 555 | complines=`echo ${valuesfig} | tr '@' ' ' | awk '{print $5}'` |
---|
| 556 | compfiles=`echo ${valuesfig} | tr '@' ' ' | awk '{print $6}'` |
---|
| 557 | dateS=`echo ${valuesfig} | tr '@' ' ' | awk '{print $7}'` |
---|
| 558 | ofigdir=`echo ${valuesfig} | tr '@' ' ' | awk '{print $8}'` |
---|
| 559 | datefS=`echo ${valuesfig} | tr '@' ' ' | awk '{print $9}'` |
---|
[1995] | 560 | figheader=`echo ${valuesfig} | tr '@' ' ' | awk '{print $10}'` |
---|
[1983] | 561 | |
---|
| 562 | values='auto:auto:multilines!'${complabs}'!'${compcols}'!' |
---|
| 563 | values=${values}${complines}'!,!2:0,auto:'${ststn}'!sounding!obs!,!sim!' |
---|
| 564 | values=${values}'comparison!on!'${dateS}'!UTC:png:True' |
---|
| 565 | |
---|
[1995] | 566 | ofign=${ofigdir}'/'${figheader}'_'${sndstid}'_'${datefS}'.'${kfig} |
---|
[1983] | 567 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 568 | if test ! -f ${ofign}; then |
---|
[2017] | 569 | echo " Sounding on: "$(echo ${dateS} | tr '!' ' ') |
---|
[1983] | 570 | python ${pyHOME}/drawing.py -o draw_multi_SkewT -S ${values} -f ${compfiles} >& /dev/null |
---|
| 571 | if test $? -ne 0; then |
---|
| 572 | echo ${errmsg} |
---|
| 573 | echo " python failed!!" |
---|
[1995] | 574 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${values}"'" -f "'"${compfiles}"'" |
---|
[1983] | 575 | exit |
---|
| 576 | fi |
---|
[1989] | 577 | convert -trim multi_SkewT.png ${ofign} |
---|
[1983] | 578 | echo "* "${ofign} >> ${ofilefigs} |
---|
[1995] | 579 | echo python ${pyHOME}/drawing.py -o draw_multi_SkewT -S "'"${values}"'" -f "'"${compfiles}"'" >> ${ofilefigs} |
---|
[1983] | 580 | echo " " >> ${ofilefigs} |
---|
| 581 | fi |
---|
| 582 | } |
---|
| 583 | |
---|
| 584 | function Homoeller_SkewT_map_plot() { |
---|
| 585 | # Function to plot a Hovmoeller SkewT_map |
---|
| 586 | # sndstid: id of the sounding station |
---|
| 587 | # sndstn: name of the sounding station to appear in plot ('!' for spaces) |
---|
| 588 | # sndv: variable to plot |
---|
| 589 | # ofigdir: folder for the output of the figure |
---|
| 590 | # datefS: date of the plot to be used for the figure name |
---|
| 591 | # timevals: values to use for the time-axis in the plot |
---|
| 592 | # simfilen: name of the simulation file at the given point |
---|
| 593 | # sndfilen: name of the sounding file |
---|
| 594 | # expl: label of the experiment |
---|
| 595 | # expn: name of the experiment |
---|
| 596 | # cbar: color bar |
---|
[1995] | 597 | # figheader: header of the figure's file name |
---|
[1983] | 598 | |
---|
| 599 | valuesfig=$1 |
---|
| 600 | sndstid=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` |
---|
| 601 | sndstn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` |
---|
| 602 | sndv=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` |
---|
| 603 | ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` |
---|
| 604 | datefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` |
---|
| 605 | timevals=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` |
---|
| 606 | simfilen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` |
---|
| 607 | sndfilen=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` |
---|
| 608 | expl=`echo ${valuesfig} | tr '#' ' ' | awk '{print $9}'` |
---|
| 609 | expn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $10}'` |
---|
| 610 | cbar=`echo ${valuesfig} | tr '#' ' ' | awk '{print $11}'` |
---|
[1995] | 611 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $12}'` |
---|
[1983] | 612 | |
---|
| 613 | cfiles=${simfilen}';'${sndv}';time;pres;time|-1,pres|-1@' |
---|
| 614 | cfiles=${cfiles}${sndfilen}';'${sndv}';time;pres;time|-1,pres|-1' |
---|
| 615 | cvalues=${sndv}';y;auto|'${timevals}';Vfix,auto,50.,auto' |
---|
| 616 | cvalues=${cvalues}';'${cbar}',auto,auto;Srange,Srange;auto;obs!,!'${expn}'!' |
---|
| 617 | cvalues=${cvalues}${sndstn}'!sounding;'${kfig}';flip@y;None;yes' |
---|
| 618 | |
---|
[1995] | 619 | ofign=${ofigdir}'/'${figheader}'_'${expl}'_'${sndstid}'_'${sndv}'.'${kfig} |
---|
[1975] | 620 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 621 | if test ! -f ${ofign}; then |
---|
[2017] | 622 | echo " Sounding comparison on : "${sndstid}" by "${expl} |
---|
[1983] | 623 | python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f ${cfiles} -S ${cvalues} |
---|
[1975] | 624 | if test $? -ne 0; then |
---|
| 625 | echo ${errmsg} |
---|
| 626 | echo " python failed!!" |
---|
[1995] | 627 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f "'"${cfiles}"'" -S "'"${cvalues}"'" |
---|
[1975] | 628 | exit |
---|
| 629 | fi |
---|
[1989] | 630 | convert -trim 2Dshad_obs-sim_comparison_time.png ${ofign} |
---|
[1975] | 631 | echo "* "${ofign} >> ${ofilefigs} |
---|
[1995] | 632 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc_time -f "'"${cfiles}"'" -S "'"${cvalues}"'" >> ${ofilefigs} |
---|
[1983] | 633 | echo " " >> ${ofilefigs} |
---|
[1975] | 634 | fi |
---|
[1983] | 635 | } |
---|
[1975] | 636 | |
---|
[1983] | 637 | function multiple_time_series_plot(){ |
---|
| 638 | # Function to plot multiple time-series |
---|
| 639 | # sti: id of the surface station |
---|
| 640 | # stn: name of the surface station to appear in plot ('!' for spaces) |
---|
| 641 | # sfcv: name of variable to plot |
---|
| 642 | # ofigdir: folder for the output of the figure |
---|
| 643 | # timevals: values of the time-axis to use |
---|
| 644 | # files: files to use |
---|
| 645 | # labs: labels of the legend |
---|
| 646 | # lcol: color of lines to use |
---|
| 647 | # nsfc: minimum value to plot |
---|
| 648 | # xsfc: maximum value to plot |
---|
[1995] | 649 | # figheader: header of the figure's file name |
---|
[1983] | 650 | |
---|
| 651 | valuesfig=$1 |
---|
| 652 | stid=`echo ${valuesfig} | tr '@' ' ' | awk '{print $1}'` |
---|
| 653 | stn=`echo ${valuesfig} | tr '@' ' ' | awk '{print $2}'` |
---|
| 654 | sfcv=`echo ${valuesfig} | tr '@' ' ' | awk '{print $3}'` |
---|
| 655 | ofigdir=`echo ${valuesfig} | tr '@' ' ' | awk '{print $4}'` |
---|
| 656 | timevals=`echo ${valuesfig} | tr '@' ' ' | awk '{print $5}'` |
---|
| 657 | files=`echo ${valuesfig} | tr '@' ' ' | awk '{print $6}'` |
---|
| 658 | labs=`echo ${valuesfig} | tr '@' ' ' | awk '{print $7}'` |
---|
| 659 | lcol=`echo ${valuesfig} | tr '@' ' ' | awk '{print $8}'` |
---|
| 660 | nsfc=`echo ${valuesfig} | tr '@' ' ' | awk '{print $9}'` |
---|
| 661 | xsfc=`echo ${valuesfig} | tr '@' ' ' | awk '{print $10}'` |
---|
[1995] | 662 | figheader=`echo ${valuesfig} | tr '@' ' ' | awk '{print $11}'` |
---|
[1983] | 663 | |
---|
| 664 | timen=`echo ${timevals} | tr '|' ' ' | awk '{print $3}'` |
---|
| 665 | fmtT=`echo ${timevals} | tr '|' ' ' | awk '{print $1"|"$2}'` |
---|
| 666 | |
---|
| 667 | values='ststimes,time;y;'${timen}';auto;'${labs}';'${sfcv}';'${sfcv} |
---|
| 668 | values=${values}'|evolution|at|'$(echo ${stn} | tr '!' '|')';'${nsfc}','${xsfc}';' |
---|
| 669 | values=${values}'time|'${fmtT}';0|12;' |
---|
| 670 | values=${values}${kfig}';-;'${lcol}';.;2.;2.;all;-1;True' |
---|
| 671 | |
---|
[1995] | 672 | ofign=${ofigdir}'/'${figheader}'_'${sfcv}_${sti}'.'${kfig} |
---|
[1983] | 673 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 674 | if test ! -f ${ofign}; then |
---|
[2017] | 675 | echo " Time-Series comparison on : "${sti}" for "${sfcv} |
---|
[1983] | 676 | python ${pyHOME}/drawing.py -o draw_lines_time -f ${files} -S ${values} -v ${sfcv} |
---|
| 677 | if test $? -ne 0; then |
---|
| 678 | echo ${errmsg} |
---|
| 679 | echo " python failed!!" |
---|
[1995] | 680 | echo python ${pyHOME}/drawing.py -o draw_lines_time -f "'"${files}"'" -S "'"${values}"'" -v ${sfcv} |
---|
[1983] | 681 | exit |
---|
| 682 | fi |
---|
[1989] | 683 | convert -trim lines_time.${kfig} ${ofign} |
---|
[1983] | 684 | echo "* "${ofign} >> ${ofilefigs} |
---|
[1995] | 685 | echo python ${pyHOME}/drawing.py -o draw_lines_time -f "'"${files}"'" -S "'"${values}"'" -v ${sfcv} >> ${ofilefigs} |
---|
[1983] | 686 | echo " "${ofign} >> ${ofilefigs} |
---|
[1975] | 687 | fi |
---|
[1983] | 688 | } |
---|
[1975] | 689 | |
---|
[1983] | 690 | function shad_contdisc_map_plot(){ |
---|
| 691 | # Function to plot a map of a continuos and a discontinuos variable |
---|
| 692 | # expl: label of the experiment |
---|
| 693 | # expn: name of the experiment in the title of the plot |
---|
| 694 | # sfcv: name of variable to plot |
---|
| 695 | # ofigdir: folder for the output of the figure |
---|
| 696 | # obsfiles: observtional file to use |
---|
| 697 | # simfile: simulation file to use |
---|
| 698 | # it: time-step from simulation |
---|
| 699 | # oit: time-step from observations |
---|
| 700 | # timeS: format of time to appear in the title |
---|
| 701 | # timefS: format of time to be used for the file name |
---|
| 702 | # nsfc: minimum value to plot |
---|
| 703 | # xsfc: maximum value to plot |
---|
| 704 | # mapv: map values |
---|
| 705 | # mapcover: cover of the map |
---|
[1995] | 706 | # figheader: header of the figure's file name |
---|
[1975] | 707 | |
---|
[1983] | 708 | valuesfig=$1 |
---|
[1975] | 709 | |
---|
[1983] | 710 | expl=`echo ${valuesfig} | tr '#' ' ' | awk '{print $1}'` |
---|
| 711 | expn=`echo ${valuesfig} | tr '#' ' ' | awk '{print $2}'` |
---|
| 712 | sfcv=`echo ${valuesfig} | tr '#' ' ' | awk '{print $3}'` |
---|
| 713 | ofigdir=`echo ${valuesfig} | tr '#' ' ' | awk '{print $4}'` |
---|
| 714 | obsfile=`echo ${valuesfig} | tr '#' ' ' | awk '{print $5}'` |
---|
| 715 | simfile=`echo ${valuesfig} | tr '#' ' ' | awk '{print $6}'` |
---|
| 716 | it=`echo ${valuesfig} | tr '#' ' ' | awk '{print $7}'` |
---|
| 717 | oit=`echo ${valuesfig} | tr '#' ' ' | awk '{print $8}'` |
---|
| 718 | timeS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $9}'` |
---|
| 719 | timefS=`echo ${valuesfig} | tr '#' ' ' | awk '{print $10}'` |
---|
| 720 | nsfc=`echo ${valuesfig} | tr '#' ' ' | awk '{print $11}'` |
---|
| 721 | xsfc=`echo ${valuesfig} | tr '#' ' ' | awk '{print $12}'` |
---|
| 722 | mapv=`echo ${valuesfig} | tr '#' ' ' | awk '{print $13}'` |
---|
| 723 | mapcover=`echo ${valuesfig} | tr '#' ' ' | awk '{print $14}'` |
---|
[1995] | 724 | figheader=`echo ${valuesfig} | tr '#' ' ' | awk '{print $15}'` |
---|
[1975] | 725 | |
---|
[1983] | 726 | CFvarvals=`python $pyHOME/generic.py -o variables_values -S ${sfcv}` |
---|
| 727 | cbar=`echo ${CFvarvals} | tr ':' ' ' | awk '{print $7}'` |
---|
[1975] | 728 | |
---|
[1983] | 729 | cfiles=${simfile}';'${sfcv}';XLONG;XLAT;Time|'${it}',time|'${it}',' |
---|
| 730 | cfiles=${cfiles}'west_east|-1,south_north|-1@'${obsfile}';'${sfcv} |
---|
| 731 | cfiles=${cfiles}';stslon;stslat;time|'${oit}',lon|-1,lat|-1' |
---|
| 732 | cvalues=${sfcv}':west_east,south_north:auto:'${cbar}',auto,auto:'${nsfc}',' |
---|
| 733 | cvalues=${cvalues}${xsfc}':''auto:obs!,!'${expn}'!'${sfcv}'!on!'${timeS}'!UTC:' |
---|
| 734 | cvalues=${cvalues}${kfig}':None:'${mapv}':'${mapcover}':yes' |
---|
| 735 | |
---|
[1995] | 736 | ofign=${ofigdir}'/'${figheader}'_'${timefS}'_'${sfcv}'_'${expl}'.'${kfig} |
---|
[1983] | 737 | if ${gscratch}; then rm ${ofign} >& /dev/null; fi |
---|
| 738 | if test ! -f ${ofign}; then |
---|
[2017] | 739 | echo " Map comparison on : "$(echo ${timeS} | tr '!' ' ')" by "${expl}" for "${sfcv} |
---|
[1983] | 740 | python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f ${cfiles} -S ${cvalues} |
---|
| 741 | if test $? -ne 0; then |
---|
| 742 | echo ${errmsg} |
---|
| 743 | echo " python failed!!" |
---|
[1995] | 744 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f "'"${cfiles}"'" -S "'"${cvalues}"'" |
---|
[1983] | 745 | fi |
---|
[1989] | 746 | convert -trim 2Dshad_obs-sim_comparison.png ${ofign} |
---|
[1983] | 747 | echo "* "${ofign} >> ${ofilefigs} |
---|
[1995] | 748 | echo python ${pyHOME}/drawing.py -o draw_2D_shad_contdisc -f "'"${cfiles}"'" -S "'"${cvalues}"'" >> ${ofilefigs} |
---|
[1983] | 749 | echo " " >> ${ofilefigs} |
---|
| 750 | fi |
---|
| 751 | } |
---|
| 752 | |
---|
| 753 | ####### ####### |
---|
| 754 | ## MAIN |
---|
| 755 | ####### |
---|
| 756 | |
---|
| 757 | mkdir -p ${odir} |
---|
[2006] | 758 | ofileins=${wdir}/allins_functions.inf |
---|
[1983] | 759 | ofilefigs=${wdir}/allins_figures.inf |
---|
| 760 | if ${fscratch}; then |
---|
[2006] | 761 | echo "*** Instruction from all functions _______" > ${ofileins} |
---|
| 762 | echo " " >> ${ofileins} |
---|
[2016] | 763 | fi |
---|
| 764 | if ${gscratch}; then |
---|
[2006] | 765 | echo "*** Instruction from all figures _______" > ${ofilefigs} |
---|
| 766 | echo " " >> ${ofilefigs} |
---|
[1975] | 767 | fi |
---|
| 768 | |
---|
[2006] | 769 | # Files in sounding folder (from UWyoming_netcdf.py) |
---|
| 770 | if test ! ${sndHf} = 'None'; then |
---|
| 771 | sndfs=`ls -1 ${snddir}/${sndHf}* | tr '\n' ':'` |
---|
| 772 | echo "Soundings files _______" |
---|
| 773 | echo ${sndfs} | tr ':' '\n' |
---|
| 774 | sndfiles=`echo ${sndfs} | tr ':' ' '` |
---|
| 775 | else |
---|
| 776 | sndfiles='None' |
---|
| 777 | fi |
---|
| 778 | |
---|
| 779 | # Files in sounding folder (from UWyoming_netcdf.py) |
---|
| 780 | if test ! ${sfcHf} = 'None'; then |
---|
| 781 | sfcfs=`ls -1 ${sfcdir}/${sfcHf}** | tr '\n' ':'` |
---|
| 782 | echo "Surface files _______" |
---|
| 783 | echo ${sfcfs} | tr ':' '\n' |
---|
| 784 | sfcfiles=`echo ${sfcfs} | tr ':' ' '` |
---|
| 785 | else |
---|
| 786 | sfcfiles='None' |
---|
| 787 | fi |
---|
| 788 | |
---|
| 789 | exps=`echo ${sims} | tr ':' ' '` |
---|
| 790 | simH=`echo ${simHMT} | tr ',' ' ' | awk '{print $1}'` |
---|
| 791 | simM=`echo ${simHMT} | tr ',' ' ' | awk '{print $2}'` |
---|
| 792 | simT=`echo ${simHMT} | tr ',' ' ' | awk '{print $3}'` |
---|
| 793 | |
---|
[1983] | 794 | ### |
---|
| 795 | ## Preparing simulations |
---|
| 796 | ### |
---|
[1975] | 797 | |
---|
[2006] | 798 | # sounding data |
---|
[2012] | 799 | iost=1 |
---|
| 800 | obstype='sounding' |
---|
| 801 | prn='snd' |
---|
| 802 | listfiles=${sndfiles} |
---|
| 803 | wrfdiags=${wrfsnddiags} |
---|
| 804 | simdiagd=${simsnddiagd} |
---|
| 805 | for ostf in ${listfiles}; do |
---|
| 806 | stid=`python $pyHOME/nc_var.py -o grattr -f ${ostf} -S Station_number` |
---|
| 807 | ostlon=`ncdump -h ${ostf} | grep Station_longitude | awk '{print $3}'` |
---|
| 808 | ostlat=`ncdump -h ${ostf} | grep Station_latitude | awk '{print $3}'` |
---|
| 809 | ostheight=`ncdump -h ${ostf} | grep Station_elevation | awk '{print $3}'` |
---|
[2006] | 810 | |
---|
[2012] | 811 | if test ${iost} -eq 1; then |
---|
| 812 | oststids=${stid}'@'${ostf} |
---|
| 813 | echo ${prn}","${stid}","${ostlon}","${ostlat}","${ostheight} > ${wdir}/stations.inf |
---|
[2006] | 814 | else |
---|
[2012] | 815 | oststids=${oststids}':'${stid}'@'${ostf} |
---|
| 816 | echo ${prn}","${stid}","${ostlon}","${ostlat}","${ostheight} >> ${wdir}/stations.inf |
---|
[2006] | 817 | fi |
---|
| 818 | |
---|
| 819 | iexp=1 |
---|
| 820 | for exp in ${exps}; do |
---|
| 821 | expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'` |
---|
| 822 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
| 823 | expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` |
---|
| 824 | expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` |
---|
| 825 | |
---|
| 826 | simfiles=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT}` |
---|
| 827 | |
---|
| 828 | for simf in ${simfiles}; do |
---|
| 829 | simfn=`basename ${simf}` |
---|
| 830 | fdate=`echo ${simfn} | tr '.' ' ' | awk '{print $1}' | tr '_' ' ' | \ |
---|
| 831 | awk '{print $3"_"$4}'` |
---|
| 832 | |
---|
[2013] | 833 | simsndptf=${odir}'/simout_vars_'${prn}'pt_'${stid}'_'${expl}'_'${fdate}'.nc' |
---|
| 834 | simsnddiagsf=${odir}'/simout_'${prn}'diags_'${stid}'_'${expl}'_'${fdate}'.nc' |
---|
[2006] | 835 | |
---|
[2012] | 836 | fvals=${ostlon}'#'${ostlat}'#'${simf}'#XLONG#XLAT#'${wrfdiags}'#' |
---|
| 837 | fvals=${fvals}${simdiagd} |
---|
[2006] | 838 | get_WRFsounding_data ${fvals} |
---|
| 839 | |
---|
| 840 | # end of files |
---|
| 841 | done |
---|
| 842 | |
---|
| 843 | # Concatenating files |
---|
[2012] | 844 | ofile=${odir}/simout_${prn}vars_${stid}_${expl}.nc |
---|
[2006] | 845 | if ${fscratch}; then rm ${ofile} >& /dev/null; fi |
---|
| 846 | if test ! -f ${ofile}; then |
---|
[2012] | 847 | Nconfc=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc | wc -l | awk '{print $1}'` |
---|
[2006] | 848 | if test ${Nconfc} -gt 1; then |
---|
| 849 | values=${odir}',Time,time' |
---|
[2012] | 850 | HMT='simout_'${prn}'diags_,'${stid}'_'${expn},'nc' |
---|
[2006] | 851 | python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \ |
---|
| 852 | -f ${HMT} -v all |
---|
| 853 | if test $? -ne 0; then |
---|
| 854 | echo ${errmsg} |
---|
| 855 | echo " python failed!!" |
---|
| 856 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}\ |
---|
| 857 | -f ${HMT} -v all |
---|
| 858 | exit |
---|
| 859 | fi |
---|
[2012] | 860 | echo " * Concatenating "${obstype}" data at point: "${ostlon}", "${ostlat} >> ${ofileins} |
---|
[2006] | 861 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S \ |
---|
| 862 | "'"${values}"'" -f ${HMT} -v all >> ${ofileins} |
---|
| 863 | echo " " >> ${ofileins} |
---|
| 864 | mv netcdf_fold_concatenated_HMT.nc ${ofile} |
---|
| 865 | else |
---|
[2012] | 866 | ffilen=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc` |
---|
[2006] | 867 | cp ${ffilen} ${ofile} |
---|
| 868 | fi |
---|
| 869 | fi |
---|
[2007] | 870 | iexp=`expr ${iexp} + 1` |
---|
[2006] | 871 | # end of experiments |
---|
| 872 | done |
---|
| 873 | |
---|
[2012] | 874 | iost=`expr ${iost} + 1` |
---|
[2006] | 875 | done |
---|
[2017] | 876 | sndstids=${oststids} |
---|
[2013] | 877 | |
---|
| 878 | # surface data |
---|
| 879 | iost=1 |
---|
| 880 | obstype='surface' |
---|
| 881 | prn='sfc' |
---|
| 882 | listfiles=${sfcfiles} |
---|
| 883 | wrfdiags=${wrfsfcdiags} |
---|
| 884 | simdiagd=${simsfcdiagd} |
---|
| 885 | for ostf in ${listfiles}; do |
---|
| 886 | |
---|
| 887 | stid=`python $pyHOME/nc_var.py -o varout -f ${ostf} -S 'time:0' -v id | grep NC \ |
---|
| 888 | | awk '{printf("%d",$2)}'` |
---|
| 889 | ostlon=`python $pyHOME/nc_var.py -o varout -f ${ostf} -S 'time:0' -v lon | grep NC \ |
---|
| 890 | | awk '{print $2}'` |
---|
| 891 | ostlat=`python $pyHOME/nc_var.py -o varout -f ${ostf} -S 'time:0' -v lat | grep NC \ |
---|
| 892 | | awk '{print $2}'` |
---|
| 893 | ostheight=`python $pyHOME/nc_var.py -o varout -f ${ostf} -S 'time:0' -v height | \ |
---|
| 894 | grep NC | awk '{print $2}'` |
---|
| 895 | |
---|
[2016] | 896 | if test ! ${wdir}/stations.inf; then |
---|
[2013] | 897 | oststids=${stid}'@'${ostf} |
---|
| 898 | echo ${prn}","${stid}","${ostlon}","${ostlat}","${ostheight} > ${wdir}/stations.inf |
---|
| 899 | else |
---|
| 900 | oststids=${oststids}':'${stid}'@'${ostf} |
---|
| 901 | echo ${prn}","${stid}","${ostlon}","${ostlat}","${ostheight} >> ${wdir}/stations.inf |
---|
| 902 | fi |
---|
| 903 | |
---|
| 904 | iexp=1 |
---|
| 905 | for exp in ${exps}; do |
---|
| 906 | expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'` |
---|
| 907 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
| 908 | expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` |
---|
| 909 | expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` |
---|
| 910 | |
---|
| 911 | simfiles=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT}` |
---|
| 912 | |
---|
| 913 | for simf in ${simfiles}; do |
---|
| 914 | simfn=`basename ${simf}` |
---|
| 915 | fdate=`echo ${simfn} | tr '.' ' ' | awk '{print $1}' | tr '_' ' ' | \ |
---|
| 916 | awk '{print $3"_"$4}'` |
---|
| 917 | |
---|
| 918 | simsfcptf=${odir}'/simout_vars_'${prn}'pt_'${stid}'_'${expl}'_'${fdate}'.nc' |
---|
| 919 | simsfcdiagsf=${odir}'/simout_'${prn}'diags_'${stid}'_'${expl}'_'${fdate}'.nc' |
---|
| 920 | |
---|
| 921 | fvals=${ostlon}'#'${ostlat}'#'${simf}'#XLONG#XLAT#'${wrfdiags}'#' |
---|
| 922 | fvals=${fvals}${wrfsfcnondiags}'#'${simdiagd} |
---|
| 923 | get_WRFsurface_data ${fvals} |
---|
| 924 | |
---|
| 925 | # end of files |
---|
| 926 | done |
---|
| 927 | |
---|
| 928 | # Concatenating files |
---|
| 929 | ofile=${odir}/simout_${prn}vars_${stid}_${expl}.nc |
---|
| 930 | if ${fscratch}; then rm ${ofile} >& /dev/null; fi |
---|
| 931 | if test ! -f ${ofile}; then |
---|
| 932 | Nconfc=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc | wc -l | awk '{print $1}'` |
---|
| 933 | if test ${Nconfc} -gt 1; then |
---|
| 934 | values=${odir}',Time,time' |
---|
| 935 | HMT='simout_'${prn}'diags_,'${stid}'_'${expn},'nc' |
---|
| 936 | python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \ |
---|
| 937 | -f ${HMT} -v all |
---|
| 938 | if test $? -ne 0; then |
---|
| 939 | echo ${errmsg} |
---|
| 940 | echo " python failed!!" |
---|
| 941 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}\ |
---|
| 942 | -f ${HMT} -v all |
---|
| 943 | exit |
---|
| 944 | fi |
---|
| 945 | echo " * Concatenating "${obstype}" data at point: "${ostlon}", "${ostlat} >> ${ofileins} |
---|
| 946 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S \ |
---|
| 947 | "'"${values}"'" -f ${HMT} -v all >> ${ofileins} |
---|
| 948 | echo " " >> ${ofileins} |
---|
| 949 | mv netcdf_fold_concatenated_HMT.nc ${ofile} |
---|
| 950 | else |
---|
| 951 | ffilen=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc` |
---|
| 952 | cp ${ffilen} ${ofile} |
---|
| 953 | fi |
---|
| 954 | fi |
---|
| 955 | iexp=`expr ${iexp} + 1` |
---|
| 956 | # end of experiments |
---|
| 957 | done |
---|
| 958 | |
---|
| 959 | iost=`expr ${iost} + 1` |
---|
| 960 | done |
---|
[2017] | 961 | sfcstids=${oststids} |
---|
[2013] | 962 | |
---|
[2016] | 963 | ### |
---|
| 964 | ## |
---|
| 965 | # Figures |
---|
| 966 | ## |
---|
| 967 | ### |
---|
[2006] | 968 | |
---|
[2016] | 969 | mkdir -p ${ofigdir} |
---|
[1975] | 970 | |
---|
[2016] | 971 | ## |
---|
| 972 | # Stations maps |
---|
| 973 | ## |
---|
| 974 | ofig=${ofigdir}/stations.png |
---|
| 975 | if ${gscratch}; then rm ${ofig} >& /dev/null; fi |
---|
| 976 | if test ! -f ${ofig}; then |
---|
| 977 | fivals=${mapstchar}':'${mapv}':lonlatxtrms:'${figexperimentname}'!stations:' |
---|
| 978 | fivals=${fivals}${kfig}':true' |
---|
| 979 | python ${pyHOME}/drawing.py -o draw_stations_map -f ${wdir}/stations.inf \ |
---|
| 980 | -S ${fivals} |
---|
| 981 | if test $? -ne 0; then |
---|
[1975] | 982 | echo ${errmsg} |
---|
[2016] | 983 | echo " python failed!!" |
---|
| 984 | echo python ${pyHOME}/drawing.py -o draw_stations_map -f ${wdir}/stations.inf \ |
---|
| 985 | -S "'"${fivals}"'" |
---|
| 986 | exit |
---|
[1975] | 987 | fi |
---|
[2016] | 988 | echo " * Map of the stations: " >> ${ofilefigs} |
---|
| 989 | echo python ${pyHOME}/drawing.py -o draw_stations_map -f ${wdir}/stations.inf \ |
---|
| 990 | -S "'"${fivals}"'" >> ${ofilefigs} |
---|
| 991 | echo " " >> ${ofilefigs} |
---|
| 992 | convert -trim stations_map.${kfig} ${ofig} |
---|
[1984] | 993 | fi |
---|
[1975] | 994 | |
---|
[1983] | 995 | ### |
---|
| 996 | ## Soundings figures |
---|
| 997 | ### |
---|
| 998 | |
---|
| 999 | isnd=1 |
---|
| 1000 | for sndf in ${sndfiles}; do |
---|
| 1001 | stid=`python $pyHOME/nc_var.py -o grattr -f ${sndf} -S Station_number` |
---|
| 1002 | |
---|
| 1003 | # Getting wind components |
---|
| 1004 | ouavasndf=${odir}'/sounding_uava_'${stid}'.nc' |
---|
| 1005 | if ${fscratch}; then rm ${ouavasndf}; fi |
---|
| 1006 | if test ! -f ${ouavasndf}; then |
---|
| 1007 | python ${pyHOME}/diagnostics.py -f ${sndf} -d 'time@time,pres@pres' -v 'uavaFROMwswd|ws@wd' |
---|
[1975] | 1008 | if test $? -ne 0; then |
---|
| 1009 | echo ${errmsg} |
---|
| 1010 | echo " python failed!!" |
---|
[1983] | 1011 | echo python ${pyHOME}/diagnostics.py -f ${sndf} -d 'time@time,pres@pres' -v 'uavaFROMwswd|ws@wd' |
---|
[1975] | 1012 | exit |
---|
[2017] | 1013 | fi |
---|
| 1014 | echo " * Getting ua,va winds from station "${stid}": " >> ${ofileins} |
---|
| 1015 | echo python ${pyHOME}/diagnostics.py -f ${sndf} -d "'"time@time,pres@pres"'" \ |
---|
| 1016 | -v "'"uavaFROMwswd|ws@wd"'" >> ${ofileins} |
---|
| 1017 | echo " " >> ${ofileins} |
---|
[1983] | 1018 | mv diagnostics.nc ${ouavasndf} |
---|
| 1019 | fi |
---|
| 1020 | done |
---|
| 1021 | |
---|
| 1022 | sndids=`echo ${sndstids} | tr ':' ' '` |
---|
| 1023 | |
---|
| 1024 | for stidf in ${sndids}; do |
---|
| 1025 | stid=`echo ${stidf} | tr '@' ' ' | awk '{print $1}'` |
---|
| 1026 | sndorigfn=`echo ${stidf} | tr '@' ' ' | awk '{print $2}'` |
---|
[1989] | 1027 | echo ${stid}" ..." |
---|
[1983] | 1028 | it=0 |
---|
| 1029 | tatda_evol_values='' |
---|
| 1030 | tatda_evol_files='' |
---|
| 1031 | sndtimes='' |
---|
| 1032 | snddates='' |
---|
| 1033 | sndFdates='' |
---|
| 1034 | snddimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime -f ${sndorigfn} -v time | \ |
---|
| 1035 | grep 'dimt:' | awk '{print $2-1}'` |
---|
| 1036 | |
---|
| 1037 | # Time characteristics |
---|
| 1038 | tunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${sndorigfn} | \ |
---|
| 1039 | grep -v allvattrs | grep units | awk '{print $3}'` |
---|
| 1040 | Tu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` |
---|
| 1041 | Dref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` |
---|
| 1042 | Dref=${Dref0:0:4}${Dref0:5:2}${Dref0:8:2} |
---|
| 1043 | |
---|
| 1044 | # Getting values for evolution plot |
---|
| 1045 | col=`echo ${icolta} | tr ':' ' ' | awk '{print $1}'` |
---|
| 1046 | col2=`echo ${icolta} | tr ':' ' ' | awk '{print $2}'` |
---|
| 1047 | while test ${it} -le ${snddimt}; do |
---|
| 1048 | timev=`python $pyHOME/nc_var.py -o varout -S time:${it} -f ${sndorigfn} -v time | \ |
---|
| 1049 | grep NC | awk '{printf ("%d", $2)}'` |
---|
| 1050 | timeS=`date +${figsndTfmt} -d"${Dref} ${timev} ${Tu}"` |
---|
| 1051 | timeS2=`date +%d"$^{"%H"}$" -d"${Dref} ${timev} ${Tu}"` |
---|
| 1052 | timeS3=`date +%Y"-"%b -d"${Dref} ${timev} ${Tu}"` |
---|
| 1053 | timeS4=`date +%Y -d"${Dref} ${timev} ${Tu}"` |
---|
[1989] | 1054 | echo " "${it}" "${timev}" "${Dref}" '"${timev}"' "${Tu}" "$(echo ${timeS} | tr '!' ' ') |
---|
[1983] | 1055 | timefS=`date +%Y%m%d%H%M%S -d"${Dref} ${timev} ${Tu}"` |
---|
| 1056 | |
---|
| 1057 | # for now... |
---|
| 1058 | sndstn=${stid} |
---|
| 1059 | |
---|
[1995] | 1060 | fivals=${it}'#'${stid}'#'${sndstn}'#'${timeS}'#'${ofigdir}'#'${timefS}'#' |
---|
| 1061 | fivals=${fivals}${ouavasndf}'#WindRose' |
---|
| 1062 | WindRose_plot ${fivals} |
---|
[1983] | 1063 | |
---|
[1995] | 1064 | fivals=${it}'#'${stid}'#'${sndstn}'#'${timeS}'#'${ofigdir}'#'${timefS}'#' |
---|
| 1065 | fivals=${fivals}${sndorigfn}'#SkewT-logP_obs_ta-tda' |
---|
| 1066 | SkewT_logP_plot ${fivals} |
---|
[1983] | 1067 | |
---|
| 1068 | colH=`num_hex ${col}` |
---|
| 1069 | colH2=`num_hex ${col2}` |
---|
| 1070 | if test ${it} -eq 0; then |
---|
| 1071 | sndtimes=${timev} |
---|
| 1072 | snddates=${timeS} |
---|
| 1073 | sndFdates=${timefS} |
---|
| 1074 | tatda_evol_files=${sndorigfn}':pres|-1,time|'${it}':ta,pres;' |
---|
| 1075 | tatda_evol_files=${tatda_evol_files}${sndorigfn}':pres|-1,time|'${it}':tda,pres' |
---|
| 1076 | tatda_evol_labs='ta_'${timeS2}',tda' |
---|
| 1077 | tatda_evol_cols='#'${colH}${colH2}${colH2}',#'${colH2}${colH2}${colH} |
---|
| 1078 | else |
---|
| 1079 | sndtimes=${sndtimes}','${timev} |
---|
| 1080 | snddates=${snddates}','${timeS} |
---|
| 1081 | sndFdates=${sndFdates}','${timefS} |
---|
| 1082 | tatda_evol_files=${tatda_evol_files}';'${sndorigfn}':pres|-1,time|'${it}':ta,pres' |
---|
| 1083 | tatda_evol_files=${tatda_evol_files}';'${sndorigfn}':pres|-1,time|'${it}':tda,pres' |
---|
| 1084 | if test $(expr ${it} % 2) -eq 0; then |
---|
| 1085 | tatda_evol_labs=${tatda_evol_labs}','${timeS2}',None' |
---|
| 1086 | else |
---|
| 1087 | tatda_evol_labs=${tatda_evol_labs}',None,None' |
---|
| 1088 | fi |
---|
| 1089 | tatda_evol_cols=${tatda_evol_cols}',#'${colH}${colH2}${colH2}',#'${colH2}${colH2}${colH} |
---|
[1975] | 1090 | fi |
---|
[1983] | 1091 | col=`expr ${col} - ${ddcol}` |
---|
| 1092 | col2=`expr ${col2} - ${ddcol}` |
---|
| 1093 | |
---|
| 1094 | it=`expr ${it} + 1` |
---|
[1975] | 1095 | done |
---|
[1983] | 1096 | |
---|
[1995] | 1097 | fivals=${stid}'@'${sndstn}'@'${tatda_evol_labs}'@'${tatda_evol_cols}'@' |
---|
| 1098 | fivals=${fivals}${tatda_evol_files}'@'${timeS3}'@'${ofigdir}'@SkewT-logP_obs_evol' |
---|
| 1099 | multi_soundings_plot ${fivals} |
---|
[1983] | 1100 | |
---|
| 1101 | # End of soundings |
---|
| 1102 | done |
---|
[2017] | 1103 | exit |
---|
[1983] | 1104 | |
---|
| 1105 | # snd-sims comparison |
---|
| 1106 | |
---|
| 1107 | for stidf in ${sndids}; do |
---|
| 1108 | stid=`echo ${stidf} | tr '@' ' ' | awk '{print $1}'` |
---|
| 1109 | sndorigfn=`echo ${stidf} | tr '@' ' ' | awk '{print $2}'` |
---|
| 1110 | echo "snd: "${stid} |
---|
| 1111 | |
---|
| 1112 | sndlon=`ncdump -h ${sndorigfn} | grep Station_longitude | awk '{print $3}'` |
---|
| 1113 | sndlat=`ncdump -h ${sndorigfn} | grep Station_latitude | awk '{print $3}'` |
---|
| 1114 | sndts=`echo ${sndtimes} | tr ',' ' '` |
---|
| 1115 | |
---|
[1989] | 1116 | # for now... |
---|
| 1117 | sndstn=${stid} |
---|
| 1118 | |
---|
[1983] | 1119 | # Time characteristics |
---|
| 1120 | tunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${sndorigfn} | \ |
---|
| 1121 | grep -v allvattrs | grep units | awk '{print $3}'` |
---|
| 1122 | Tu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` |
---|
| 1123 | Dref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` |
---|
| 1124 | Dref=${Dref0:0:4}${Dref0:5:2}${Dref0:8:2} |
---|
| 1125 | |
---|
[1989] | 1126 | obsdimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime, -v time -f ${sndorigfn} | \ |
---|
| 1127 | grep dimt | awk '{print $2-1}'` |
---|
| 1128 | |
---|
[1983] | 1129 | # Plotting |
---|
| 1130 | it=0 |
---|
[1989] | 1131 | while test ${it} -le ${obsdimt}; do |
---|
[1983] | 1132 | |
---|
[1989] | 1133 | otimev=`python $pyHOME/nc_var.py -o varout -S time:${it} -f ${sndorigfn} -v time |\ |
---|
[1983] | 1134 | grep NC | awk '{printf ("%d", $2)}'` |
---|
[1989] | 1135 | dateS=`date +${figsndTfmt} -d"${Dref} ${otimev} ${Tu}"` |
---|
| 1136 | timeS2=`date +%d"$^{"%H"}$" -d"${Dref} ${otimev} ${Tu}"` |
---|
| 1137 | timeS3=`date +%Y"-"%b -d"${Dref} ${otimev} ${Tu}"` |
---|
| 1138 | timeS4=`date +%Y -d"${Dref} ${otimev} ${Tu}"` |
---|
| 1139 | datefS=`date +%Y%m%d%H%M%S -d"${Dref} ${otimev} ${Tu}"` |
---|
[1983] | 1140 | |
---|
| 1141 | iexp=1 |
---|
| 1142 | for exp in ${exps}; do |
---|
| 1143 | expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'` |
---|
| 1144 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
| 1145 | expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` |
---|
| 1146 | expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` |
---|
| 1147 | |
---|
[2017] | 1148 | #simjoinselvars=${odir}'/simout_vars_'${expl}'.nc' |
---|
| 1149 | #simdiagsf=${odir}'/simout_snddiags_'${expl}'.nc' |
---|
| 1150 | #simfiles=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT}` |
---|
| 1151 | simjoinselvars=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT} | head -n 1` |
---|
| 1152 | simdiagsf=${odir}'/simout_sndvars_'${stid}'_'${expl}'.nc' |
---|
| 1153 | simsndptf=${odir}'/simout_sndvars_'${stid}'_'${expl}'.nc' |
---|
[1983] | 1154 | |
---|
[1989] | 1155 | gridsndv=`python ${pyHOME}/nc_var.py -o get_point -f ${simjoinselvars} \ |
---|
| 1156 | -S 'XLONG:XLAT:Time|0' -v ${sndlon}','${sndlat} | tr ' ' '!'` |
---|
| 1157 | xsnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $1}' | tr ',' ' ' | \ |
---|
| 1158 | awk '{print $1}'` |
---|
| 1159 | ysnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $1}' | tr ',' ' ' | \ |
---|
| 1160 | awk '{print $2}'` |
---|
| 1161 | dsnd=`echo ${gridsndv} | tr '!' ' ' | awk '{print $2}'` |
---|
| 1162 | if test ${it} -eq 0 && test ${iexp} -eq 1; then |
---|
| 1163 | echo " Equivalent simulated sounding grid point: "${gridsnd}" distance: "\ |
---|
| 1164 | ${dsnd} |
---|
| 1165 | fi |
---|
[1983] | 1166 | |
---|
| 1167 | # Time information from simulation |
---|
| 1168 | simdimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime, -v time \ |
---|
| 1169 | -f ${simdiagsf} | grep dimt | awk '{print $2}'` |
---|
| 1170 | simtunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${simdiagsf} | \ |
---|
| 1171 | grep -v allvattrs | grep units | awk '{print $3}'` |
---|
| 1172 | simTu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` |
---|
| 1173 | simDref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` |
---|
| 1174 | simDref=${simDref0:0:4}${simDref0:5:2}${simDref0:8:2} |
---|
| 1175 | |
---|
| 1176 | # Time step from simulated file |
---|
[1989] | 1177 | timestepv=`python ${pyHOME}/nc_var.py -o get_time -f ${simsndptf} \ |
---|
| 1178 | -S ${otimev}';'${tunits} -v time | tr ' ' '@'` |
---|
| 1179 | timestep=`echo ${timestepv} | tr '@' ' ' | awk '{print $1}'` |
---|
[2017] | 1180 | timestepdiff=`echo ${timestepv} | tr '@' ' ' | awk '{print $2}'` |
---|
[1983] | 1181 | if test $? -ne 0; then |
---|
| 1182 | echo ${errmsg} |
---|
| 1183 | echo " python failed!!" |
---|
| 1184 | echo python ${pyHOME}/nc_var.py -o get_time -f ${simsndptf} \ |
---|
[1989] | 1185 | -S ${otimev}';'${tunits} -v time |
---|
[1983] | 1186 | exit |
---|
| 1187 | fi |
---|
| 1188 | |
---|
| 1189 | if test ${iexp} -eq 1; then |
---|
[1989] | 1190 | echo " "${it}": it="${timestep}" "$(echo ${dateS} | tr '!' ' ')" "${datefS} |
---|
[1983] | 1191 | tacomplabs='$ta^{obs}$,$ta^{'${expn}'}$' |
---|
| 1192 | tdacomplabs='$tda^{obs}$,$tda^{'${expn}'}$' |
---|
| 1193 | tacompcols='#FF6464,'${expc} |
---|
| 1194 | tdacompcols='#6464FF,'${expc} |
---|
| 1195 | tacompltyp='-,-' |
---|
| 1196 | tdacompltyp='-,-.' |
---|
| 1197 | tacompfiles=${sndorigfn}':pres|-1,time|'${it}':ta,pres;' |
---|
| 1198 | tacompfiles=${tacompfiles}${simsndptf}':bottom_top|-1,time|'${timestep}':' |
---|
| 1199 | tacompfiles=${tacompfiles}'ta,pres' |
---|
| 1200 | tdacompfiles=${sndorigfn}':pres|-1,time|'${it}':tda,pres;' |
---|
| 1201 | tdacompfiles=${tdacompfiles}${simsndptf}':bottom_top|-1,time|'${timestep}':' |
---|
| 1202 | tdacompfiles=${tdacompfiles}'tda,pres' |
---|
| 1203 | else |
---|
| 1204 | tacomplabs=${tacomplabs}',$ta^{'${expn}'}$' |
---|
| 1205 | tdacomplabs=${tdacomplabs}',$tda^{'${expn}'}$' |
---|
| 1206 | tacompcols=${tacompcols}','${expc} |
---|
| 1207 | tdacompcols=${tdacompcols}','${expc} |
---|
| 1208 | tacompltyp=${tacompltyp}',-' |
---|
| 1209 | tdacompltyp=${tdacompltyp}',-.' |
---|
| 1210 | tacompfiles=${tacompfiles}';'${simsndptf}':bottom_top|-1,time|'${timestep}':' |
---|
| 1211 | tacompfiles=${tacompfiles}'ta,pres' |
---|
| 1212 | tdacompfiles=${tdacompfiles}';'${simsndptf}':bottom_top|-1,time|'${timestep} |
---|
| 1213 | tdacompfiles=${tdacompfiles}':tda,pres' |
---|
| 1214 | fi |
---|
| 1215 | |
---|
| 1216 | # Hovmoeller maps |
---|
| 1217 | sndvs=`echo ${sndvars} | tr ':' ' '` |
---|
| 1218 | for sndv in ${sndvs}; do |
---|
| 1219 | |
---|
| 1220 | CFvarvals=`python $pyHOME/generic.py -o variables_values -S ${sndv}` |
---|
| 1221 | cbar=`echo ${CFvarvals} | tr ':' ' ' | awk '{print $7}'` |
---|
| 1222 | |
---|
[1989] | 1223 | fivals=${stid}'#'${sndstn}'#'${sndv}'#'${ofigdir}'#'${datefS}'#'${fmtTts} |
---|
[1983] | 1224 | fivals=${fivals}'#'${simsndptf}'#'${sndorigfn}'#'${expl}'#'${expn}'#'${cbar} |
---|
[1995] | 1225 | fivals=${fivals}'#SkewT-logP_obs-sim_evol' |
---|
[1983] | 1226 | |
---|
| 1227 | Homoeller_SkewT_map_plot ${fivals} |
---|
| 1228 | |
---|
| 1229 | # end sounding vars |
---|
| 1230 | done |
---|
| 1231 | |
---|
| 1232 | iexp=`expr ${iexp} + 1` |
---|
| 1233 | # End experiments |
---|
| 1234 | done |
---|
| 1235 | |
---|
| 1236 | complabs=${tacomplabs}','${tdacomplabs} |
---|
| 1237 | compcols=${tacompcols}','${tdacompcols} |
---|
| 1238 | compltyp=${tacompltyp}','${tdacompltyp} |
---|
| 1239 | compfiles=${tacompfiles}';'${tdacompfiles} |
---|
| 1240 | |
---|
[1989] | 1241 | fivals=${stid}'@'${sndstn}'@'${complabs}'@'${compcols}'@'${compltyp}'@' |
---|
[1995] | 1242 | fivals=${fivals}${compfiles}'@'${dateS}'@'${ofigdir}'@'${datefS}'@'${ofigdir}'@' |
---|
| 1243 | fivals=${fivals}'SkewT-logP_obs-sim_step' |
---|
[1983] | 1244 | multi_SkewT_logP_plot ${fivals} |
---|
| 1245 | |
---|
[1995] | 1246 | # Wind Rose comparison |
---|
| 1247 | fivals=${it}'#'${stid}'#'${sndstn}'#'${timeS}'#'${ofigdir}'#'${timefS}'#' |
---|
| 1248 | fivals=${fivals}${ouavasndf}'#WindRose_obs-sim_' |
---|
| 1249 | multi_WindRose_plot ${fivals} |
---|
| 1250 | |
---|
[1983] | 1251 | it=`expr ${it} + 1` |
---|
| 1252 | # End sounding time-steps |
---|
| 1253 | done |
---|
| 1254 | |
---|
| 1255 | # End of soundings stations |
---|
| 1256 | done |
---|
| 1257 | |
---|
[2017] | 1258 | exit |
---|
| 1259 | |
---|
[1983] | 1260 | ### |
---|
| 1261 | ## SFC figures |
---|
| 1262 | ### |
---|
| 1263 | |
---|
| 1264 | # Joining all observations |
---|
| 1265 | obssfcfile=${odir}'/all_single-stations.nc' |
---|
[2006] | 1266 | if test ! -f ${wdir}/${sfcdir}/${obssfcfile}; then |
---|
[1983] | 1267 | python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles -S \ |
---|
[2006] | 1268 | ${sfcdir}':OBSnetcdf' -v all |
---|
[1983] | 1269 | if test $? -ne 0; then |
---|
| 1270 | echo ${errmsg} |
---|
| 1271 | echo " python failed!!" |
---|
| 1272 | echo python ${pyHOME}/nc_var.py -o join_singlestation_obsfiles \ |
---|
[2006] | 1273 | -S ${sfcdir}':OBSnetcdf' -v all |
---|
[1983] | 1274 | fi |
---|
| 1275 | mv joined_singlestations.nc ${obssfcfile} |
---|
[1975] | 1276 | fi |
---|
| 1277 | |
---|
[1984] | 1278 | # getting min,max values |
---|
| 1279 | if test ${sfcvars} != 'None'; then |
---|
| 1280 | fcs=`echo ${sfcvars} | tr ':' ' '` |
---|
[1975] | 1281 | |
---|
| 1282 | iv=1 |
---|
| 1283 | for sfcpv in ${sfcs}; do |
---|
| 1284 | sfcv=`echo ${sfcpv} | tr '@' ' ' | awk '{print $1}'` |
---|
| 1285 | nsfc=`echo ${sfcpv} | tr '@' ' ' | awk '{print $2}'` |
---|
| 1286 | xsfc=`echo ${sfcpv} | tr '@' ' ' | awk '{print $3}'` |
---|
| 1287 | if test ${nsfc} = 'FROMobs'; then |
---|
| 1288 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
[1983] | 1289 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
[1975] | 1290 | nsfc=`echo ${fstats} | awk '{print $3}'` |
---|
| 1291 | elif test ${nsfc} = 'FROMsims'; then |
---|
[1983] | 1292 | iexp=1 |
---|
| 1293 | for exp in ${exps}; do |
---|
| 1294 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
| 1295 | simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' |
---|
| 1296 | |
---|
| 1297 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
| 1298 | -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
| 1299 | if test ${iexp} -eq 1; then |
---|
| 1300 | nsfc=`echo ${fstats} | awk '{print $3}'` |
---|
| 1301 | else |
---|
| 1302 | nsfc2=`echo ${fstats} | awk '{print $3}'` |
---|
| 1303 | nsfcf=`echo ${nsfc}" "${nsfc2} | awk '{if ($1 < $2) {print $1;} else {print $2;}}'` |
---|
| 1304 | fi |
---|
| 1305 | done |
---|
| 1306 | elif test ${nsfc} = 'FROMobssims'; then |
---|
[1975] | 1307 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
[1983] | 1308 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
[1975] | 1309 | nsfc=`echo ${fstats} | awk '{print $3}'` |
---|
[1983] | 1310 | for exp in ${exps}; do |
---|
| 1311 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
| 1312 | simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' |
---|
| 1313 | |
---|
| 1314 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
| 1315 | -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
| 1316 | nsfc2=`echo ${fstats} | awk '{print $3}'` |
---|
| 1317 | nsfc=`echo ${nsfc}" "${nsfc2} | awk '{if ($1 < $2) {print $1;} else {print $2;}}'` |
---|
| 1318 | done |
---|
[1975] | 1319 | fi |
---|
| 1320 | if test ${xsfc} = 'FROMobs'; then |
---|
| 1321 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
[1983] | 1322 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
[1975] | 1323 | xsfc=`echo ${fstats} | awk '{print $4}'` |
---|
| 1324 | elif test ${xsfc} = 'FROMsims'; then |
---|
[1983] | 1325 | iexp=1 |
---|
| 1326 | for exp in ${exps}; do |
---|
| 1327 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
| 1328 | simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' |
---|
| 1329 | |
---|
| 1330 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
| 1331 | -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
| 1332 | if test ${iexp} -eq 1; then |
---|
| 1333 | xsfc=`echo ${fstats} | awk '{print $4}'` |
---|
| 1334 | else |
---|
| 1335 | xsfc2=`echo ${fstats} | awk '{print $4}'` |
---|
| 1336 | xsfcf=`echo ${xsfc}" "${xsfc2} | awk '{if ($1 > $2) {print $1;} else {print $2;}}'` |
---|
| 1337 | fi |
---|
| 1338 | done |
---|
| 1339 | elif test ${nsfc} = 'FROMobssims'; then |
---|
[1975] | 1340 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
[1983] | 1341 | -f ${obssfcfile} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
[1975] | 1342 | xsfc=`echo ${fstats} | awk '{print $4}'` |
---|
[1983] | 1343 | iexp=1 |
---|
| 1344 | for exp in ${exps}; do |
---|
| 1345 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
| 1346 | simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' |
---|
| 1347 | |
---|
| 1348 | fstats=`python $pyHOME/nc_var.py -o field_stats -S full,1.e+20,None \ |
---|
| 1349 | -f ${simsfcdiagf} -v ${sfcv} | grep MAT | grep ${sfcv}` |
---|
| 1350 | xsfc2=`echo ${fstats} | awk '{print $4}'` |
---|
| 1351 | xsfcf=`echo ${xsfc}" "${xsfc2} | awk '{if ($1 > $2) {print $1;} else {print $2;}}'` |
---|
| 1352 | done |
---|
[1975] | 1353 | fi |
---|
| 1354 | if test $iv -eq 1; then |
---|
| 1355 | newsfcvars=${sfcv}'@'${nsfc}'@'${xsfc} |
---|
| 1356 | else |
---|
| 1357 | newsfcvars=${newsfcvars}':'${sfcv}'@'${nsfc}'@'${xsfc} |
---|
| 1358 | fi |
---|
| 1359 | iv=`expr ${iv} + 1` |
---|
| 1360 | done |
---|
| 1361 | sfcs=`echo ${newsfcvars} | tr ':' ' '` |
---|
| 1362 | echo "new sfc variables: "${sfcs} |
---|
| 1363 | |
---|
| 1364 | # Time-series |
---|
| 1365 | |
---|
| 1366 | # stations |
---|
| 1367 | # FROM: https://stackoverflow.com/questions/2961635/using-awk-to-print-all-columns-from-the-nth-to-the-last |
---|
| 1368 | stsids=`python ${pyHOME}/nc_var.py -o varout -v id -f \ |
---|
[1983] | 1369 | ${obssfcfile} -S 'Nstations:-1|time:0' | awk '{$1=""; printf("%d:",substr($0,2))}'` |
---|
[1975] | 1370 | stsnames=`python ${pyHOME}/nc_var.py -o varout -v stsname -f \ |
---|
[1983] | 1371 | ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':' | \ |
---|
| 1372 | tr ' ' '!'` |
---|
[1975] | 1373 | stslons=`python ${pyHOME}/nc_var.py -o varout -v stslon -f \ |
---|
[1983] | 1374 | ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':'` |
---|
[1975] | 1375 | stslats=`python ${pyHOME}/nc_var.py -o varout -v stslat -f \ |
---|
[1983] | 1376 | ${obssfcfile} -S Nstations:-1 | awk '{$1=""; print substr($0,2)}' | tr '\n' ':'` |
---|
[1975] | 1377 | |
---|
| 1378 | Nsts=`echo ${stsnames} | tr ':' ' ' | wc -w | awk '{print $1}'` |
---|
| 1379 | ist=1 |
---|
| 1380 | while test ${ist} -le ${Nsts}; do |
---|
| 1381 | sti=`echo ${stsids} | tr ':' '\n' | head -n ${ist} | tail -n 1` |
---|
| 1382 | stn=`echo ${stsnames} | tr ':' '\n' | head -n ${ist} | tail -n 1` |
---|
| 1383 | stl=`echo ${stslons} | tr ':' '\n' | head -n ${ist} | tail -n 1` |
---|
| 1384 | stL=`echo ${stslats} | tr ':' '\n' | head -n ${ist} | tail -n 1` |
---|
| 1385 | ist_1=`expr ${ist} - 1` |
---|
| 1386 | |
---|
[1983] | 1387 | sfccompfiles=${obssfcfile}'%time|-1;Nstations|'${ist_1} |
---|
| 1388 | sfccomplabs='obs' |
---|
| 1389 | sfccompcols='#000000' |
---|
| 1390 | |
---|
| 1391 | iexp=1 |
---|
| 1392 | for exp in ${exps}; do |
---|
| 1393 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
| 1394 | expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` |
---|
| 1395 | expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` |
---|
| 1396 | |
---|
| 1397 | simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' |
---|
| 1398 | |
---|
[1989] | 1399 | gridsfcv=`python ${pyHOME}/nc_var.py -o get_point -f ${simsfcdiagf} \ |
---|
| 1400 | -S 'XLONG:XLAT:Time|0' -v ${stl}','${stL} | tr ' ' '!'` |
---|
| 1401 | xgrid=`echo ${gridsfcv} | tr '!' ' ' | awk '{print $1}' | tr ',' ' ' | \ |
---|
| 1402 | awk '{print $1}'` |
---|
| 1403 | ygrid=`echo ${gridsfcv} | tr '!' ' ' | awk '{print $1}' | tr ',' ' ' | \ |
---|
| 1404 | awk '{print $2}'` |
---|
| 1405 | distgrid=`echo ${gridsfcv} | tr '!' ' ' | awk '{print $2}'` |
---|
[1983] | 1406 | |
---|
| 1407 | sfcstats=${sti}'@'${stn}'@'${stl}'@'${stL}'@'${gridsfc} |
---|
| 1408 | |
---|
| 1409 | sfccompfiles=${sfccompfiles}','${simsfcdiagf}'%time|-1;south_north|'${ygrid}';west_east|' |
---|
| 1410 | sfccompfiles=${sfccompfiles}${xgrid} |
---|
| 1411 | sfccomplabs=${sfccomplabs}','${expn} |
---|
| 1412 | sfccompcols=${sfccompcols}','${expc} |
---|
| 1413 | done |
---|
| 1414 | # end experiments |
---|
| 1415 | |
---|
[1975] | 1416 | for sfcpv in ${sfcs}; do |
---|
| 1417 | sfcv=`echo ${sfcpv} | tr '@' ' ' | awk '{print $1}'` |
---|
| 1418 | nsfc=`echo ${sfcpv} | tr '@' ' ' | awk '{print $2}'` |
---|
| 1419 | xsfc=`echo ${sfcpv} | tr '@' ' ' | awk '{print $3}'` |
---|
| 1420 | |
---|
[1983] | 1421 | fivals=${sti}'@'${stn}'@'${sfcv}'@'${ofigdir}'@'${fmtTts}'@'${sfccompfiles}'@' |
---|
| 1422 | fivals=${fivals}${sfccomplabs}'@'${sfccompcols}'@'${nsfc}'@'${xsfc} |
---|
[1995] | 1423 | fivals=${fivals}'@obs-sim_evol_ts' |
---|
[1983] | 1424 | |
---|
| 1425 | multiple_time_series_plot ${fivals} |
---|
| 1426 | |
---|
[1975] | 1427 | done |
---|
[1983] | 1428 | # end observations |
---|
| 1429 | |
---|
[1975] | 1430 | ist=`expr $ist + 1` |
---|
| 1431 | done |
---|
[1983] | 1432 | # end sfc statinos |
---|
[1975] | 1433 | |
---|
| 1434 | # Cont-disc comparison |
---|
[1983] | 1435 | iexp=1 |
---|
| 1436 | for exp in ${exps}; do |
---|
| 1437 | expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'` |
---|
| 1438 | expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'` |
---|
| 1439 | expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'` |
---|
[1975] | 1440 | |
---|
[1983] | 1441 | simsfcdiagf=${odir}'/simout_sfcdiags_'${expl}'.nc' |
---|
[1975] | 1442 | |
---|
[1983] | 1443 | # Time information from simulation |
---|
| 1444 | simdimt=`python ${pyHOME}/nc_var.py -o itime -S CFtime, -v time -f ${simsfcdiagf} \ |
---|
[1995] | 1445 | | grep dimt | awk '{print $2-1}'` |
---|
[1983] | 1446 | simtunits=`python ${pyHOME}/nc_var.py -o ivattrs -v time -f ${simsfcdiagf} | \ |
---|
| 1447 | grep -v allvattrs | grep units | awk '{print $3}'` |
---|
| 1448 | simTu=`echo ${tunits} | tr '!' ' ' | awk '{print $1}'` |
---|
| 1449 | simDref0=`echo ${tunits} | tr '!' ' ' | awk '{print $3}'` |
---|
| 1450 | simDref=${simDref0:0:4}${simDref0:5:2}${simDref0:8:2} |
---|
[1975] | 1451 | |
---|
[1983] | 1452 | it=0 |
---|
| 1453 | while test ${it} -le ${simdimt}; do |
---|
| 1454 | simtstep=`python ${pyHOME}/nc_var.py -o varout -f ${simsfcdiagf} -S \ |
---|
| 1455 | 'time:'${it} -v time | grep NC | awk '{printf ("%d",$2)}'` |
---|
| 1456 | if test $? -ne 0; then |
---|
| 1457 | echo ${errmsg} |
---|
| 1458 | echo " python failed!!" |
---|
| 1459 | echo python ${pyHOME}/nc_var.py -o varout -f ${simsfcdiagf} -S 'time:'${it} -v time |
---|
| 1460 | exit |
---|
| 1461 | fi |
---|
[1975] | 1462 | |
---|
[1983] | 1463 | timeS=`date +${figsndTfmt} -d"${simDref} ${simtstep} ${simTu}"` |
---|
| 1464 | echo ${it}" "${simtstep}" "${simDref}" "${simTu}" "$(echo ${timeS} | tr '!' ' ') |
---|
| 1465 | timefS=`date +%Y%m%d%H%M%S -d"${simDref} ${simtstep} ${simTu}"` |
---|
[1975] | 1466 | |
---|
[1983] | 1467 | # Looking for obs time |
---|
[1989] | 1468 | oitv=`python ${pyHOME}/nc_var.py -o get_time -f ${obssfcfile} \ |
---|
| 1469 | -S ${simtstep}';'${tunits} -v ststimes | grep -v differ | tr ' ' '@'` |
---|
| 1470 | oit=`echo ${oitv} | tr '@' ' ' | awk '{print $1}'` |
---|
[1975] | 1471 | |
---|
[1983] | 1472 | for sfcnxv in ${sfcs}; do |
---|
| 1473 | sfcv=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $1}'` |
---|
| 1474 | nsfc=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $2}'` |
---|
| 1475 | xsfc=`echo ${sfcnxv} | tr '@' ' ' | awk '{print $3}'` |
---|
[1975] | 1476 | |
---|
[1983] | 1477 | fivals=${expl}'#'${expn}'#'${sfcv}'#'${ofigdir}'#'${obssfcfile}'#'${simsfcdiagf} |
---|
| 1478 | fivals=${fivals}'#'${it}'#'${oit}'#'${timeS}'#'${timefS}'#'${nsfc}'#'${xsfc}'#' |
---|
[1995] | 1479 | fivals=${fivals}${mapv}'#'${mapcover}'#map_obs-sim' |
---|
[1975] | 1480 | |
---|
[1983] | 1481 | shad_contdisc_map_plot ${fivals} |
---|
| 1482 | |
---|
| 1483 | # end of variables |
---|
| 1484 | done |
---|
| 1485 | |
---|
| 1486 | it=`expr ${it} + 1` |
---|
| 1487 | # end of time-steps |
---|
[1975] | 1488 | done |
---|
[1983] | 1489 | |
---|
| 1490 | # end of simulations |
---|
[1975] | 1491 | done |
---|
[1984] | 1492 | fi |
---|
| 1493 | |
---|
| 1494 | fi |
---|