diff --git a/lib/xmet/skew_t.py b/lib/xmet/skew_t.py index db74adf..86a9211 100644 --- a/lib/xmet/skew_t.py +++ b/lib/xmet/skew_t.py @@ -32,11 +32,12 @@ def clamp(value, lowest, highest): return value class SkewTGraph(): - __slots__ = 'width', 'height', 'temp_step_width', + __slots__ = 'width', 'height', 'skew', 'temp_step_width', - def __init__(self, width: float, height: float): + def __init__(self, width: float, height: float, skew: float=SKEW): self.width = width self.height = height + self.skew = skew self.temp_step_width = min(self.width, self.height) / TEMP_STEP_COUNT @@ -74,7 +75,7 @@ class SkewTGraph(): cr.restore() def skew_t_to_graph(self, x: float, y: float): - return (x+SKEW*y, y) + return (x+self.skew*y, y) def sample_to_graph(self, temp: float, pressure: float): x = (temp / TEMP_STEP) * self.temp_step_width @@ -241,7 +242,7 @@ class SkewTLegend(): x_rel, y_rel = skew_t.sample_to_screen(temp, PRESSURE_MAX) if x_rel < 0: - y_rel = skew_t.height + x_rel / SKEW + y_rel = skew_t.height + x_rel / skew_t.skew x_rel = 0 if y_rel <= 0: