Changeset 2067 in lmdz_wrf


Ignore:
Timestamp:
Aug 10, 2018, 3:57:28 PM (7 years ago)
Author:
lfita
Message:

Adding more generality to get_data_snd-sfc_validation.bash
Fixing no processing of cdxsnd_pt !

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/get_WRFsounding-surface_data.bash

    r2066 r2067  
    867867    if test ! ${wrfcdxdiags} = 'None' || test ! ${wrfcdxnodiags} = 'None'; then
    868868      stid=${sndid}
    869       simsfcptf=${odir}'/simcdx_vars_sfcpt_'${stid}'_'${expl}'_'${fdate}'.nc'
    870       simsfcdiagsf=${odir}'/simcdx_sfcdiags_'${stid}'_'${expl}'_'${fdate}'.nc'
     869      simsfcptf=${odir}'/simcdx_vars_sndpt_'${stid}'_'${expl}'_'${fdate}'.nc'
     870      simsfcdiagsf=${odir}'/simcdx_snddiags_'${stid}'_'${expl}'_'${fdate}'.nc'
    871871 
    872872      fvals=${sndlon}'#'${sndlat}'#'${infilen}'#LON#LAT#'${wrfcdxdiags}'#'
  • trunk/tools/get_data_snd-sfc_validation.bash

    r2057 r2067  
    6161    sndlat=`echo ${sndvn} | tr ',' ' ' | awk '{print $3}'`
    6262
    63     files=`ls -1 ${infolder}/${expn}/wrfout/wrfout_d${domn}*`
    64 
     63    kout='snd'
     64    filek='_vars_'${kout}'pt _'${kout}'diags'
    6565    # Sounding values
    6666    if test ! ${snddiags} = 'None'; then
    67       ofile=${ofold}/simout_sndvars_${sndid}_${expn}.nc
     67      fHEADn='simout'
     68      files=`ls -1 ${infolder}/${expn}/wrfout/wrfout_d${domn}*`
     69      ofile=${ofold}/${fHEADn}_${kout}diags_${sndid}_${expn}.nc
    6870      if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
    6971      if test ! -f ${ofile}; then
     
    7476        done
    7577
    76       # Concatenating files
    77         values=${ofold}',Time,time'
    78         HMT='simout_snddiags_,'${sndid}'_'${expn},'nc'
    79         python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}     \
    80          -f ${HMT} -v all
    81         if test $? -ne 0; then
    82           echo ${errmsg}
    83           echo "  python failed!!"
    84           echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT           \
    85           -S ${values} -f ${HMT} -v all
    86           exit
    87         fi
    88         echo " * Concatenating sounding data at point: "${sndlon}", "${sndlat} >>    \
    89           ${insoutf}
    90         echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT            \
    91          -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
    92         echo " " >> ${insoutf}
    93         mv netcdf_fold_concatenated_HMT.nc ${ofile}
     78       # Concatenating files
     79        values=${ofold}',Time,time'
     80        for fk in ${filek}; do
     81          ofile=${ofold}/${fHEADn}${fk}_${sndid}_${expn}.nc
     82          HMT=${fHEADn}${fk}'_,'${sndid}'_'${expn},'nc'
     83          Nfiles=`ls -1 ${ofold}/${fHEADn}${fk}_*${sndid}_${expn}*.nc | wc -l`
     84          if test ${Nfiles} -gt 1; then
     85            python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \
     86             -f ${HMT} -v all
     87            if test $? -ne 0; then
     88              echo ${errmsg}
     89              echo "  python failed!!"
     90              echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT           \
     91              -S ${values} -f ${HMT} -v all
     92              exit
     93            fi
     94            echo " * Concatenating sounding data '"${fk}"' at point: "${sndid} >> ${insoutf}
     95            echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT            \
     96             -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
     97            echo " " >> ${insoutf}
     98            mv netcdf_fold_concatenated_HMT.nc ${ofile}
     99            rm ${ofold}/${fHEADn}${fk}_${sndid}_${expn}_????-??-??_??:??:??.nc >& /dev/null
     100          else
     101            file1=`ls -1 ${ofold}/${fHEADn}${fk}_*${sndid}_${expn}*.nc`
     102            mv ${file1} ${ofile}
     103          fi
     104        done
    94105      fi
    95106     fi
    96 
    97     files=`ls -1 ${infolder}/${expn}/wrfout/wrfcdx_d${domn}*`
    98107
    99108    # cordex values
    100109    if test ! ${cdxdiags} = 'None' || test ! ${cdxnondiags} = 'None'; then
    101       ofile=${ofold}/simcdx_sndvars_${sndid}_${expn}.nc
     110      fHEADn='simcdx'
     111      files=`ls -1 ${infolder}/${expn}/wrfout/wrfcdx_d${domn}*`
     112      ofile=${ofold}/${fHEADn}_${kout}diags_${sndid}_${expn}.nc
    102113      if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
    103114      if test ! -f ${ofile}; then
     
    108119        done
    109120
    110       # Concatenating files
    111         values=${ofold}',Time,time'
    112         HMT='simcdx_snddiags_,'${sndid}'_'${expn},'nc'
    113         Nfiles=`ls -1 ${ofold}/simcdx_snddiags_*${sndid}_${expn}*.nc | wc -l`
    114         if test ${Nfiles} -gt 0; then
    115           python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}   \
    116            -f ${HMT} -v all
    117           if test $? -ne 0; then
    118             echo ${errmsg}
    119             echo "  python failed!!"
    120             echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT         \
    121               -S ${values} -f ${HMT} -v all
    122             exit
    123           fi
    124           echo " * Concatenating cdx sounding data at point: "${sndlon}", "${sndlat} >>\
    125             ${insoutf}
    126           echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT          \
    127            -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
    128           echo " " >> ${insoutf}
    129           mv netcdf_fold_concatenated_HMT.nc ${ofile}
    130         fi
     121        # Concatenating files
     122        values=${ofold}',Time,time'
     123        for fk in ${filek}; do
     124          ofile=${ofold}/${fHEADn}${fk}_${sndid}_${expn}.nc
     125          HMT=${fHEADn}${fk}'_,'${sndid}'_'${expn},'nc'
     126          Nfiles=`ls -1 ${ofold}/${fHEADn}${fk}_*${sndid}_${expn}*.nc | wc -l`
     127          if test ${Nfiles} -gt 1; then
     128            python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}   \
     129             -f ${HMT} -v all
     130            if test $? -ne 0; then
     131              echo ${errmsg}
     132              echo "  python failed!!"
     133              echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT         \
     134                -S ${values} -f ${HMT} -v all
     135              exit
     136            fi
     137            echo " * Concatenating cdx sounding data at point: "${sndlon}", "${sndlat} >>\
     138              ${insoutf}
     139            echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT          \
     140             -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
     141            echo " " >> ${insoutf}
     142            mv netcdf_fold_concatenated_HMT.nc ${ofile}
     143            rm ${ofold}/${fHEADn}${fk}_${sndid}_${expn}_????-??-??_??:??:??.nc >& /dev/null
     144          else
     145            file1=`ls -1 ${ofold}/${fHEADn}${fk}_*${sndid}_${expn}*.nc`
     146            mv ${file1} ${ofile}
     147          fi
     148        done
    131149      fi
    132150     fi
     
    134152  done
    135153  fi
     154
     155  # Surface stations
    136156  if test ! ${sfcstations} = 'None'; then
    137157  for sfcvn in ${sfcsts}; do
     
    140160    sfclat=`echo ${sfcvn} | tr ',' ' ' | awk '{print $3}'`
    141161
    142     files=`ls -1 ${infolder}/${expn}/wrfout/wrfout_d${domn}*`
    143 
     162    kout='sfc'
     163    filek='_vars_'${kout}'pt _'${kout}'diags'
    144164    # out sfc pt
    145165    if test ! ${sfcdiags} = 'None' || test ! ${sfcnondiags} = 'None'; then
    146       ofile=${ofold}/simout_sfcvars_${sfcid}_${expn}.nc
     166      fHEADn='simout'
     167      files=`ls -1 ${infolder}/${expn}/wrfout/wrfout_d${domn}*`
     168      ofile=${ofold}/${fHEADn}_${kout}diags_${sfcid}_${expn}.nc
    147169      if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
    148170      if test ! -f ${ofile}; then
     
    155177        # Concatenating files
    156178        values=${ofold}',Time,time'
    157         HMT='simout_sfcdiags_,'${sfcid}'_'${expn},'nc'
    158         Nfiles=`ls -1 ${ofold}/simout_sfcdiags_*${sndid}_${expn}*.nc | wc -l`
     179        for fk in ${filek}; do
     180          ofile=${ofold}/${fHEADn}${fk}_${sfcid}_${expn}.nc
     181          HMT=${fHEADn}${fk}'_,'${sfcid}'_'${expn},'nc'
     182          Nfiles=`ls -1 ${ofold}/${fHEADn}${fk}_*${sfcid}_${expn}*.nc | wc -l`
     183          if test ${Nfiles} -gt 0; then
     184            python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}   \
     185             -f ${HMT} -v all
     186            if test $? -ne 0; then
     187              echo ${errmsg}
     188              echo "  python failed!!"
     189              echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT         \
     190                -S ${values} -f ${HMT} -v all
     191              exit
     192            fi
     193            echo " * Concatenating surface data '"${fk}"' at point: "${sfcid} >> ${insoutf}
     194            echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT          \
     195             -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
     196            echo " " >> ${insoutf}
     197            mv netcdf_fold_concatenated_HMT.nc ${ofile}
     198            rm ${ofold}/${fHEADn}${fk}_${sfcid}_${expn}_????-??-??_??:??:??.nc >& /dev/null
     199          else
     200            file1=`ls -1 ${ofold}/${fHEADn}${fk}_*${sfcid}_${expn}*.nc`
     201            mv ${file1} ${ofile}
     202          fi
     203        done
     204      fi
     205    fi
     206
     207    # cdx sfc pt
     208    if test ! ${cdxdiags} = 'None' || test ! ${cdxnondiags} = 'None'; then
     209      fHEADn='simcdx'
     210      files=`ls -1 ${infolder}/${expn}/wrfout/wrfcdx_d${domn}*`
     211      ofile=${ofold}/${fHEADn}_${kout}diags_${sfcid}_${expn}.nc
     212      if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
     213      if test ! -f ${ofile}; then
     214        for filen in ${files}; do
     215          $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn} None \
     216            ${sfcvn} ${filen} None,None,None,${cdxdiags},${cdxnondiags}
     217        # end of files
     218        done
     219
     220        # Concatenating files
     221        values=${ofold}',Time,time'
     222        for fk in ${filek}; do
     223          ofile=${ofold}/${fHEADn}${fk}_${sfcid}_${expn}.nc
     224          HMT=${fHEADn}${fk}'_,'${sfcid}'_'${expn},'nc'
     225          Nfiles=`ls -1 ${ofold}/${fHEADn}${fk}_*${sfcid}_${expn}*.nc | wc -l`
     226          if test ${Nfiles} -gt 0; then
     227            python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}   \
     228             -f ${HMT} -v all
     229            if test $? -ne 0; then
     230              echo ${errmsg}
     231              echo "  python failed!!"
     232              echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT         \
     233                -S ${values} -f ${HMT} -v all
     234              exit
     235            fi
     236            echo " * Concatenating cdx surface data at point: "${sfcid} >> ${insoutf}
     237            echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT          \
     238             -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
     239            echo " " >> ${insoutf}
     240            mv netcdf_fold_concatenated_HMT.nc ${ofile}
     241            rm ${ofold}/${fHEADn}${fk}_${sfcid}_${expn}_????-??-??_??:??:??.nc >& /dev/null
     242          else
     243            file1=`ls -1 ${ofold}/${fHEADn}${fk}_*${sfcid}_${expn}*.nc`
     244            mv ${file1} ${ofile}
     245          fi
     246        done
     247      fi
     248      #exit
     249    fi
     250
     251  # end of surfaces
     252  done
     253  fi
     254
     255  # 2D maps
     256  kout='sfcmap'
     257  filek='_vars_'${kout}' _'${kout}'diags'
     258  okind='out cdx'
     259  for ik in ${okind}; do
     260    fHEADn='sim'${ik}
     261    for fk in ${filek}; do
     262      ofile=${ofold}/${fHEADn}${fk}_${expn}.nc
     263      if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
     264      if test ! -f ${ofile}; then
     265        # Concatenating files
     266        values=${ofold}',Time,time'
     267        HMT=${fHEADn}${fk}'_,'${expn},'nc'
     268        Nfiles=`ls -1 ${ofold}/${fHEADn}${fk}_*${expn}*.nc | wc -l`
    159269        if test ${Nfiles} -gt 0; then
    160           python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}   \
     270          python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}     \
    161271           -f ${HMT} -v all
    162272          if test $? -ne 0; then
    163273            echo ${errmsg}
    164274            echo "  python failed!!"
    165             echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT         \
     275            echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT           \
    166276              -S ${values} -f ${HMT} -v all
    167277            exit
    168278          fi
    169           echo " * Concatenating surface data at point: "${sfclon}", "${sfclat} >> ${insoutf}
    170           echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT          \
     279          echo " * Concatenating '${ik}' surface map data: " >> ${insoutf}
     280          echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT            \
    171281           -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
    172282          echo " " >> ${insoutf}
    173283          mv netcdf_fold_concatenated_HMT.nc ${ofile}
     284          rm ${ofold}/${fHEADn}${fk}_${expn}_????-??-??_??:??:??.nc >& /dev/null
     285        else
     286          file1=`ls -1 ${ofold}/${fHEADn}${fk}_*${expn}*.nc`
     287          mv ${file1} ${ofile}
    174288        fi
    175289      fi
    176     fi
    177 
    178     # cdx sfc pt
    179     if test ! ${cdxdiags} = 'None' || test ! ${cdxnondiags} = 'None'; then
    180       files=`ls -1 ${infolder}/${expn}/wrfout/wrfcdx_d${domn}*`
    181       ofile=${ofold}/simcdx_sfcvars_${sfcid}_${expn}.nc
    182       if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
    183       if test ! -f ${ofile}; then
    184         for filen in ${files}; do
    185           $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn} None \
    186             ${sfcvn} ${filen} None,None,None,${cdxdiags},${cdxnondiags}
    187         # end of files
    188         done
    189 
    190       # Concatenating files
    191         values=${ofold}',Time,time'
    192         HMT='simcdx_sfcdiags_,'${sfcid}'_'${expn},'nc'
    193         Nfiles=`ls -1 ${ofold}/simcdx_sfcdiags_*${sndid}_${expn}*.nc | wc -l`
    194         if test ${Nfiles} -gt 0; then
    195           python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}   \
    196            -f ${HMT} -v all
    197           if test $? -ne 0; then
    198             echo ${errmsg}
    199             echo "  python failed!!"
    200             echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT         \
    201               -S ${values} -f ${HMT} -v all
    202             exit
    203           fi
    204           echo " * Concatenating cdx surface data at point: "${sfclon}", "${sfclat} >> ${insoutf}
    205           echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT          \
    206            -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
    207           echo " " >> ${insoutf}
    208           mv netcdf_fold_concatenated_HMT.nc ${ofile}
    209         fi
    210       fi
    211       #exit
    212     fi
    213 
    214   # end of surfaces
    215   done
    216   fi
    217 
    218   # 2D maps
    219   okind='out cdx'
    220   for ik in ${okind}; do
    221     ofile=${ofold}/sim${ik}_sfcmapvars_${expn}.nc
    222     if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
    223     if test ! -f ${ofile}; then
    224       # Concatenating files
    225       values=${ofold}',Time,time'
    226       HMT='sim'${ik}'_sfcmapdiags_,'${expn},'nc'
    227       Nfiles=`ls -1 ${ofold}/sim${ik}_sfcmapdiags_*${expn}*.nc | wc -l`
    228       if test ${Nfiles} -gt 0; then
    229         python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}     \
    230          -f ${HMT} -v all
    231         if test $? -ne 0; then
    232           echo ${errmsg}
    233           echo "  python failed!!"
    234           echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT           \
    235             -S ${values} -f ${HMT} -v all
    236           exit
    237         fi
    238         echo " * Concatenating '${ik}' surface map data: " >> ${insoutf}
    239         echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT            \
    240          -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
    241         echo " " >> ${insoutf}
    242         mv netcdf_fold_concatenated_HMT.nc ${ofile}
    243       fi
    244     fi
     290    done
    245291  done
    246292
Note: See TracChangeset for help on using the changeset viewer.