Skip to content

Commit ae1b0f8

Browse files
committed
MNT: Add citable verification test
1 parent d1605d4 commit ae1b0f8

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

tests/calc/test_thermo.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
water_latent_heat_vaporization, wet_bulb_potential_temperature,
4141
wet_bulb_temperature)
4242
from metpy.calc.thermo import _find_append_zero_crossings
43-
from metpy.constants import Cp_d, kappa, Lf, Ls, Lv, Rd, T0
43+
from metpy.constants import Cp_d, g, kappa, Lf, Ls, Lv, Rd, T0
4444
from metpy.testing import assert_almost_equal, assert_array_almost_equal, assert_nan
4545
from metpy.units import is_quantity, masked_array, units
4646

@@ -456,6 +456,27 @@ def test_lcl():
456456
assert_almost_equal(lcl_temperature, 17.662 * units.degC, 2)
457457

458458

459+
def test_lcl_romps_value():
460+
"""Test LCL calculation against cited Romps test values.
461+
462+
See https://romps.berkeley.edu/papers/pubdata/2016/lcl/test.py
463+
and https://romps.berkeley.edu/papers/pubdata/2020/dewpoint/test.py
464+
"""
465+
# dewpoint from Romps 2021 test data: 288.7153070587 K
466+
p = 1e5 * units.Pa
467+
t = 300 * units.K
468+
td = 288.7153070587 * units.K
469+
470+
_, lcl_temperature = lcl(p, t, td)
471+
472+
cpm = moist_air_specific_heat_pressure(specific_humidity_from_dewpoint(p, td))
473+
lcl_height = cpm / g * (t - lcl_temperature)
474+
475+
reference_lcl_height = 1433.844139279 * units.m
476+
margin_error = 5 * units.m # from Romps 2017
477+
assert abs(lcl_height - reference_lcl_height) <= margin_error
478+
479+
459480
def test_lcl_kelvin():
460481
"""Test LCL temperature is returned as Kelvin, if temperature is Kelvin."""
461482
temperature = 273.09723 * units.kelvin

0 commit comments

Comments
 (0)