New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise exception if LCL does not converge #328
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test by setting max_iters=1
? It'd be nice to have that for many reasons.
You'll need: with pytest.raises(RuntimeError):
lcl(...) |
metpy/calc/tests/test_thermo.py
Outdated
@@ -159,6 +160,11 @@ def test_lcl(): | |||
assert_almost_equal(lcl_pressure, 864.761 * units.mbar, 2) | |||
assert_almost_equal(lcl_temperature, 17.676 * units.degC, 2) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pep8 == two blank lines
metpy/calc/tests/test_thermo.py
Outdated
def test_lcl_convergence(): | ||
"""Test LCL calculation convergence failure.""" | ||
with pytest.raises(RuntimeError): | ||
lcl_pressure, lcl_temperature = lcl(1000. * units.mbar, 30. * units.degC, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't even bother capturing the return values.
metpy/calc/tests/test_thermo.py
Outdated
"""Test LCL calculation convergence failure.""" | ||
with pytest.raises(RuntimeError): | ||
lcl_pressure, lcl_temperature = lcl(1000. * units.mbar, 30. * units.degC, | ||
20. * units.degC, max_iters=2) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another blank here for pep8.
94a29a6
to
38de5a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending a clean CI run.
I will merge despite being "out of date" since the last PR to go in was just docs--so long as this passes cleanly. |
Appveyor failure was spurious...restarted. |
If we don't converge in
max_iter
we should fail loudly. Addresses #317