This commit is contained in:
XANTRONIX 2025-02-24 21:35:08 -05:00
parent 1bf5f3eabe
commit 4f0c11cfca

View file

@ -1,8 +1,8 @@
import datetime
import shapely
LAPSE_RATE_DRY = 9.8 / 1000 # degrees C per 1000m
LAPSE_RATE_MOIST = 4.0 / 1000
LAPSE_RATE_DRY = 9.8 # degrees C per 1000m
LAPSE_RATE_MOIST = 4.0
class SoundingSample():
__slots__ = (
@ -45,12 +45,20 @@ class SoundingSample():
return 621.97 * (es / (self.pressure - es))
def lcl(self) -> float:
return (self.temperature - self.dewpoint) / 8.0
def lcl(self) -> float: # meters
return (self.temp - self.dewpoint) / 0.008
def is_saturated(self) -> bool:
return self.humidity >= 100.0
def lapse(self, h: float, rate=None) -> float:
if rate is None:
rate = LAPSE_RATE_MOIST if self.is_saturated() else LAPSE_RATE_DRY
hd = h - self.height
return self.temp - (rate * (hd / 1000))
class Sounding():
__slots__ = (
'id', 'station', 'timestamp_observed', 'timestamp_released',