Skip to content

Commit

Permalink
Add test for case of no EL in data
Browse files Browse the repository at this point in the history
  • Loading branch information
jrleeman committed Mar 6, 2017
1 parent 9da8452 commit ee564f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions metpy/calc/tests/test_thermo.py
Expand Up @@ -193,6 +193,7 @@ def test_equivalent_potential_temperature():
ept = equivalent_potential_temperature(p, t)
assert_almost_equal(ept, 315.9548 * units.kelvin, 3)


def test_virtual_temperature():
"""Test virtual temperature calculation."""
t = 288. * units.kelvin
Expand Down Expand Up @@ -228,3 +229,12 @@ def test_el():
assert_almost_equal(el_pressure, 520.8420 * units.mbar, 3)
assert_almost_equal(el_temperature, -11.7055 * units.degC, 3)


def test_no_el():
"""Test equilibrium layer calculation when there is no EL in the data."""
levels = np.array([959., 867.9, 779.2, 647.5, 472.5, 321.9, 251.]) * units.mbar
temperatures = np.array([22.2, 17.4, 14.6, 1.4, -17.6, -39.4, -52.5]) * units.celsius
dewpoints = np.array([19., 14.3, -11.2, -16.7, -21., -43.3, -56.7]) * units.celsius
el_pressure, el_temperature = el(levels, temperatures, dewpoints)
assert el_pressure is None
assert el_temperature is None
2 changes: 1 addition & 1 deletion metpy/calc/thermo.py
Expand Up @@ -235,7 +235,7 @@ def lfc(pressure, temperature, dewpt):

@exporter.export
def el(pressure, temperature, dewpt):
r"""Calculate the equilibrium level (EL).
r"""Calculate the equilibrium level.
This works by finding the last intersection of the ideal parcel path and
the measured parcel temperature. If there is one or fewer intersections, there is
Expand Down

0 comments on commit ee564f2

Please sign in to comment.