Implement SkewT.draw_series()
Implement SkewT.draw_series() to plot a Series object
This commit is contained in:
parent
7cc3d2cb42
commit
eda84fa990
1 changed files with 22 additions and 0 deletions
|
@ -8,6 +8,8 @@ from xmet.thermo import loft_parcel, moist_lapse_rate, \
|
|||
LAPSE_RATE_DRY, PRESSURE_MAX, PRESSURE_MIN, \
|
||||
PRESSURE_STEP
|
||||
|
||||
from xmet.series import Series
|
||||
|
||||
PRESSURE_LOG_MAX = math.log(PRESSURE_MAX)
|
||||
PRESSURE_LOG_MIN = math.log(PRESSURE_MIN)
|
||||
PRESSURE_LOG_RANGE = PRESSURE_LOG_MAX - PRESSURE_LOG_MIN
|
||||
|
@ -140,6 +142,26 @@ class SkewTGraph():
|
|||
|
||||
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,
|
||||
cr: cairo.Context,
|
||||
x: float,
|
||||
|
|
Loading…
Add table
Reference in a new issue