Implement virtual_temp()

This commit is contained in:
XANTRONIX 2025-03-14 19:29:48 -04:00
parent 42b98a8f0c
commit a186f629d8

View file

@ -17,6 +17,17 @@ def kelvin(c: float) -> float:
def celsius(k: float) -> float: def celsius(k: float) -> float:
return k - 273.15 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: def vapor_pressure(dewpoint: float) -> float:
""" """
Return the pressure, in millibar, of vapor in a parcel of a given Return the pressure, in millibar, of vapor in a parcel of a given