-
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?
Changes from 3 commits
6a06d79
087056d
cba9171
baa8347
bf5f47d
95f4c83
2d67dc9
e961b59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,28 +68,24 @@ def test_height_and_pressure( | |
"""Test that the plugin produces the expected result with cubes defined either | ||
both on height or pressure levels. Also check the plugin produces the expected | ||
result with one cube defined on height levels and the other on pressure levels.""" | ||
cubes = [orography, height_of_pressure_levels] | ||
if height_or_pressure == "height_both": | ||
temperature_at_850hPa.add_aux_coord( | ||
iris.coords.AuxCoord(101.5, long_name="height", units="m") | ||
) | ||
temperature_at_850hPa.remove_coord("pressure") | ||
cubes = [] | ||
elif height_or_pressure == "pressure_both": | ||
temperature_at_screen_level.add_aux_coord( | ||
iris.coords.AuxCoord(100000, long_name="pressure", units="Pa") | ||
) | ||
temperature_at_screen_level.remove_coord("height") | ||
cubes = [height_of_pressure_levels] | ||
|
||
cubes.append([temperature_at_850hPa, temperature_at_screen_level]) | ||
|
||
expected = [[0.03, 0.01], [-0.01, -0.03]] | ||
result = GradientBetweenVerticalLevels()( | ||
iris.cube.CubeList( | ||
[ | ||
temperature_at_850hPa, | ||
temperature_at_screen_level, | ||
height_of_pressure_levels, | ||
orography, | ||
] | ||
) | ||
) | ||
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 commentThe 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. |
||
|
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.