From 79805c54c5d9cbf3dc88e4da14eb289f9f93504b Mon Sep 17 00:00:00 2001 From: Haoyu Zhuang Date: Fri, 30 Sep 2022 08:18:26 -0400 Subject: [PATCH] Fix convective temperature tests --- src/metpy/calc/thermo.py | 2 +- tests/calc/test_thermo.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/metpy/calc/thermo.py b/src/metpy/calc/thermo.py index 6a269f05422..a4c68c358a6 100644 --- a/src/metpy/calc/thermo.py +++ b/src/metpy/calc/thermo.py @@ -508,7 +508,7 @@ def ccl(pressure, temperature, dewpoint, height=None, mixed_layer_depth=None, wh >>> dewpoint = [19.6, 18.7, 17.8, 16.3, 12.4, -0.4, -3.8, -6, -13.2, -11] * units.degC >>> ccl_p, ccl_t, t_c = mpcalc.ccl(pressure, temperature, dewpoint) >>> ccl_p, t_c - (, ) + (, ) """ pressure, temperature, dewpoint = _remove_nans(pressure, temperature, dewpoint) diff --git a/tests/calc/test_thermo.py b/tests/calc/test_thermo.py index 4112506f60b..99d90ee940c 100644 --- a/tests/calc/test_thermo.py +++ b/tests/calc/test_thermo.py @@ -413,7 +413,7 @@ def test_ccl_basic(): ccl_p, ccl_t, t_c = ccl(pressure, temperature, dewpoint) assert_almost_equal(ccl_p, 763.006048 * units.mbar, 5) assert_almost_equal(ccl_t, 15.429946 * units.degC, 5) - assert_almost_equal(t_c, 38.616596 * units.degC, 5) + assert_almost_equal(t_c, 37.991498 * units.degC, 5) def test_ccl_nans(): @@ -430,7 +430,7 @@ def test_ccl_nans(): ccl_p, ccl_t, t_c = ccl(pressure, temperature, dewpoint) assert_almost_equal(ccl_p, 763.006048 * units.mbar, 5) assert_almost_equal(ccl_t, 15.429946 * units.degC, 5) - assert_almost_equal(t_c, 38.616596 * units.degC, 5) + assert_almost_equal(t_c, 37.991498 * units.degC, 5) def test_ccl_unit(): @@ -448,7 +448,7 @@ def test_ccl_unit(): ccl_p, ccl_t, t_c = ccl(pressure, temperature, dewpoint) assert_almost_equal(ccl_p, (763.006048 * 100) * units.Pa, 3) assert_almost_equal(ccl_t, (15.429946 + 273.15) * units.kelvin, 3) - assert_almost_equal(t_c, (38.616596 + 273.15) * units.kelvin, 3) + assert_almost_equal(t_c, (37.991498 + 273.15) * units.kelvin, 3) assert ccl_p.units == pressure.units assert ccl_t.units == temperature.units @@ -478,17 +478,17 @@ def test_multiple_ccl(): ccl_p, ccl_t, t_c = ccl(pressure, temperature, dewpoint) assert_almost_equal(ccl_p, 680.191653 * units.mbar, 5) assert_almost_equal(ccl_t, -0.204408 * units.degC, 5) - assert_almost_equal(t_c, 31.566319 * units.degC, 5) + assert_almost_equal(t_c, 30.8678258 * units.degC, 5) ccl_p, ccl_t, t_c = ccl(pressure, temperature, dewpoint, which='bottom') assert_almost_equal(ccl_p, 886.835325 * units.mbar, 5) assert_almost_equal(ccl_t, 3.500840 * units.degC, 5) - assert_almost_equal(t_c, 13.158340 * units.degC, 5) + assert_almost_equal(t_c, 12.5020423 * units.degC, 5) ccl_p, ccl_t, t_c = ccl(pressure, temperature, dewpoint, which='all') assert_array_almost_equal(ccl_p, np.array([886.835325, 680.191653]) * units.mbar, 5) assert_array_almost_equal(ccl_t, np.array([3.500840, -0.204408]) * units.degC, 5) - assert_array_almost_equal(t_c, np.array([13.158340, 31.566319]) * units.degC, 5) + assert_array_almost_equal(t_c, np.array([12.5020423, 30.8678258]) * units.degC, 5) def test_ccl_with_ml(): @@ -519,7 +519,7 @@ def test_ccl_with_ml(): assert_array_almost_equal(ccl_t, np.array( [0.840118, -0.280299, -1.118757, -2.875716]) * units.degC, 5) assert_array_almost_equal(t_c, np.array( - [13.804624, 19.332071, 23.576331, 32.782670]) * units.degC, 5) + [13.146845, 18.661621, 22.896152, 32.081388]) * units.degC, 5) def test_lfc_basic():