Changeset 2039 in lmdz_wrf


Ignore:
Timestamp:
Aug 7, 2018, 4:23:18 PM (7 years ago)
Author:
lfita
Message:

Improving when no variables are required following different iterations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/get_data_snd-sfc_validation.bash

    r2038 r2039  
    6262
    6363    # Sounding values
    64     ofile=${ofold}/simout_sndvars_${sndid}_${expn}.nc
    65     if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
    66     if test ! -f ${ofile}; then
    67       for filen in ${files}; do
    68         $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn}        \
    69           ${sndvn} None ${filen} ${snddiags},None,None,None,None
    70       # end of files
    71       done
    72 
    73     # Concatenating files
    74       values=${ofold}',Time,time'
    75       HMT='simout_snddiags_,'${sndid},'nc'
    76       python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}       \
    77        -f ${HMT} -v all
    78       if test $? -ne 0; then
    79         echo ${errmsg}
    80         echo "  python failed!!"
    81         echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}\
    82         -f ${HMT} -v all
    83         exit
    84       fi
    85       echo " * Concatenating sounding data at point: "${sndlon}", "${sndlat} >> \
    86         ${insoutf}
    87       echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S "'"${values}"'" \
    88        -f ${HMT} -v all >> ${insoutf}
    89       echo " " >> ${insoutf}
    90       mv netcdf_fold_concatenated_HMT.nc ${ofile}
    91     fi
     64    if test ${snddiags} != 'None'; then
     65      ofile=${ofold}/simout_sndvars_${sndid}_${expn}.nc
     66      if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
     67      if test ! -f ${ofile}; then
     68        for filen in ${files}; do
     69          $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn}      \
     70            ${sndvn} None ${filen} ${snddiags},None,None,None,None
     71        # end of files
     72        done
     73
     74      # Concatenating files
     75        values=${ofold}',Time,time'
     76        HMT='simout_snddiags_,'${sndid},'nc'
     77        python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}     \
     78         -f ${HMT} -v all
     79        if test $? -ne 0; then
     80          echo ${errmsg}
     81          echo "  python failed!!"
     82          echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT           \
     83          -S ${values} -f ${HMT} -v all
     84          exit
     85        fi
     86        echo " * Concatenating sounding data at point: "${sndlon}", "${sndlat} >>    \
     87          ${insoutf}
     88        echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT            \
     89         -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
     90        echo " " >> ${insoutf}
     91        mv netcdf_fold_concatenated_HMT.nc ${ofile}
     92      fi
     93     fi
    9294
    9395    files=`ls -1 ${infolder}/${expn}/wrfout/wrfcdx_d${domn}*`
    9496
    9597    # cordex values
    96     ofile=${ofold}/simcdx_sndvars_${sndid}_${expn}.nc
    97     if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
    98     if test ! -f ${ofile}; then
    99       for filen in ${files}; do
    100         $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn}        \
    101           ${sndvn} None ${filen} None,None,None,${cdxdiags},${cdxnondiags}
    102       # end of files
    103       done
    104 
    105     # Concatenating files
    106       values=${ofold}',Time,time'
    107       HMT='simcdx_snddiags_,'${sndid},'nc'
    108       python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}       \
    109        -f ${HMT} -v all
    110       if test $? -ne 0; then
    111         echo ${errmsg}
    112         echo "  python failed!!"
    113         echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}\
    114         -f ${HMT} -v all
    115         exit
    116       fi
    117       echo " * Concatenating cdx sounding data at point: "${sndlon}", "${sndlat} >>  \
    118         ${insoutf}
    119       echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S "'"${values}"'" \
    120        -f ${HMT} -v all >> ${insoutf}
    121       echo " " >> ${insoutf}
    122       mv netcdf_fold_concatenated_HMT.nc ${ofile}
    123     fi
    124 
     98    if test ${cdxdiags} != 'None' || ${cdxnondiags} != 'None'; then
     99      ofile=${ofold}/simcdx_sndvars_${sndid}_${expn}.nc
     100      if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
     101      if test ! -f ${ofile}; then
     102        for filen in ${files}; do
     103          $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn}      \
     104            ${sndvn} None ${filen} None,None,None,${cdxdiags},${cdxnondiags}
     105        # end of files
     106        done
     107
     108      # Concatenating files
     109        values=${ofold}',Time,time'
     110        HMT='simcdx_snddiags_,'${sndid},'nc'
     111        python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}     \
     112         -f ${HMT} -v all
     113        if test $? -ne 0; then
     114          echo ${errmsg}
     115          echo "  python failed!!"
     116          echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT           \
     117            -S ${values} -f ${HMT} -v all
     118          exit
     119        fi
     120        echo " * Concatenating cdx sounding data at point: "${sndlon}", "${sndlat} >>\
     121          ${insoutf}
     122        echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT            \
     123         -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
     124        echo " " >> ${insoutf}
     125        mv netcdf_fold_concatenated_HMT.nc ${ofile}
     126      fi
     127     fi
    125128  # end of sounding stations
    126129  done
     
    134137    files=`ls -1 ${infolder}/${expn}/wrfout/wrfout_d${domn}*`
    135138
    136     ofile=${ofold}/simout_sfcvars_${sfcid}_${expn}.nc
    137     if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
    138     if test ! -f ${ofile}; then
    139       for filen in ${files}; do
    140         $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn} None   \
    141           ${sfcvn} ${filen} None,${sfcdiags},${sfcnondiags},None,None
    142       # end of files
    143       done
    144 
    145     # Concatenating files
    146       values=${ofold}',Time,time'
    147       HMT='simout_sfcdiags_,'${sfcid},'nc'
    148       python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}         \
    149        -f ${HMT} -v all
    150       if test $? -ne 0; then
    151         echo ${errmsg}
    152         echo "  python failed!!"
    153         echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}  \
    154         -f ${HMT} -v all
    155         exit
    156       fi
    157       echo " * Concatenating surface data at point: "${sfclon}", "${sfclat} >> ${insoutf}
    158       echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S "'"${values}"'" \
    159        -f ${HMT} -v all >> ${insoutf}
    160       echo " " >> ${insoutf}
    161       mv netcdf_fold_concatenated_HMT.nc ${ofile}
     139    # out maps
     140    if test ${sfcdiags} != 'None' || test ${sfcnondiags} != 'None'; then
     141      ofile=${ofold}/simout_sfcvars_${sfcid}_${expn}.nc
     142      if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
     143      if test ! -f ${ofile}; then
     144        for filen in ${files}; do
     145          $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn} None \
     146            ${sfcvn} ${filen} None,${sfcdiags},${sfcnondiags},None,None
     147        # end of files
     148        done
     149
     150      # Concatenating files
     151        values=${ofold}',Time,time'
     152        HMT='simout_sfcdiags_,'${sfcid},'nc'
     153        python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}     \
     154         -f ${HMT} -v all
     155        if test $? -ne 0; then
     156          echo ${errmsg}
     157          echo "  python failed!!"
     158          echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT           \
     159            -S ${values} -f ${HMT} -v all
     160          exit
     161        fi
     162        echo " * Concatenating surface data at point: "${sfclon}", "${sfclat} >> ${insoutf}
     163        echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT            \
     164         -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
     165        echo " " >> ${insoutf}
     166        mv netcdf_fold_concatenated_HMT.nc ${ofile}
     167      fi
    162168    fi
    163169
    164     files=`ls -1 ${infolder}/${expn}/wrfout/wrfcdx_d${domn}*`
    165 
    166     ofile=${ofold}/simcdx_sfcvars_${sfcid}_${expn}.nc
    167     if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
    168     if test ! -f ${ofile}; then
    169       for filen in ${files}; do
    170         $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn} None   \
    171           ${sfcvn} ${filen} None,None,None,${cdxdiags},${cdxnondiags}
    172       # end of files
    173       done
    174 
    175     # Concatenating files
    176       values=${ofold}',Time,time'
    177       HMT='simcdx_sfcdiags_,'${sfcid},'nc'
    178       python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}         \
    179        -f ${HMT} -v all
    180       if test $? -ne 0; then
    181         echo ${errmsg}
    182         echo "  python failed!!"
    183         echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}  \
    184         -f ${HMT} -v all
    185         exit
    186       fi
    187       echo " * Concatenating cdx surface data at point: "${sfclon}", "${sfclat} >> ${insoutf}
    188       echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S "'"${values}"'" \
    189        -f ${HMT} -v all >> ${insoutf}
    190       echo " " >> ${insoutf}
    191       mv netcdf_fold_concatenated_HMT.nc ${ofile}
     170    # cdx maps
     171    if test ${cdxdiags} != 'None' || test ${cdxnondiags} != 'None'; then
     172      files=`ls -1 ${infolder}/${expn}/wrfout/wrfcdx_d${domn}*`
     173      ofile=${ofold}/simcdx_sfcvars_${sfcid}_${expn}.nc
     174      if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
     175      if test ! -f ${ofile}; then
     176        for filen in ${files}; do
     177          $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn} None \
     178            ${sfcvn} ${filen} None,None,None,${cdxdiags},${cdxnondiags}
     179        # end of files
     180        done
     181
     182      # Concatenating files
     183        values=${ofold}',Time,time'
     184        HMT='simcdx_sfcdiags_,'${sfcid},'nc'
     185        python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}     \
     186         -f ${HMT} -v all
     187        if test $? -ne 0; then
     188          echo ${errmsg}
     189          echo "  python failed!!"
     190          echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT           \
     191            -S ${values} -f ${HMT} -v all
     192          exit
     193        fi
     194        echo " * Concatenating cdx surface data at point: "${sfclon}", "${sfclat} >> ${insoutf}
     195        echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT            \
     196         -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
     197        echo " " >> ${insoutf}
     198        mv netcdf_fold_concatenated_HMT.nc ${ofile}
     199      fi
     200      #exit
    192201    fi
    193     #exit
    194202
    195203  # end of surfaces
     
    203211    if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
    204212    if test ! -f ${ofile}; then
    205 
    206     # Concatenating files
     213      # Concatenating files
    207214      values=${ofold}',Time,time'
    208215      HMT='sim'${ik}'_sfcmapdiags_,'${expn},'nc'
    209       python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}         \
    210        -f ${HMT} -v all
    211       if test $? -ne 0; then
    212         echo ${errmsg}
    213         echo "  python failed!!"
    214         echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}  \
    215         -f ${HMT} -v all
    216         exit
    217       fi
    218       echo " * Concatenating '${ik}' surface map data: " >> ${insoutf}
    219       echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S "'"${values}"'" \
    220        -f ${HMT} -v all >> ${insoutf}
    221       echo " " >> ${insoutf}
    222       mv netcdf_fold_concatenated_HMT.nc ${ofile}
     216      Nfiles=`ls -1 ${ofold}/sim${ik}_sfcmapdiags_*${expn}*.nc | wc -l |             \`
     217        awk '{print $1}'
     218      if test ${Nfiles} -gt 0; then
     219        python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}     \
     220         -f ${HMT} -v all
     221        if test $? -ne 0; then
     222          echo ${errmsg}
     223          echo "  python failed!!"
     224          echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT           \
     225            -S ${values} -f ${HMT} -v all
     226          exit
     227        fi
     228        echo " * Concatenating '${ik}' surface map data: " >> ${insoutf}
     229        echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT            \
     230         -S "'"${values}"'" -f ${HMT} -v all >> ${insoutf}
     231        echo " " >> ${insoutf}
     232        mv netcdf_fold_concatenated_HMT.nc ${ofile}
     233      fi
    223234    fi
    224235  done
Note: See TracChangeset for help on using the changeset viewer.