-
Notifications
You must be signed in to change notification settings - Fork 89
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
Maximum value over a height coordinate #1945
Conversation
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1945 +/- ##
=======================================
Coverage 98.38% 98.39%
=======================================
Files 123 123
Lines 11792 11804 +12
=======================================
+ Hits 11602 11614 +12
Misses 190 190
☔ View full report in Codecov by Sentry. |
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.
A few things to think about, but nothing major.
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.
There is an outstanding question about meta-data, but otherwise I am happy and this PR can have a second review.
The acceptance test data need fixing (see their PR). |
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.
Thanks @mspelman07. This mostly looks fine, I've just added one comment about adding some handling of a possible error.
height_constraint = iris.Constraint( | ||
height=lambda height: lower_height_bound <= height <= upper_height_bound | ||
) | ||
cube_subsetted = cube.extract(height_constraint) |
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.
I think it is possible for cube_subsetted
to be None
at this point if certain height bounds are input, which will cause an Attribute_Error
on line 750.
I think handling of this issue should be added, with an error message explaining that no heights on the input cube are within the given bounds, so the max over height levels cannot be calculated. Tests should also be added for this error.
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.
You are right this could cause a problem. I've added in an error message and a test for this.
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.
Thanks for that change @mspelman07, I'm happy with this now
* Adds in plugin and tests to calculate the maximum value over a height coordinate * formatting line length * remove print and update docstring * Move plugin to cube_manipulation * formatting * Formatting isort and flake8 * Update metadata of cube * Update checksums for new data * Raises an error if requested height bounds don't cover any height levels --------- Co-authored-by: Marcus Spelman <[email protected]>
Related ticket: https://metoffice.atlassian.net/browse/EPPT-188
Acceptance test data: metoppv/improver_test_data#29
Adds in the ability to calculate the maximum value over a height coordinate. This includes the ability to define the bounds of the height coordinate to take the maximum over. This is so we can calculate the maximum relative humidity below 300m.
Testing: