Stochastic noise fallback if no precipitation - #2415
Open
gavinevans wants to merge 6 commits into
Open
Conversation
gavinevans
marked this pull request as draft
July 23, 2026 07:41
…s discrete from stochastic noise that is generated when a realization is wet.
gavinevans
marked this pull request as ready for review
July 23, 2026 13:49
…h between 0 and >0 given that the units are m/s.
…all, but an error is still raised, likely due to window level degeneracy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues: #2275, #2346, #2363, #2400
improver_test_data PR: metoppv/improver_test_data#142
Description
This PR is aimed at making the stochastic noise robust to the complete lack of precipitation in the domain. Currently, this results in an error arising from the Short-Space Fourier Transform code in pysteps, as there are no values greater than the minimum, as the field is a constant value. Note that fields that are completely wet (even with a constant, greather than 0 value for precipitation everywhere) are already handled, as the stochastic noise is specifically only intended for grid points that are dry. Completely dry domains therefore need to be handled in some way. This PR adopts a fallback approach where, in the case of a completely dry precipitation field, random noise will be generated. This random noise will be offset, similar to the offset currently applied to scale the FFT-based stochastic noise to be negative, so that the random noise added to a completely dry realization is negative, and broadly fits with the use of this stochastic noise plugin to provide a template for an Ensemble Copula Coupling-based process. The plugin has been constructed so that the random noise created by a dry realization will be discrete from the spatially correlated stochastic noise created for wet realizations with dry realizations having more negative values.
Testing: