From 629bee25d9a47dd25cc525ab63ecb403164a6e10 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Fri, 14 Mar 2025 17:26:31 -0400 Subject: [PATCH] Move sounding parameters drawing to draw_params() --- lib/xmet/skew_t.py | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/lib/xmet/skew_t.py b/lib/xmet/skew_t.py index 30bb4d0..f9db523 100644 --- a/lib/xmet/skew_t.py +++ b/lib/xmet/skew_t.py @@ -236,20 +236,11 @@ class SkewTGraph(): cr.restore() - def draw(self, - cr: cairo.Context, - x: float, - y: float, - sounding: Sounding): - cr.rectangle(x, y, self.width, self.height) - cr.clip() - - self.draw_isotherms(cr, x, y) - self.draw_isobars(cr, x, y) - self.draw_adiabats(cr, x, y) - - params = SoundingParameters.from_sounding(sounding) - + def draw_params(self, + cr: cairo.Context, + x: float, + y: float, + params: SoundingParameters): if self.opts.draw_lcl: self.draw_special_isobar(cr, x, y, params.lcl[1]) @@ -271,6 +262,22 @@ class SkewTGraph(): cr.set_source_rgb(0.8, 0.8, 1.0) self.draw_series(cr, x, y, params.saturated_mr_line) + def draw(self, + cr: cairo.Context, + x: float, + y: float, + sounding: Sounding, + params: SoundingParameters=None): + cr.rectangle(x, y, self.width, self.height) + cr.clip() + + self.draw_isotherms(cr, x, y) + self.draw_isobars(cr, x, y) + self.draw_adiabats(cr, x, y) + + if params is not None: + self.draw_params(cr, x, y, params) + cr.set_source_rgb(1, 0, 0) self.draw_sounding(cr, x, y, sounding, lambda s: s.temp)