- Timestamp:
- Mar 11, 2019, 2:42:10 PM (6 years ago)
- Location:
- trunk/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diag_tools.py
r2387 r2390 2133 2133 2134 2134 return hur 2135 2136 def 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 2135 2161 2136 2162 def var_td(t, p, qv): -
trunk/tools/diagnostics.inf
r2389 r2390 20 20 hur, WRFrh, WRFrh@T@P@PB 21 21 hurs, LMDZrhs, psol@t2m@q2m 22 hurs, rhs_tas_tds, rhs_tas-tds|tas@tds 22 23 hurs, TSrhs, psfc@t@q 23 24 hurs, WRFrhs, PSFC@T2@Q2 … … 46 47 tdas, TStdas, psfc@t@q 47 48 tdas, WRFtdas, PSFC@T2@Q2 49 tws, tws, tas@hurs 48 50 tws, WRFtws, PSFC@T2@Q2 49 51 ua, WRFua, U@V@SINALPHA@COSALPHA -
trunk/tools/diagnostics.py
r2387 r2390 90 90 ####### 91 91 availdiags = ['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', \ 94 94 'WRFbnds', 'WRFcape_afwa', 'WRFclivi', 'WRFclwvi', 'WRF_denszint', 'WRFgeop', \ 95 95 'WRFmrso', 'WRFmrsos', 'WRFpotevap_orPM', 'WRFp', 'WRFpsl_ecmwf', \ 96 96 'WRFpsl_ptarget', 'WRFrvors', 'WRFslw', 'ws', 'wds', 'wss', 'WRFheight', \ 97 'WRFheightrel', 'WRFtda', 'WRFtdas', 'WRF ua', 'WRFva', 'WRFzwind', 'WRFzwind_log',\98 'WRFzwind MO']97 'WRFheightrel', 'WRFtda', 'WRFtdas', 'WRFtws', 'WRFua', 'WRFva', 'WRFzwind', \ 98 'WRFzwind_log', 'WRFzwindMO'] 99 99 100 100 methods = ['accum', 'deaccum'] … … 516 516 varsadd = [] 517 517 518 Varns = ncobj.variables.keys() 519 Varns.sort() 520 518 521 for idiag in range(Ndiags): 519 522 print ' diagnostic:',diags[idiag] … … 535 538 print ' ' + main + ": file '" + opts.ncfile + \ 536 539 "' does not have variable '" + depv + "' !!" 540 print ' available ones:', Varns 537 541 quit(-1) 538 542 else: … … 544 548 print ' ' + main + ": file '" + opts.ncfile + \ 545 549 "' does not have variable '" + depvars + "' !!" 550 print ' available ones:', Varns 546 551 quit(-1) 547 552 … … 928 933 ncvar.insert_variable(ncobj, 'lat_bnds', cellbndsy, diagoutd, diagoutvd, newnc) 929 934 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) 937 947 ncvar.insert_variable(ncobj, 'tws', diagout, diagoutd, diagoutvd, newnc) 938 948 … … 1224 1234 ncvar.insert_variable(ncobj, 'hurs', diagout, diagoutd, diagoutvd, newnc) 1225 1235 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 1226 1250 # slw: total soil liquid water SH2O, DZS 1227 1251 elif diagn == 'WRFslw':
Note: See TracChangeset
for help on using the changeset viewer.