Compare commits

...

2 commits

Author SHA1 Message Date
eda84fa990 Implement SkewT.draw_series()
Implement SkewT.draw_series() to plot a Series object
2025-03-13 11:46:48 -04:00
7cc3d2cb42 Remove unnecessary import 2025-03-13 11:46:25 -04:00

View file

@ -3,11 +3,13 @@ import cairo
from typing import Callable from typing import Callable
from xmet.sounding import Sounding from xmet.sounding import Sounding, SoundingParameters
from xmet.thermo import loft_parcel, moist_lapse_rate, \ from xmet.thermo import loft_parcel, moist_lapse_rate, \
LAPSE_RATE_DRY, PRESSURE_MAX, PRESSURE_MIN, \ LAPSE_RATE_DRY, PRESSURE_MAX, PRESSURE_MIN, \
PRESSURE_STEP PRESSURE_STEP
from xmet.series import Series
PRESSURE_LOG_MAX = math.log(PRESSURE_MAX) PRESSURE_LOG_MAX = math.log(PRESSURE_MAX)
PRESSURE_LOG_MIN = math.log(PRESSURE_MIN) PRESSURE_LOG_MIN = math.log(PRESSURE_MIN)
PRESSURE_LOG_RANGE = PRESSURE_LOG_MAX - PRESSURE_LOG_MIN PRESSURE_LOG_RANGE = PRESSURE_LOG_MAX - PRESSURE_LOG_MIN
@ -140,6 +142,26 @@ class SkewTGraph():
cr.restore() cr.restore()
def draw_series(self,
cr: cairo.Context,
x: float,
y: float,
series: Series):
first = True
for pressure in series:
temp = series[pressure]
sx, sy = self.sample_to_screen(temp, pressure)
if first:
cr.move_to(x + sx, y + sy)
first = False
else:
cr.line_to(x + sx, y + sy)
cr.stroke()
def draw_sounding(self, def draw_sounding(self,
cr: cairo.Context, cr: cairo.Context,
x: float, x: float,