Changeset 1685 in lmdz_wrf for trunk/tools/diag_tools.py


Ignore:
Timestamp:
Dec 4, 2017, 7:30:21 PM (7 years ago)
Author:
lfita
Message:

Adding:

  • `var_td': Function to compute dew-point air temperature from temperature and pressure values
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diag_tools.py

    r1680 r1685  
    3030# var_clt: Function to compute the total cloud fraction following 'newmicro.F90' from LMDZ using 1D vertical column values
    3131# var_mslp: Fcuntion to compute mean sea-level pressure
     32# var_td: Function to compute dew-point air temperature from temperature and pressure values
    3233# var_virtualTemp: This function returns virtual temperature in K,
    3334# var_WRFtime: Function to copmute CFtimes from WRFtime variable
     
    10701071
    10711072    return td, dnamesvar, dvnamesvar
     1073
     1074def var_td(t, p, qv):
     1075    """ Function to compute dew-point air temperature from temperature and pressure values
     1076      t= temperature [K]
     1077      p= pressure (Pa)
     1078      formula:
     1079          temp = theta*(p/p0)**(R/Cp)
     1080
     1081    """
     1082    fname = 'compute_td'
     1083
     1084    tk = (t)*(p/fdef.module_definitions.p0ref)**(fdef.module_definitions.rcp)
     1085    data1 = 10.*0.6112*np.exp(17.67*(tk-273.16)/(tk-29.65))
     1086    data2 = 0.622*data1/(0.01*p-(1.-0.622)*data1)
     1087
     1088    rh = qv/data2
     1089               
     1090    pa = rh * data1
     1091    td = 257.44*np.log(pa/6.1121)/(18.678-np.log(pa/6.1121))
     1092
     1093    return td
Note: See TracChangeset for help on using the changeset viewer.