Changeset 2390 in lmdz_wrf for trunk


Ignore:
Timestamp:
Mar 11, 2019, 2:42:10 PM (6 years ago)
Author:
lfita
Message:

Adding:

  • `rhs_tas_tds': Computation of relative humidity from tas and tds
Location:
trunk/tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diag_tools.py

    r2387 r2390  
    21332133
    21342134    return hur
     2135
     2136def var_hur_tas_tds(tas, tds, dimns, dimvns):
     2137    """ Function to compute hur relative humidity from tas and tds
     2138      tas= surface temperature [K]
     2139      tds= dew point temperature [K]
     2140      Magnus formula with D. Bolton, 1980, Mon. Wea. Rev. values:
     2141            gamma = log(hur/100) + b*tas/(c+tas)
     2142            tdps = c*gamma/(b-gamma)
     2143         hur = 100*expr[b(tdps/(c+tdps)-tas/(c+tas))]
     2144
     2145    """
     2146    fname = 'compute_hur_tas_tds'
     2147
     2148    dnamesvar = dimns
     2149    dvnamesvar = dimvns
     2150
     2151    tasC = tas - fdef.module_definitions.svpt0
     2152    tdsC = tds - fdef.module_definitions.svpt0
     2153
     2154    # Magnus formula with D. Bolton, 1980, Mon. Wea. Rev. values
     2155    b = 17.67
     2156    c = 243.5
     2157
     2158    hur = np.exp(b*(tdsC/(c+tdsC)-tasC/(c+tasC)))
     2159               
     2160    return hur, dnamesvar, dvnamesvar
    21352161
    21362162def var_td(t, p, qv):
  • trunk/tools/diagnostics.inf

    r2389 r2390  
    2020hur, WRFrh, WRFrh@T@P@PB
    2121hurs, LMDZrhs, psol@t2m@q2m
     22hurs, rhs_tas_tds, rhs_tas-tds|tas@tds
    2223hurs, TSrhs, psfc@t@q
    2324hurs, WRFrhs, PSFC@T2@Q2
     
    4647tdas, TStdas, psfc@t@q
    4748tdas, WRFtdas, PSFC@T2@Q2
     49tws, tws, tas@hurs
    4850tws, WRFtws, PSFC@T2@Q2
    4951ua, WRFua, U@V@SINALPHA@COSALPHA
  • trunk/tools/diagnostics.py

    r2387 r2390  
    9090    #######
    9191availdiags = ['ACRAINTOT', 'accum', 'clt', 'cllmh', 'convini', 'deaccum', 'fog_K84', \
    92   'fog_RUC', 'LMDZrh', 'mslp', 'OMEGAw', 'RAINTOT', 'range_faces',                   \
    93   'rvors', 'td', 'timemax', 'timeoverthres', 'turbulence', 'uavaFROMwswd',           \
     92  'fog_RUC', 'rhs_tas_tds', 'LMDZrh', 'mslp', 'OMEGAw', 'RAINTOT', 'range_faces',    \
     93  'rvors', 'td', 'timemax', 'timeoverthres', 'turbulence', 'tws', 'uavaFROMwswd',    \
    9494  'WRFbnds', 'WRFcape_afwa', 'WRFclivi', 'WRFclwvi', 'WRF_denszint', 'WRFgeop',      \
    9595  'WRFmrso', 'WRFmrsos', 'WRFpotevap_orPM', 'WRFp', 'WRFpsl_ecmwf',                  \
    9696  'WRFpsl_ptarget', 'WRFrvors', 'WRFslw', 'ws', 'wds', 'wss', 'WRFheight',           \
    97   'WRFheightrel', 'WRFtda', 'WRFtdas', 'WRFua', 'WRFva', 'WRFzwind', 'WRFzwind_log', \
    98   'WRFzwindMO']
     97  'WRFheightrel', 'WRFtda', 'WRFtdas', 'WRFtws', 'WRFua', 'WRFva', 'WRFzwind',      \
     98  'WRFzwind_log', 'WRFzwindMO']
    9999
    100100methods = ['accum', 'deaccum']
     
    516516varsadd = []
    517517
     518Varns = ncobj.variables.keys()
     519Varns.sort()
     520
    518521for idiag in range(Ndiags):
    519522    print '    diagnostic:',diags[idiag]
     
    535538                    print '  ' + main + ": file '" + opts.ncfile +                   \
    536539                      "' does not have variable '" + depv + "' !!"
     540                    print '    available ones:', Varns
    537541                    quit(-1)
    538542        else:
     
    544548                print '  ' + main + ": file '" + opts.ncfile +                       \
    545549                  "' does not have variable '" + depvars + "' !!"
     550                print '    available ones:', Varns
    546551                quit(-1)
    547552
     
    928933        ncvar.insert_variable(ncobj, 'lat_bnds', cellbndsy, diagoutd, diagoutvd, newnc)
    929934
    930 # tws: Bet Wulb temperature following Stull 2011 (tas, hur)
    931     elif diagn == 'rws':
    932            
    933         var0 = ncobj.variables[depvars[0]][:]
    934         var1 = ncobj.variables[depvars[1]][:]
    935 
    936         diagout, diagoutd, diagoutvd = diag.var_tws_S11(var0,var1,dnames,dvnames)
     935# tws: Bet Wulb temperature following Stull 2011 (tas, hurs)
     936    elif diagn == 'tws':
     937           
     938        var0 = ncobj.variables[depvars[0]][:]
     939        var1 = ncobj.variables[depvars[1]][:]
     940
     941        dnamesvar = list(ncobj.variables[depvars[0]].dimensions)
     942        dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
     943        diagoutd = dnames
     944        diagoutvd = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
     945
     946        diagout = diag.var_tws_S11(var0,var1)
    937947        ncvar.insert_variable(ncobj, 'tws', diagout, diagoutd, diagoutvd, newnc)
    938948
     
    12241234        ncvar.insert_variable(ncobj, 'hurs', diagout, diagoutd, diagoutvd, newnc)
    12251235
     1236# rhs (psfc, t, q) from tas, tds
     1237    elif diagn == 'rhs_tas_tds':
     1238           
     1239        var0 = ncobj.variables[depvars[0]][:]
     1240        var1 = ncobj.variables[depvars[1]][:]
     1241
     1242        dnamesvar = ncobj.variables[depvars[0]].dimensions
     1243        dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
     1244
     1245        diagout, diagoutd, diagoutvd = diag.var_hur_tas_tds(var0,var1,dnamesvar,     \
     1246          dvnamesvar)
     1247
     1248        ncvar.insert_variable(ncobj, 'hurs', diagout, diagoutd, diagoutvd, newnc)
     1249
    12261250# slw: total soil liquid water SH2O, DZS
    12271251    elif diagn == 'WRFslw':
Note: See TracChangeset for help on using the changeset viewer.