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
Units bug fix for _get_bound_pressure_height #1943
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.
This change looks good. Can you add a test based on the failing case in #1938?
@dopplershift Issue #1938 uses |
They're in |
tests/calc/test_calc_tools.py
Outdated
bottom=units.Quantity(1, 'km'), | ||
depth=units.Quantity(5, 'km'), | ||
height=height) | ||
assert_array_almost_equal(pres_subset[1], units.Quantity(900, 'hPa'), 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.
Any reason not to just check that the entire pres_subset
and temp_subset
arrays have the expected values, rather than checking single elements?
c16173b
to
dc7e816
Compare
It appears we were removing the units and only using the magnitude of
bound
,height
, andpressure
when interpolating pressure at a given height in_get_bound_pressure_height()
, which is used inget_layer()
. Therefore, when the height profile and bottom/top bound were in different units, the function failed miserably. Keeping those units in place resolves the issue.Checklist