-
Notifications
You must be signed in to change notification settings - Fork 85
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
Gradient between vertical levels #2030
base: master
Are you sure you want to change the base?
Gradient between vertical levels #2030
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2030 +/- ##
==========================================
- Coverage 98.39% 98.28% -0.11%
==========================================
Files 124 133 +9
Lines 12212 12865 +653
==========================================
+ Hits 12016 12645 +629
- Misses 196 220 +24 ☔ 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.
This is a good PR. I've thought of one way one of the cases could be made more efficient, but I am not sure whether this would actually benefit any of the use cases yet.
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 looks like a good solution. Just one blank space needed!
height coordinate.If the cubes are provided at pressure levels, the height above sea level | ||
is extracted from a geopotential_height cube. | ||
height coordinate. If the cubes are provided at pressure levels, the height above sea level | ||
is extracted from a geopotential_height cube.If both cubes have a |
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.
is extracted from a geopotential_height cube.If both cubes have a | |
is extracted from a geopotential_height cube. If both cubes have a |
height_diff.data = np.ma.masked_where(height_diff.data == 0, height_diff.data) | ||
|
||
diff = cubes[0] - cubes[1] | ||
gradient = diff / height_diff |
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.
What do the output metadata look like if the two source cubes represent different times? Should we detect and reject such cases?
result = GradientBetweenVerticalLevels()(iris.cube.CubeList(cubes)) | ||
np.testing.assert_array_almost_equal(result.data, expected) | ||
assert result.name() == "gradient_of_air_temperature" | ||
assert result.units == "K/m" |
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.
While considering the time metadata, I've discovered that the scalar coordinates are unexpected. In the mixed inputs case, the output has both the height (1.5m) and pressure (85000 Pa) scalar coords while I would expect it to have neither.
The height_both case has no time or forecast_period coord on the output if I change the time of the temperature on pressure levels cube by an hour.
EPP:
Acceptance test: metoppv/improver_test_data#55
This plugin adds in the ability to calculate a gradient between two vertical levels which could be defined on pressure or height levels.
Testing: