diff --git a/lib/xmet/thermo.py b/lib/xmet/thermo.py index cbed4cd..f91c39a 100644 --- a/lib/xmet/thermo.py +++ b/lib/xmet/thermo.py @@ -17,6 +17,17 @@ def kelvin(c: float) -> float: def celsius(k: float) -> float: return k - 273.15 +def virtual_temp(temp: float, dewpoint: float, pressure: float) -> float: + a = 7.5 * dewpoint + b = 237.3 + dewpoint + c = a / b + + d = 6.11 * (10**c) + e = d / pressure + f = 1 - 0.379 * e + + return celsius((temp + 273.15) / f) + def vapor_pressure(dewpoint: float) -> float: """ Return the pressure, in millibar, of vapor in a parcel of a given