Compare commits
No commits in common. "6faef3052443997549404c7c105ffde47a85cbc9" and "c2f17fa1395a2a2b09e199366847fecfe6cc424a" have entirely different histories.
6faef30524
...
c2f17fa139
2 changed files with 7 additions and 6 deletions
|
@ -13,17 +13,13 @@ class Series(dict):
|
|||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def intersect(self, series: Self, intersection: SeriesIntersection, start: float=None) -> tuple[float]:
|
||||
def intersect(self, series: Self, intersection: SeriesIntersection) -> tuple[float]:
|
||||
pairs = nearest(sorted(self.keys(), reverse=True),
|
||||
sorted(series.keys(), reverse=True))
|
||||
|
||||
for pair in pairs:
|
||||
v1, v2 = self[pair[0]], series[pair[1]]
|
||||
|
||||
if start is not None:
|
||||
if pair[0] > start:
|
||||
continue
|
||||
|
||||
sign = cmp(v1, v2)
|
||||
|
||||
if sign == intersection.value:
|
||||
|
|
|
@ -185,6 +185,11 @@ class Sounding(DatabaseTable):
|
|||
|
||||
return series
|
||||
|
||||
def find_el(self, temp: float, pressure: float, temp_line: Series) -> tuple[float]:
|
||||
moist_adiabat = follow_moist_adiabat(temp, pressure)
|
||||
|
||||
return moist_adiabat.intersect(temp_line, SeriesIntersection.LESSER)
|
||||
|
||||
def derive_parameters(self) -> SoundingParameters:
|
||||
temp_line = self.follow_temp()
|
||||
dry_adiabat = follow_dry_adiabat(self.samples[0].temp,
|
||||
|
@ -198,7 +203,7 @@ class Sounding(DatabaseTable):
|
|||
moist_adiabat = follow_moist_adiabat(*lcl)
|
||||
|
||||
lfc = moist_adiabat.intersect(temp_line, SeriesIntersection.GREATER)
|
||||
el = moist_adiabat.intersect(temp_line, SeriesIntersection.LESSER, lfc[1])
|
||||
el = self.find_el(lfc[0], lfc[1], temp_line)
|
||||
|
||||
params = SoundingParameters()
|
||||
params.lcl = lcl
|
||||
|
|
Loading…
Add table
Reference in a new issue