|
40 | 40 | water_latent_heat_vaporization, wet_bulb_potential_temperature, |
41 | 41 | wet_bulb_temperature) |
42 | 42 | 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 |
44 | 44 | from metpy.testing import assert_almost_equal, assert_array_almost_equal, assert_nan |
45 | 45 | from metpy.units import is_quantity, masked_array, units |
46 | 46 |
|
@@ -456,6 +456,27 @@ def test_lcl(): |
456 | 456 | assert_almost_equal(lcl_temperature, 17.662 * units.degC, 2) |
457 | 457 |
|
458 | 458 |
|
| 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 | + |
459 | 480 | def test_lcl_kelvin(): |
460 | 481 | """Test LCL temperature is returned as Kelvin, if temperature is Kelvin.""" |
461 | 482 | temperature = 273.09723 * units.kelvin |
|
0 commit comments