Changeset 908 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Jun 19, 2016, 10:05:46 PM (8 years ago)
Author:
lfita
Message:

Adding vertical interpolation

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/model_graphics.bash

    r898 r908  
    162162#        lsec: longitudinal section (longitudinal value must be given, [var]@[lat])
    163163#        lmean: longitudinal mean values
     164#        pinterp: pressure interpolation (to the given $plevels)
    164165#        tmean: temporal mean values
    165166#        zsum: vertical aggregated values
     
    205206
    206207    # Computing variable
    207     filen=${odir}/${CFvarn}_${headerf}_${ifile}-${Ntotfiles}.nc
     208    if test ${vark} == 'pinterp'; then
     209      fhead=${headerf}p
     210    else
     211      fhead=${headerf}
     212    fi
     213
     214    filen=${odir}/${CFvarn}_${fhead}_${ifile}-${Ntotfiles}.nc
    208215    if ${scratch}; then
    209216      rm ${filen} >& /dev/null
    210       rm ${odir}/${CFvarn}_${headerf}.nc >& /dev/null
     217      rm ${odir}/${CFvarn}_${fhead}.nc >& /dev/null
    211218    fi
    212219
    213     if test ! -f ${filen} && test ! -f ${odir}/${CFvarn}_${headerf}.nc; then
     220    if test ! -f ${filen} && test ! -f ${odir}/${CFvarn}_${fhead}.nc; then
    214221      if test ! ${modvar} = 'None'; then
    215222        # model variable
     
    255262        WRF_toCF ${filen} ${vdnx} ${vdny}
    256263      fi
     264      # Attaching necessary variables for the pressure interpolation
     265      if test ${vark} == 'pinterp'; then
     266        requiredinterpvars='P:PB:PSFC:PH:PHB:HGT:T:QVAPOR:'
     267        rqvs=`echo ${requiredinterpvars} | tr ':' ' '`
     268        echo "  "${fname}": adding variables: "${rqvs}" to allow pressure interpolation"
     269        for rqv in ${rqvs}; do
     270          pyout=`${pyHOME}/nc_var.py -o fvaradd -S ${cf},${rqv} -f ${filen}`
     271          pyn=$?
     272          Spyout=`echo ${pyout} | tr '\n' '#' | tr ' ' '!'`
     273          ferrmsgF ${pyn} ${fname} "python!'fvaradd'!failed#"${Spyout} ${filen}
     274        done
     275      fi
    257276    fi
     277
    258278
    259279    ifile=`expr ${ifile} + 1`
     
    262282
    263283  # Joining variable files
    264   filen=${odir}/${CFvarn}_${headerf}.nc
     284  filen=${odir}/${CFvarn}_${fhead}.nc
    265285  if ${scratch}; then rm ${filen} >& /dev/null; fi
    266286
    267287  if test ! -f ${filen}; then
    268     pyout=`python ${pyHOME}/nc_var.py -f ${CFvarn}_${headerf}_                       \
    269       -o netcdf_fold_concatenation -S ./,time -v all`
     288    pyout=`python ${pyHOME}/nc_var.py -f ${CFvarn}'_'${fhead}'_,-,.nc'               \
     289      -o netcdf_fold_concatenation_HMT -S ./,time -v all`
    270290    pyn=$?
    271291    Spyout=`echo ${pyout} | tr '\n' '#' | tr ' ' '!'`
    272     ferrmsg ${pyn} ${fname} "python!'netcdf_fold_concatenation'!failed#"${Spyout}
    273 
    274     mv netcdf_fold_concatenated.nc ${filen}
     292    ferrmsg ${pyn} ${fname} "python!'netcdf_fold_concatenation_HMT'!failed#"${Spyout}
     293    mv netcdf_fold_concatenated_HMT.nc ${filen}
    275294    if test -f ${filen}; then
    276       rm ${CFvarn}_${headerf}_*
     295      rm ${CFvarn}_${fhead}_*-*.nc
    277296    fi
    278297  fi
     
    294313#        lmean: longitudinal mean values
    295314#        lsec: longitudinal section (longitudinal value must be given, [var]@[lat])
     315#        pinterp: pressure interpolation (to the given $plevels)
    296316#        tmean: temporal mean values
    297317#        xmean: x-axis mean values
     
    371391        exit
    372392      ;;
     393      # pinterp: pressure interpolation (to the given $plevels)
     394      'pinterp')
     395        vals=${plevels}',1,1'
     396        python $pyHOME/nc_var.py -o pinterp -f ${cfiles} -S ${vals} -v ${CFvarn}
     397      ;;
    373398      # temporal mean values
    374399      'tmean')
     
    441466else
    442467  scratch=false
     468fi
     469
     470if test ${debug} = 'true'; then
     471  dbg=true
     472else
     473  dbg=false
    443474fi
    444475
     
    574605          'lsec')
    575606            varvks=${varlsec}
     607          ;;
     608          'pinterp')
     609            varvks=${varpinterp}
    576610          ;;
    577611          'tmean')
     
    689723      modv=`echo ${cvar} | tr '|' ' ' | awk '{print $4}'`
    690724      diagv=`echo ${cvar} | tr '|' ' ' | awk '{print $5}'`
    691       echo "        "${CFv}"; "${modv}" "${diagv}
     725      if ${dbg}; then echo "        "${CFv}"; "${modv}" "${diagv}; fi
    692726
    693727      if test ! ${modv} = 'None' || test ! ${diagv} = 'None'; then
     
    705739        fi
    706740      else
    707         echo "        not computing '"${CFv}"' for model '"${mod}"' !!"
     741        if ${dbg}; then echo "        not '"${CFv}"' for model '"${mod}"' !!"; fi
    708742      fi
    709743
  • trunk/tools/model_graphics_template.dat

    r898 r908  
    2020# Srcatch
    2121scratch=false
     22
     23# Debug
     24debug=false
    2225
    2326# Folder with the files
     
    5457#   lmean: longitudinal mean values
    5558#   lsec: longitudinal section (longitudinal value must be given, [var]@[lat])
     59#   pinterp: pressure interpolation (to the given $plevels, see below)
    5660#   tmean: temporal mean values
    5761#   xmean: x-axis mean values
    5862#   ymean: y-axis mean values
    5963#   zsum: vertical aggregated values
    60 varkinds = direct:tmean:xmean:diff
     64varkinds = direct:tmean:xmean:diff:pinterp
    6165
    6266# variables (providing CF-name, script must provide equivalent variable for each model)
     
    6771varxmean = ta:ua:va:hur
    6872vardiff = ualmean:valmean:talmean:huslmean:uas:vas:ps:pr
     73varpinterp = ta:ua:va:hur
    6974
     75# Pressure levels
     76#   Common vertical pressure levels to compute vertical differences
     77plevels = 100000.:97500.:95000.:92500.:90000.:85000.:80000.:75000.:70000.:65000.:60000.:55000.:50000.:45000.:40000.:35000.:30000.:25000.:20000.:15000.:10000.:5000.:2500.:1000.:500.:250.
    7078# Kind of plots
    7179#   diffmap2Dsfc: 2D map of surface differences values of 1 variable
     
    7987diffmap2Dz = ualmean:valmean:talmean:huslmean
    8088
    81 # Pressure levels
    82 #   Common vertical pressure levels to compute vertical differences
    83 plevels = 100000.,97500.,95000.,92500.,90000.,85000.,80000.,75000.,70000.,65000.,60000.,55000.,50000.,45000.,40000.,35000.,30000.,25000.,20000.,15000.,10000.,5000.,2500.,1000.,500.,250.
    84 
    8589# Figures output
    8690kindfig = pdf
Note: See TracChangeset for help on using the changeset viewer.