- matplotlib - numpy

Wet-Bulb Temperature Calculator

Temperature :

Relative Humidity :


Wet-bulb temperature in Celsius :


Wet-bulb temperature is computed adopting a method developed by Davies- Jones (Davies-Jones, 2008)

Davies-Jones, R. (2008). An Efficient and Accurate Method for Computing the Wet-Bulb Temperature along Pseudoadiabats. Monthly Weather Review, 136(7), 2764-2785. https://doi.org/10.1175/2007MWR2224.1
import numpy as np def calTW(*args, **kwargs): TKK = float(Element('T2').element.value)+273.15 RH = float(Element('R2').element.value) TDK = TD(RH,TKK) TWC = TW(TKK,TDK,101300) TWd = "%.1f" %TWC Element('output').element.innerText = TWd def TD(RH,TK): GC=461.5 GCX=GC/ (1000.*4.186) LHV = (597.3-0.57* (TK-273.))/GCX TDK = TK*LHV/ (LHV-TK*np.log(RH*0.01)) return TDK def TW(tkk,tds,ps): svp1 = 6.112 svp2 = 17.67 svp3 = 29.65 svp4 = 243.5 ep2 = 0.622 A = 2675. C = 273.15 po = 1000. lam = 3.504 TK = tkk # Dry bulb temperature (K) TC = TK - C # Dry bulb temperature (C) TD = tds # Dew point temperature (K) TDC = TD - C # Dew point temperature (C) p = ps/100.0 U = np.exp((svp2*(TDC))/(svp4+TDC))/np.exp((svp2*TC)/(TC+svp4)) es = np.where(TK>C, svp1*np.exp(svp2*TC / (TC+svp4)), svp1*np.exp(22.514-6.15e3 / TK) ) e = U*es TL = 1.0/(1.0/(TD-56.0)+np.log(TK/TD)/800.0)+56.0 # Temperature at LCL (K) r = ep2*e/(p-e) THDL = TK*((po/(p-e))**0.2854)*(TK/TL)**(0.28*r) # Potential (dry) temperature at LCL (K) THE = THDL*np.exp((3036.0/TL-1.78)*r*(1.0+0.448*r)) # Equivalent potential temperature (K) pi = (p/po)**(1.0/lam) # bottom left of pg 2766 TE = THE*pi es_te = np.where(TE>C, svp1*np.exp(svp2*(TE-273.15) / (TE-svp3)), svp1*np.exp(22.514-6.15e3 / TE) ) rs_te = ep2*es_te/(p-es_te) # Saturation mixing ratio at TE (kg/kg) k1_pi = -38.5*pi**2+137.81*pi-53.737 # eqn 4.3 k2_pi = -4.392*pi**2+56.831*pi-0.384 # eqn 4.4 cote = (C/TE)**lam D_pi = 1.0/(0.1859*pi/po+0.6512) # D(pi) eqn 4.7 if cote>D_pi: d_este = svp2*svp4/(TE-C+svp4)^2 # below eqn 3.7 TW = TE - C - A*rs_te/(1.0+A*rs_te*d_este) # eqn 4.8 elif cote>=1.0 and cote<=D_pi: TW = k1_pi - k2_pi*cote # eqn 4.9 elif cote>=0.4 and cote<1.0: TW = (k1_pi-1.21) - (k2_pi-1.21)*cote # eqn 4.10 elif cote<0.4: TW = (k1_pi-2.66) - (k2_pi-1.21)*cote + 0.58/cote # eqn 4.11 return TW