Move parameter derivation to SoundingParameters
This commit is contained in:
parent
5b33653dcf
commit
e5f00ee85f
1 changed files with 10 additions and 9 deletions
|
@ -1,6 +1,8 @@
|
||||||
import datetime
|
import datetime
|
||||||
import shapely
|
import shapely
|
||||||
|
|
||||||
|
from typing import Self
|
||||||
|
|
||||||
from xmet.db import Database, DatabaseTable, DatabaseOrder
|
from xmet.db import Database, DatabaseTable, DatabaseOrder
|
||||||
from xmet.coord import COORD_SYSTEM
|
from xmet.coord import COORD_SYSTEM
|
||||||
from xmet.list import nearest
|
from xmet.list import nearest
|
||||||
|
@ -47,9 +49,6 @@ class SoundingSample(DatabaseTable):
|
||||||
def is_saturated(self) -> bool:
|
def is_saturated(self) -> bool:
|
||||||
return self.humidity >= 100.0
|
return self.humidity >= 100.0
|
||||||
|
|
||||||
class SoundingParameters():
|
|
||||||
pass
|
|
||||||
|
|
||||||
class Sounding(DatabaseTable):
|
class Sounding(DatabaseTable):
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
'id', 'station', 'timestamp_observed', 'timestamp_released',
|
'id', 'station', 'timestamp_observed', 'timestamp_released',
|
||||||
|
@ -185,13 +184,15 @@ class Sounding(DatabaseTable):
|
||||||
|
|
||||||
return series
|
return series
|
||||||
|
|
||||||
def derive_parameters(self) -> SoundingParameters:
|
class SoundingParameters():
|
||||||
temp_line = self.follow_temp()
|
@staticmethod
|
||||||
dry_adiabat = follow_dry_adiabat(self.samples[0].temp,
|
def from_sounding(sounding: Sounding) -> Self:
|
||||||
self.samples[0].pressure)
|
temp_line = sounding.follow_temp()
|
||||||
|
dry_adiabat = follow_dry_adiabat(sounding.samples[0].temp,
|
||||||
|
sounding.samples[0].pressure)
|
||||||
|
|
||||||
saturated_mr_line = follow_saturated_mixing_ratio(self.samples[0].dewpoint,
|
saturated_mr_line = follow_saturated_mixing_ratio(sounding.samples[0].dewpoint,
|
||||||
self.samples[0].pressure)
|
sounding.samples[0].pressure)
|
||||||
|
|
||||||
lcl = dry_adiabat.intersect(saturated_mr_line, SeriesIntersection.LESSER)
|
lcl = dry_adiabat.intersect(saturated_mr_line, SeriesIntersection.LESSER)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue