Generate time lagged ensemble with deterministic input#2316
Generate time lagged ensemble with deterministic input#2316gavinevans wants to merge 4 commits intometoppv:masterfrom
Conversation
…a cube without a realization coordinate.
improver/utilities/time_lagging.py
Outdated
| @@ -19,6 +20,32 @@ | |||
| class GenerateTimeLaggedEnsemble(BasePlugin): | |||
| """Combine realizations from different forecast cycles into one cube""" | |||
There was a problem hiding this comment.
To be explicit, please could you add some comments on how the realization coordinate points are handled both when no realization coordinate is present on any cubes and when some cubes have realization coordinates and others don't. Some supporting examples would help.
There was a problem hiding this comment.
I've extended this docstring.
improver/utilities/time_lagging.py
Outdated
There was a problem hiding this comment.
Following the 'Fail fast' principle, this should be moved above the use of the add_realization_coord method.
There was a problem hiding this comment.
I've left this, as I think that I'd prefer the case where a single cube is input, with this cube then being returned, but with a realization coordinate added, to have precedence over the case where the times are compared between multiple cubes, which could result in a failure.
improver/utilities/time_lagging.py
Outdated
There was a problem hiding this comment.
| # Take all the realizations from all the input cubes and |
There was a problem hiding this comment.
I've refactored code on surrounding lines.
| input_cubelist = iris.cube.CubeList([cube1, cube2]) | ||
| result = GenerateTimeLaggedEnsemble().process(input_cubelist) | ||
| self.assertIn("realization", [coord.name() for coord in result.coords()]) | ||
| np.testing.assert_array_equal(result.coord("realization").points, [0, 3, 4, 5]) |
There was a problem hiding this comment.
Although this passes, is this desireable? Would we instead want to ensure that the points are monotonically increasing with constant stride (i.e., [0, 1, 2, 3, 4, 5] rather than [0, 3, 4, 5])? I'm wondering what downstream code expects
There was a problem hiding this comment.
The case of mixed realizations is probably least likely to be actively used, but I've added an option to rebadge the realizations, rather than do this automatically, in case the numbers used within the input realizations do have meaning.
012b591 to
d579516
Compare
maxwhitemet
left a comment
There was a problem hiding this comment.
Thanks @gavinevans. Happy with the changes made. Approved 👍
Addresses https://github.com/metoppv/mo-blue-team/issues/1078
Description
This PR makes a minor update the GenerateTimeLaggedEnsemble plugin to support providing deterministic input (i.e. input without a realization coordinate), so that a time-lagged ensemble can be created using deterministic inputs.
Testing: