From d7831ab71a881287828803e6ac7373c8e85a8718 Mon Sep 17 00:00:00 2001
From: XANTRONIX Industrial <xan@xantronix.com>
Date: Mon, 24 Feb 2025 09:47:02 -0500
Subject: [PATCH] Implement SkewTGraph.sample_to_screen()

Implement SkewTGraph.sample_to_screen() to convert a sample value to
X/Y coordinates
---
 lib/xmet/skew_t.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/xmet/skew_t.py b/lib/xmet/skew_t.py
index 7dd42b8..018f7d3 100644
--- a/lib/xmet/skew_t.py
+++ b/lib/xmet/skew_t.py
@@ -67,12 +67,15 @@ class SkewTGraph():
 
         return self.skew_t_to_graph(x, y)
 
+    def sample_to_screen(self, temp: float, pressure: float):
+        return self.graph_to_screen(*self.sample_to_graph(temp, pressure))
+
     def draw_isotherms(self, cr: cairo.Context, x: float, y: float):
         cr.set_source_rgb(0.95, 0.95, 0.95)
 
         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))
+            x1, y1 = self.sample_to_screen(temp, PRESSURE_MAX)
+            x2, y2 = self.sample_to_screen(temp, PRESSURE_MIN)
 
             cr.move_to(x + x1, y + y1)
             cr.line_to(x + x2, y + y2)