From 253a25499b207aeb36e57405f4951afbeaf1f1f7 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Mon, 24 Feb 2025 00:05:17 -0500 Subject: [PATCH] Hacky, but in a different way --- lib/xmet/skew_t.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/xmet/skew_t.py b/lib/xmet/skew_t.py index a495cf5..5c52db1 100644 --- a/lib/xmet/skew_t.py +++ b/lib/xmet/skew_t.py @@ -18,7 +18,7 @@ TEMP_MIN = -40 TEMP_RANGE = TEMP_MAX - TEMP_MIN TEMP_CENTER = 0 # degrees C TEMP_STEP = 5 -TEMP_STEP_COUNT = 16 +TEMP_STEP_COUNT = math.ceil(TEMP_RANGE / TEMP_STEP) def clamp(value, lowest, highest): if value < lowest: @@ -58,11 +58,6 @@ class SkewT(): cr.rel_line_to(self.width, 0) cr.stroke() - def draw_isotherms(self, cr: cairo.Context, x: float, y: float): - cr.set_source_rgba(0.1, 0.5, 0.1, 0.8) - - pass - def skew_t_to_graph(self, x: float, y: float): return (x+y, y) @@ -72,6 +67,17 @@ class SkewT(): return self.skew_t_to_graph(x, y) + def draw_isotherms(self, cr: cairo.Context, x: float, y: float): + cr.set_source_rgb(0.99, 0.99, 0.99) + + for temp in range(-150, TEMP_MAX+1, TEMP_STEP): + x1, y1 = self.graph_to_screen(*self.sample_to_graph(temp, PRESSURE_MAX)) + x2, y2 = self.graph_to_screen(*self.sample_to_graph(temp, PRESSURE_MIN)) + + cr.move_to(x1, y1) + cr.line_to(x2, y2) + cr.stroke() + def draw_samples(self, cr: cairo.Context, x: float,