Changeset 1710 in lmdz_wrf
- Timestamp:
- Dec 12, 2017, 11:40:43 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diag_tools.py
r1702 r1710 19 19 # compute_wds: Function to compute the wind direction 20 20 # compute_wss: Function to compute the wind speed 21 # compute_WRFhur: Function to compute WRF relative humidity following Teten's equation 21 22 # compute_WRFta: Function to compute WRF air temperature 22 23 # compute_WRFtd: Function to compute WRF dew-point air temperature … … 982 983 return times 983 984 985 def compute_WRFhur(t, p, qv, dimns, dimvns): 986 """ Function to compute WRF relative humidity following Teten's equation 987 t= orginal WRF temperature 988 p= original WRF pressure (P + PB) 989 formula: 990 temp = theta*(p/p0)**(R/Cp) 991 992 """ 993 fname = 'compute_WRFtd' 994 995 tk = (t+300.)*(p/fdef.module_definitions.p0ref)**(fdef.module_definitions.rcp) 996 data1 = 10.*0.6112*np.exp(17.67*(tk-273.16)/(tk-29.65)) 997 data2 = 0.622*data1/(0.01*p-(1.-0.622)*data1) 998 999 rh = qv/data2 1000 1001 dnamesvar = ['Time','bottom_top','south_north','west_east'] 1002 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dimns,dimvns) 1003 1004 return rh, dnamesvar, dvnamesvar 1005 984 1006 def compute_WRFua(u, v, sina, cosa, dimns, dimvns): 985 1007 """ Function to compute geographical rotated WRF 3D winds … … 1429 1451 self.units = None 1430 1452 1431 if Wdiag == 'p': 1453 if Wdiag == 'hur': 1454 """ Computing relative humidity 1455 """ 1456 vn = 'hur' 1457 CF3Dvars = ['ta', 'hus'] 1458 for v3D in CF3Dvars: 1459 if not vars3D.has_key(v3D): 1460 print gen.errormsg 1461 print ' ' + fname + ": missing variable '" + v3D + \ 1462 "' attribution to compute '" + vn + "' !!" 1463 print ' Equivalence of 3D variables provided _______' 1464 gen.printing_dictionary(vars3D) 1465 quit(-1) 1466 1467 ta = ncobj.variables['T'][:] 1468 p = ncobj.variables['P'][:] + ncobj.variables['PB'][:] 1469 hur = ncobj.variables['QVAPOR'][:] 1470 1471 vals, dims, vdims = compute_WRFhur(ta, p, hur, indims, invardims) 1472 self.values = vals 1473 self.dims = [dictdims['time'], dictdims['plev'], dictdims['lat'], \ 1474 dictdims['lon']] 1475 self.units = '1' 1476 1477 elif Wdiag == 'p': 1432 1478 """ Computing air pressure 1433 1479 """ … … 1478 1524 ta = ncobj.variables['T'][:] 1479 1525 p = ncobj.variables['P'][:] + ncobj.variables['PB'][:] 1480 hu r= ncobj.variables['QVAPOR'][:]1481 1482 vals, dims, vdims = compute_WRFtd(ta, p, hu r, indims, invardims)1526 hus = ncobj.variables['QVAPOR'][:] 1527 1528 vals, dims, vdims = compute_WRFtd(ta, p, hus, indims, invardims) 1483 1529 self.values = vals 1484 1530 self.dims = [dictdims['time'], dictdims['plev'], dictdims['lat'], \
Note: See TracChangeset
for help on using the changeset viewer.