953 stochastic noise#2275
Conversation
|
@maxwhitemet, could you merge/rebase master into your branch. The failing "CI Tests / Test-Coverage (pull_request)" should hopefully be addressed by the now merged #2273
There does appear to be a new issue potentially with the improver documentation building now though... (different issue) |
84d3c1b to
897e0cb
Compare
|
Ignore the test coverage failure. Fixed in #2282 |
gavinevans
left a comment
There was a problem hiding this comment.
Thanks @maxwhitemet 👍
I've added some comments below.
maxwhitemet
left a comment
There was a problem hiding this comment.
Thank you for the review @gavinevans. I have now made the requested changes.
gavinevans
left a comment
There was a problem hiding this comment.
I've added some minor comments.
maxwhitemet
left a comment
There was a problem hiding this comment.
Thanks @gavinevans. I have implemented your feedback
bayliffe
left a comment
There was a problem hiding this comment.
Thanks Max, a few comments. The thrust of some of my comments it to make this less precipitation specific, but I've not highlighted everywhere this needs to happen, so think about variable names (e.g. dry_mask) and comments to make it less precip specific, using precip as an example if that's instructive.
I'm also interested in you making changes to better handle the expected shape of cubes and the coordinate order, rather than assuming realization is first and simply indexing it with that assumption.
| n_realiz = template.coord("realization").points.size | ||
| tasks = [] | ||
| for k in range(n_realiz): | ||
| realiz_data = template_dB.data[k].astype(np.float32) |
There was a problem hiding this comment.
There is an implicit assumption that the first index of the cube here corresponds to realization but I don't think that's been written anywhere, checked, or enforeced.
There was a problem hiding this comment.
I have now changed the looping to use the iris slices_over method with the realization dimension.
There was a problem hiding this comment.
One more question on this. Does the slice passed to do_fft need to be 2-dimensional? Would a time, realization, y, x cube work with this code?
If it does need to be 2D then you could either set a limitation in the code that raises an error if there are more than realization, y, x coordinates, or you could create y, x slices requiring that realization be one of the remaining dimensions, and reconstruct a cube back to the original shape at the end. We do this in a few places and Gavin could give you a steer as to whether this will ever be needed or just to go for the exception (again, assuming it has to be a 2D slice passed in here).
There was a problem hiding this comment.
Yes, for our usage, the input to do_fft needs to be 2-dimensional. I don't think we have to support the presence of a time coordinate, so perhaps just checking that the input cube has the expected dimension coordinates, and if not raising an exception, would be fine.
|
I forgot to say that this code is currently within the |
maxwhitemet
left a comment
There was a problem hiding this comment.
Thank you for the review @bayliffe. I believe I have addressed all requested changes.
Regarding your comment on where the plugin sits: stochastic_noise and its associated tests now sit under the calibration directory.
| n_realiz = template.coord("realization").points.size | ||
| tasks = [] | ||
| for k in range(n_realiz): | ||
| realiz_data = template_dB.data[k].astype(np.float32) |
There was a problem hiding this comment.
I have now changed the looping to use the iris slices_over method with the realization dimension.
bayliffe
left a comment
There was a problem hiding this comment.
One more question, but this looks good. Thanks for all the changes.
e911f7c to
2549cef
Compare
cpelley
left a comment
There was a problem hiding this comment.
Please remember to expose the plugin via improver/api/init.py
24cf6c2 to
3d041d1
Compare
bayliffe
left a comment
There was a problem hiding this comment.
Stuff to fix, but basically there.
| - pysteps | ||
| >>>>>>> 897e0cb9 (Add pytest to environments) | ||
| ======= | ||
| >>>>>>> 08001d9b (Undo environemnt changes) |
There was a problem hiding this comment.
You've left unresolved conflicts from merging in these files which is causing the tests to fail.
| # estimate-emos-coefficients, nowcast-accumulate, nowcast-extrapolate, | ||
| # nowcast-optical-flow-from-winds, and stochastic-noise. | ||
| # See doc/source/Dependencies.rst for more information. | ||
| >>>>>>> 08001d9b (Undo environemnt changes) |
There was a problem hiding this comment.
Further unresolved merging issues.
bd73a41 to
0f9b432
Compare
There was a problem hiding this comment.
I have pulled in the latest changes from upstream here. I am however not sure if this looks correct
There was a problem hiding this comment.
Nope. You can look at the current upstream master to see what's there:
https://github.com/metoppv/improver/blob/master/envs/environment_b.yml
Unless you intended to delete the temporal-interpolate and forecast-trajectory-gap-filler entries then this is incorrect.
maxwhitemet
left a comment
There was a problem hiding this comment.
Thanks @bayliffe. I fixed the problems highlighted.
…lustering * upstream/master: Add attribute to record secondary forecast sources when clustering realizations (metoppv#2332) 953 stochastic noise (metoppv#2275) Add configurable grid spacing relative tolerance (metoppv#2308) Cube dim validation utility (metoppv#2327)

Addresses #953.
This PR adds the plugin, CLI, and tests for stochastic noise generation.
The acceptance tests show the impact, with data available here.

Testing: