From 6bb92a45b86c3f80e146b21eb3d32956825591f7 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Wed, 5 Mar 2025 01:13:07 -0500 Subject: [PATCH] Adjust units in mixing ratios to kilograms --- lib/xmet/thermo.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/xmet/thermo.py b/lib/xmet/thermo.py index b5b8c27..7cf2e4d 100644 --- a/lib/xmet/thermo.py +++ b/lib/xmet/thermo.py @@ -19,21 +19,21 @@ def saturated_vapor_pressure(temp: float) -> float: def mixing_ratio(dewpoint: float, pressure: float) -> float: """ - Return the amount, in grams, of water vapor versus dry air in a parcel of - a given dewpoint and pressure. + Return the amount, in kilograms, of water vapor versus dry air in a parcel + of a given dewpoint and pressure. """ e = vapor_pressure(dewpoint) - return 621.97 * (e / (pressure - e)) + return (0.62197 * e) / (pressure - e) def saturated_mixing_ratio(temp: float, pressure: float) -> float: """ - Return the maximum amount, in grams, of water vapor a parcel of a given - temperature and pressure can hold. + Return the maximum amount, in kilograms, of water vapor a parcel of a + given temperature and pressure can hold. """ es = saturated_vapor_pressure(temp) - return 621.97 * (es / (pressure - es)) + return (0.62197 * es) / (pressure - es) def lcl(temp: float, dewpoint: float) -> float: """