Changeset 2113 in lmdz_wrf for trunk/tools
- Timestamp:
- Aug 30, 2018, 3:44:06 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/obs-sim_Comparison_ONLYfigures.bash
r2107 r2113 1 1 #!/bin/bash 2 # Shell script to compare observations with simulations using PyNCplot 2 # Shell script to compare observations with simulations using PyNCplot figures 'ONLY' 3 3 # 4 4 # observations: different files from create_OBSnetcdf.py and/or UWyoming_snd_nc.py … … 52 52 echo "END upload -- end UPLOAD -- END upload -- end UPLOAD" 53 53 54 # files from scratch 55 if test ${fscratch} = 'true'; then fscratch=true 56 else fscratch=false; fi 54 fscratch=false 57 55 58 56 # figures from scratch … … 144 142 else 145 143 false 146 fi147 }148 149 function get_WRFsounding_data(){150 # Function to get the data to compute analysis in a sounding point151 # stlon= longitude value of the station152 # stlat= latitude value of the station153 # filen= name of the file154 # lonvarn= name of the longitude variable155 # latvarn= name of the latitude variable156 # snddiagnames= diagnostics to compute (as ':' separated list)157 # snddiagd= name of the dimensions and dimension variables to use for diagnostics158 159 funcvals=$1160 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 values187 if ${fscratch}; then rm ${simsndptf} >& /dev/null; fi188 if test ! -f ${simsndptf}; then189 values='Time,0,-1,1@bottom_top,0,-1,1@south_north,'${ysnd}','${ysnd}',1@'190 values=${values}'west_east,'${xsnd}','${xsnd}',1@south_north_stag,'${ysnd}','191 values=${values}${ysnd1}',1@west_east_stag,'${xsnd}','${xsnd1}',1:False'192 python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \193 -S ${values} -v all194 if test $? -ne 0; then195 echo ${errmsg}196 echo " python failed!!"197 echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \198 -S "'"${values}"'" -v all199 exit200 fi201 echo "* get values at snd point: "${stlon}", "${stlat} >> ${ofileins}202 echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \203 -S "'"${values}"'" -v all >> ${ofileins}204 echo " " >> ${ofileins}205 206 yslc='south_north_B'${ysnd}'-E'${ysnd}'-I1'207 ystslc='south_north_stag_B'${ysnd}'-E'${ysnd1}'-I1'208 xslc='west_east_B'${xsnd}'-E'${xsnd}'-I1'209 xstslc='west_east_stag_B'${xsnd}'-E'${xsnd1}'-I1'210 211 Hfilen=`basename ${filen}`212 Dfilen=`dirname ${filen}`213 Hhfilen=`echo ${Hfilen} | tr '.' ' ' | awk '{print $1}'`214 215 ofilen='newfile_multidims.nc'216 mv ${ofilen} ${simsndptf}217 fi218 219 # Computing sounding diagnostics220 diagns=`echo ${snddiagnames} | tr ':' ' '`221 222 idiag=1223 for diagn in ${diagns}; do224 diagv=`cat $pyHOME/diagnostics.inf | grep ${diagn}',' | tr ',' ' ' | \225 awk '{print $2"|"$3}'`226 if test ${idiag} -eq 1; then227 snddiagvals=${diagv}228 else229 snddiagvals=${snddiagvals}','${diagv}230 fi231 idiag=`expr ${idiag} + 1`232 done233 234 if ${fscratch}; then rm ${simsnddiagsf}; fi235 if test ! -f ${simsnddiagsf}; then236 python ${pyHOME}/diagnostics.py -f ${simsndptf} -d ${snddiagd} -v ${snddiagvals}237 if test $? -ne 0; then238 echo ${errmsg}239 echo " python failed!!"240 echo python ${pyHOME}/diagnostics.py -f ${simsndptf} -d "'"${snddiagd}"'" -v \241 "'"${snddiagvals}"'"242 exit243 fi244 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); then251 #To deg252 python ${pyHOME}/nc_var.py -o valmod -S subc,273.15 -f ${simsnddiagsf} -v ta253 fi254 if $(isin_list ${snddiagnames} WRFp); then255 #To Pa256 python ${pyHOME}/nc_var.py -o valmod -S divc,100. -f ${simsnddiagsf} -v pres257 fi258 fi259 }260 261 function get_WRFsurface_data(){262 # Function to get the data to compute analysis in a surface point263 # stlon= longitude value of the station264 # stlat= latitude value of the station265 # filen= name of the file266 # lonvarn= name of the longitude variable267 # latvarn= name of the latitude variable268 # sfcdiagnames= diagnostics to compute (as ':' separated list)269 # nondiagvs= ':' list of variables which are not from a diagnostics ('None' for270 # without)271 # sfcdiagd= name of the dimensions and dimension variables to use for diagnostics272 273 funcvals=$1274 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 values301 if ${fscratch}; then rm ${simsfcptf} >& /dev/null; fi302 if test ! -f ${simsfcptf}; then303 values='Time,0,-1,1@south_north,'${ysnd}','${ysnd}',1@'304 values=${values}'west_east,'${xsnd}','${xsnd}',1@south_north_stag,'${ysnd}','305 values=${values}${ysnd1}',1@west_east_stag,'${xsnd}','${xsnd1}',1:False'306 python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \307 -S ${values} -v all308 if test $? -ne 0; then309 echo ${errmsg}310 echo " python failed!!"311 echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \312 -S "'"${values}"'" -v all313 exit314 fi315 echo "* get values at sfc point: "${stlon}", "${stlat} >> ${ofileins}316 echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \317 -S "'"${values}"'" -v all >> ${ofileins}318 echo " " >> ${ofileins}319 yslc='south_north_B'${ysnd}'-E'${ysnd}'-I1'320 ystslc='south_north_stag_B'${ysnd}'-E'${ysnd1}'-I1'321 xslc='west_east_B'${xsnd}'-E'${xsnd}'-I1'322 xstslc='west_east_stag_B'${xsnd}'-E'${xsnd1}'-I1'323 324 ofilen='newfile_multidims.nc'325 mv ${ofilen} ${simsfcptf}326 fi327 328 # Computing sfc diagnostics329 diagns=`echo ${sfcdiagnames} | tr ':' ' '`330 331 idiag=1332 for diagn in ${diagns}; do333 diagv=`cat $pyHOME/diagnostics.inf | grep WRF | grep ${diagn}',' | tr ',' ' ' | \334 awk '{print $2"|"$3}'`335 if test ${idiag} -eq 1; then336 sfcdiagvals=${diagv}337 else338 sfcdiagvals=${sfcdiagvals}','${diagv}339 fi340 idiag=`expr ${idiag} + 1`341 done342 343 if ${fscratch}; then rm ${simsfcdiagsf}; fi344 if test ! -f ${simsfcdiagsf}; then345 python ${pyHOME}/diagnostics.py -f ${simsfcptf} -d ${sfcdiagd} -v ${sfcdiagvals}346 if test $? -ne 0; then347 echo ${errmsg}348 echo " python failed!!"349 echo python ${pyHOME}/diagnostics.py -f ${simsfcptf} -d "'"${sfcdiagd}"'" \350 -v "'"${sfcdiagvals}"'"351 exit352 fi353 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); then359 #To rad360 python ${pyHOME}/nc_var.py -o valmod -S mulc,0.0174532925199 -f ${simsfcdiagsf}\361 -v wds362 python ${pyHOME}/nc_var.py -o varaddattr -S 'units|rad' -f ${simsfcdiagsf} -v wds363 fi364 365 #Adding non-diagnostic variables366 if test ! ${nondiagvs} = 'None'; then367 varsadd=`echo ${nondiagvs} | tr ':' ' '`368 for vadd in ${varsadd}; do369 python ${pyHOME}/nc_var.py -o fvaradd -S ${simsfcptf},${vadd} \370 -f ${simsfcdiagsf}371 if test $? -ne 0; then372 echo ${errmsg}373 echo " python failed!!"374 echo python ${pyHOME}/nc_var.py -o fvaradd -S "'"${simsfcptf},${vadd}"'" \375 -f ${simsfcdiagsf}376 exit377 rm ${simsfcdiagsf}378 fi379 echo "* adding variable '"${vadd}"' at sfc point: "${stlon}", "${stlat} >> \380 ${ofileins}381 echo python ${pyHOME}/nc_var.py -o fvaradd -S "'"${simsfcptf},${vadd}"'" \382 -f ${simsfcdiagsf} >> ${ofileins}383 echo " " >> ${ofileins}384 # CF varname385 CFvarn=`python $pyHOME/generic.py -o variables_values -S ${vadd} | \386 tr ':' ' ' | awk '{print $1}'`387 if test $? -ne 0; then388 echo ${errmsg}389 echo " python failed!!"390 echo python $pyHOME/generic.py -o variables_values -S ${vadd}391 exit392 rm ${simsfcdiagsf}393 fi394 python $pyHOME/nc_var.py -o chvarname -S ${CFvarn} -f ${simsfcdiagsf} \395 -v ${vadd}396 if test $? -ne 0; then397 echo ${errmsg}398 echo " python failed!!"399 echo python ${pyHOME}/nc_var.py -o chvarname -S ${CFvarn} \400 -f ${simsfcdiagsf} -v ${vadd}401 exit402 rm ${simsfcdiagsf}403 fi404 done405 fi406 fi407 }408 409 function get_WRFsfc2D_data(){410 # Function to get the data to compute analysis in a surface map411 # filen= name of the file412 # sfcdiagnames= diagnostics to compute (as ':' separated list)413 # nondiagvs= ':' list of variables which are not from a diagnostics ('None' for414 # without)415 # sfcmapdiagd= name of the dimensions and dimension variables to use for diagnostics416 417 funcvals=$1418 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 diagnostics425 diagns=`echo ${sfcdiagnames} | tr ':' ' '`426 427 # getting that variables only required for the diagnostics428 vardiags=''429 idiag=1430 for diagn in ${diagns}; do431 diagv=`cat $pyHOME/diagnostics.inf | grep WRF | grep ${diagn}',' | tr ',' ' ' | \432 awk '{print $2"|"$3}'`433 if test ${idiag} -eq 1; then434 sfcdiagvals=${diagv}435 vardiags=`echo ${diagv} | tr '|' ' ' | awk '{print $2}' | tr '@' ':'`436 else437 sfcdiagvals=${sfcdiagvals}','${diagv}438 vardiag=`echo ${diagv} | tr '|' ' ' | awk '{print $2}' | tr '@' ' '`439 for vd in ${vardiag}; do440 if ! $(isin_list ${vardiags} ${vd}); then vardiags=${vardiags}':'${vd}; fi441 done442 fi443 idiag=`expr ${idiag} + 1`444 done445 446 # Inlcuding non-diagnostics447 if test ! ${nondiagvs} = 'None'; then448 nvns=`echo ${nondiagvs} | tr ':' ' '`449 for vn in ${nvns}; do450 if ! $(isin_list ${vardiags} ${vn}); then vardiags=${vardiags}':'${vn}; fi451 done452 if ! $(isin_list ${vardiags} 'time'); then vardiags=${vardiags}':time'; fi453 fi454 vardiag=`echo ${vardiags} | tr ':' ','`455 456 # Getting values457 if ${fscratch}; then rm ${simsfcmapf} >& /dev/null; fi458 if test ! -f ${simsfcmapf}; then459 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; then464 echo ${errmsg}465 echo " python failed!!"466 echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \467 -S "'"${values}"'" -v ${vardiag}468 exit469 fi470 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 fi478 479 if ${fscratch}; then rm ${simsfcmapdiagsf}; fi480 if test ! -f ${simsfcmapdiagsf}; then481 python ${pyHOME}/diagnostics.py -f ${simsfcmapf} -d ${sfcmapdiagd} \482 -v ${sfcdiagvals}483 if test $? -ne 0; then484 echo ${errmsg}485 echo " python failed!!"486 echo python ${pyHOME}/diagnostics.py -f ${simsfcmapf} -d "'"${sfcmapdiagd}"'" \487 -v "'"${sfcdiagvals}"'"488 exit489 fi490 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); then496 #To rad497 python ${pyHOME}/nc_var.py -o valmod -S mulc,0.0174532925199 \498 -f ${simsfcmapdiagsf} -v wds499 python ${pyHOME}/nc_var.py -o varaddattr -S 'units|rad' -f ${simsfcmapdiagsf} \500 -v wds501 fi502 503 #Adding non-diagnostic variables504 if test ! ${nondiagvs} = 'None'; then505 varsadd=`echo ${nondiagvs} | tr ':' ' '`506 for vadd in ${varsadd}; do507 python ${pyHOME}/nc_var.py -o fvaradd -S ${simsfcmapf},${vadd} \508 -f ${simsfcmapdiagsf}509 if test $? -ne 0; then510 echo ${errmsg}511 echo " python failed!!"512 echo python ${pyHOME}/nc_var.py -o fvaradd -S "'"${simsfcmapf},${vadd}"'" \513 -f ${simsfcmapdiagsf}514 exit515 rm ${simsfcmapdiagsf}516 fi517 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 varname522 CFvarn=`python $pyHOME/generic.py -o variables_values -S ${vadd} | \523 tr ':' ' ' | awk '{print $1}'`524 if test $? -ne 0; then525 echo ${errmsg}526 echo " python failed!!"527 echo python $pyHOME/generic.py -o variables_values -S ${vadd}528 exit529 rm ${simsfcmapdiagsf}530 fi531 python $pyHOME/nc_var.py -o chvarname -S ${CFvarn} -f ${simsfcmapdiagsf} \532 -v ${vadd}533 if test $? -ne 0; then534 echo ${errmsg}535 echo " python failed!!"536 echo python ${pyHOME}/nc_var.py -o chvarname -S ${CFvarn} \537 -f ${simsfcmapdiagsf} -v ${vadd}538 exit539 rm ${simsfcmapdiagsf}540 fi541 done542 fi543 fi544 }545 546 function get_WRFCDXsfc2D_data(){547 # Function to get the data from WRFCDX to compute analysis in a surface map548 # filen= name of the file549 # sfcdiagnames= diagnostics to compute (as ':' separated list)550 # nondiagvs= ':' list of variables which are not from a diagnostics ('None' for551 # without)552 # sfcmapdiagd= name of the dimensions and dimension variables to use for diagnostics553 554 funcvals=$1555 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 diagnostics562 diagns=`echo ${sfcdiagnames} | tr ':' ' '`563 564 # getting that variables only required for the diagnostics565 vardiags=''566 idiag=1567 for diagn in ${diagns}; do568 diagv=`cat $pyHOME/diagnostics.inf | grep WRF | grep ${diagn}',' | tr ',' ' ' | \569 awk '{print $2"|"$3}'`570 if test ${idiag} -eq 1; then571 sfcdiagvals=${diagv}572 vardiags=`echo ${diagv} | tr '|' ' ' | awk '{print $2}' | tr '@' ':'`573 else574 sfcdiagvals=${sfcdiagvals}','${diagv}575 vardiag=`echo ${diagv} | tr '|' ' ' | awk '{print $2}' | tr '@' ' '`576 for vd in ${vardiag}; do577 if ! $(isin_list ${vardiags} ${vd}); then vardiags=${vardiags}':'${vd}; fi578 done579 fi580 idiag=`expr ${idiag} + 1`581 done582 583 # Inlcuding non-diagnostics584 if test ! ${nondiagvs} = 'None'; then585 nvns=`echo ${nondiagvs} | tr ':' ' '`586 for vn in ${nvns}; do587 if ! $(isin_list ${vardiags} ${vn}); then vardiags=${vardiags}':'${vn}; fi588 done589 if ! $(isin_list ${vardiags} 'time'); then vardiags=${vardiags}':time'; fi590 fi591 vardiag=`echo ${vardiags} | tr ':' ','`592 593 # Getting values594 if ${fscratch}; then rm ${simsfcmapf} >& /dev/null; fi595 if test ! -f ${simsfcmapf}; then596 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; then600 echo ${errmsg}601 echo " python failed!!"602 echo python ${pyHOME}/nc_var.py -o DataSetSection_multidims -f ${filen} \603 -S "'"${values}"'" -v ${vardiag}604 exit605 fi606 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 fi614 615 if ${fscratch}; then rm ${simsfcmapdiagsf}; fi616 if test ! -f ${simsfcmapdiagsf}; then617 python ${pyHOME}/diagnostics.py -f ${simsfcmapf} -d ${sfcmapdiagd} \618 -v ${sfcdiagvals}619 if test $? -ne 0; then620 echo ${errmsg}621 echo " python failed!!"622 echo python ${pyHOME}/diagnostics.py -f ${simsfcmapf} -d "'"${sfcmapdiagd}"'" \623 -v "'"${sfcdiagvals}"'"624 exit625 fi626 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 variables633 if test ! ${nondiagvs} = 'None'; then634 varsadd=`echo ${nondiagvs} | tr ':' ' '`635 for vadd in ${varsadd}; do636 python ${pyHOME}/nc_var.py -o fvaradd -S ${simsfcmapf},${vadd} \637 -f ${simsfcmapdiagsf}638 if test $? -ne 0; then639 echo ${errmsg}640 echo " python failed!!"641 echo python ${pyHOME}/nc_var.py -o fvaradd -S "'"${simsfcmapf},${vadd}"'" \642 -f ${simsfcmapdiagsf}643 exit644 rm ${simsfcmapdiagsf}645 fi646 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 varname651 CFvarn=`python $pyHOME/generic.py -o variables_values -S ${vadd} | \652 tr ':' ' ' | awk '{print $1}'`653 if test $? -ne 0; then654 echo ${errmsg}655 echo " python failed!!"656 echo python $pyHOME/generic.py -o variables_values -S ${vadd}657 exit658 rm ${simsfcmapdiagsf}659 fi660 python $pyHOME/nc_var.py -o chvarname -S ${CFvarn} -f ${simsfcmapdiagsf} \661 -v ${vadd}662 if test $? -ne 0; then663 echo ${errmsg}664 echo " python failed!!"665 echo python ${pyHOME}/nc_var.py -o chvarname -S ${CFvarn} \666 -f ${simsfcmapdiagsf} -v ${vadd}667 exit668 rm ${simsfcmapdiagsf}669 fi670 done671 fi672 144 fi 673 145 } … … 1112 584 1113 585 ### 1114 ## Preparing s imulations586 ## Preparing stations data 1115 587 ### 1116 588 … … 1139 611 echo ${prn}","${stid}","${ostlon}","${ostlat}","${ostheight} >> ${wdir}/stations.inf 1140 612 fi 1141 1142 iexp=11143 for exp in ${exps}; do1144 expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'`1145 expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'`1146 expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'`1147 expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'`1148 expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'`1149 1150 simfiles=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT}`1151 1152 ofile=${odir}/simout_${prn}vars_${stid}_${expl}.nc1153 if ${fscratch}; then rm ${ofile} >& /dev/null; fi1154 if test ! -f ${ofile}; then1155 for simf in ${simfiles}; do1156 simfn=`basename ${simf}`1157 fdate=`echo ${simfn} | tr '.' ' ' | awk '{print $1}' | tr '_' ' ' | \1158 awk '{print $3"_"$4}'`1159 1160 simsndptf=${odir}'/simout_vars_'${prn}'pt_'${stid}'_'${expl}'_'${fdate}'.nc'1161 simsnddiagsf=${odir}'/simout_'${prn}'diags_'${stid}'_'${expl}'_'${fdate}'.nc'1162 1163 fvals=${ostlon}'#'${ostlat}'#'${simf}'#XLONG#XLAT#'${wrfdiags}'#'1164 fvals=${fvals}${simdiagd}1165 get_WRFsounding_data ${fvals}1166 1167 # end of files1168 done1169 1170 # Concatenating files1171 Nconfc=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc | wc -l | \1172 awk '{print $1}'`1173 if test ${Nconfc} -gt 1; then1174 values=${odir}',Time,time'1175 HMT='simout_'${prn}'diags_,'${stid}'_'${expn},'nc'1176 python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \1177 -f ${HMT} -v all1178 if test $? -ne 0; then1179 echo ${errmsg}1180 echo " python failed!!"1181 echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}\1182 -f ${HMT} -v all1183 exit1184 fi1185 echo " * Concatenating "${obstype}" data at point: "${ostlon}", "${ostlat} >> ${ofileins}1186 echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S \1187 "'"${values}"'" -f ${HMT} -v all >> ${ofileins}1188 echo " " >> ${ofileins}1189 mv netcdf_fold_concatenated_HMT.nc ${ofile}1190 else1191 ffilen=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc`1192 cp ${ffilen} ${ofile}1193 fi1194 fi1195 iexp=`expr ${iexp} + 1`1196 # end of experiments1197 done1198 613 1199 614 iost=`expr ${iost} + 1` … … 1230 645 fi 1231 646 1232 iexp=11233 for exp in ${exps}; do1234 expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'`1235 expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'`1236 expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'`1237 expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'`1238 expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'`1239 1240 simfiles=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT}`1241 1242 for simf in ${simfiles}; do1243 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 files1255 done1256 1257 # Concatenating files1258 ofile=${odir}/simout_${prn}vars_${stid}_${expl}.nc1259 if ${fscratch}; then rm ${ofile} >& /dev/null; fi1260 if test ! -f ${ofile}; then1261 Nconfc=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc | wc -l | awk '{print $1}'`1262 if test ${Nconfc} -gt 1; then1263 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 all1267 if test $? -ne 0; then1268 echo ${errmsg}1269 echo " python failed!!"1270 echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}\1271 -f ${HMT} -v all1272 exit1273 fi1274 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 else1280 ffilen=`ls -1 ${odir}/simout_${prn}diags_*${stid}*${expl}*.nc`1281 cp ${ffilen} ${ofile}1282 fi1283 fi1284 iexp=`expr ${iexp} + 1`1285 # end of experiments1286 done1287 1288 647 iost=`expr ${iost} + 1` 1289 648 done 1290 649 if test ! ${sfcHf} = 'None'; then sfcstids=${oststids}; fi 1291 1292 # surface data for maps1293 iost=11294 obstype='surface_map'1295 prn='sfc'1296 listfiles=${sfcfiles}1297 wrfdiags=${wrfsfcdiags}1298 simdiagd=${simsfcmapdiagd}1299 iexp=11300 for exp in ${exps}; do1301 expf=`echo ${exp} | tr ',' ' ' | awk '{print $1}'`1302 expl=`echo ${exp} | tr ',' ' ' | awk '{print $2}'`1303 expn=`echo ${exp} | tr ',' ' ' | awk '{print $3}'`1304 expc=`echo ${exp} | tr ',' ' ' | awk '{print $4}'`1305 expm=`echo ${exp} | tr ',' ' ' | awk '{print $5}'`1306 1307 simfiles=`ls -1 ${simdir}/${expf}/${simH}*${simM}*${simT}`1308 1309 for simf in ${simfiles}; do1310 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 files1321 done1322 1323 # Concatenating files1324 ofile=${odir}/simout_${prn}mapvars_${expl}.nc1325 if ${fscratch}; then rm ${ofile} >& /dev/null; fi1326 if test ! -f ${ofile}; then1327 Nconfc=`ls -1 ${odir}/simout_${prn}mapdiags_*${expl}*.nc | wc -l | awk '{print $1}'`1328 if test ${Nconfc} -gt 1; then1329 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 all1333 if test $? -ne 0; then1334 echo ${errmsg}1335 echo " python failed!!"1336 echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}\1337 -f ${HMT} -v all1338 exit1339 fi1340 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 else1346 ffilen=`ls -1 ${odir}/simout_${prn}mapdiags_*${expl}*.nc`1347 cp ${ffilen} ${ofile}1348 fi1349 fi1350 iexp=`expr ${iexp} + 1`1351 # end of experiments1352 done1353 650 1354 651 ###
Note: See TracChangeset
for help on using the changeset viewer.