From 9be71c7e4469d2e8aff63671ba19b53f46b25ce0 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Sat, 8 Mar 2025 11:58:41 -0500 Subject: [PATCH] Do not hardcode pressure steps --- lib/xmet/thermo.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/xmet/thermo.py b/lib/xmet/thermo.py index c382794..c1424a9 100644 --- a/lib/xmet/thermo.py +++ b/lib/xmet/thermo.py @@ -101,7 +101,8 @@ def moist_lapse_rate(temp: float, pressure: float) -> float: def loft_parcel(start_temp: float, start_pressure: float, - lapse_rate: Callable): + lapse_rate: Callable, + step: float=10.0): """ Loft a parcel of air from a given pressure, at a given temperature, yielding a Tuple containing the temperature and pressure of that parcel @@ -136,7 +137,7 @@ def loft_parcel(start_temp: float, if pressure == PRESSURE_MIN: break - elif pressure - 10.0 < PRESSURE_MIN: + elif pressure - step < PRESSURE_MIN: pressure = PRESSURE_MIN else: - pressure -= 10.0 + pressure -= step