Skip to content

Reverted conditional to hardcoded value True - #631

Merged
ladc merged 7 commits into
mainfrom
revert_conditional
Nov 25, 2026
Merged

ladc merged 7 commits into
mainfrom
revert_conditional

Conversation

@larsbonnefoy

@larsbonnefoy larsbonnefoy commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

False would lead to exploding rainfall values outside of radar domain.

This is a temporary fix as a clear solution as not yet been decided on. See issue #579 for further discussion

…xploding rainfall values outside of radar domain. See issue #579
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@larsbonnefoy
larsbonnefoy requested a review from ladc November 18, 2026 13:53
@FelixE91

FelixE91 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Can we have a similar temporary fix to be merged into v1.x?
Although we stopped development of new features for version 1.x, I think we should still apply important fixes.

579-fix-for-branch-v1.x into v1.x might actually do that - to be checked: We will need to remove the FutureWarning as we have not decided yet how to deal with #579 .

Make comments clearer for both cases.
This was the behaviour before the 2024 refactor.
@ladc

ladc commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Hi @FelixE91, I think this parameter will not be removed in v2 so the FutureWarning may not be necessary after all. As far as I know, we have not yet figured out how the different combinations (of probability matching, conditional, precip_thr) interact and how @alanseed's fix might or might not change this. I would suggest to simply revert both in main and in v1.x until we have time to study this more in-depth.

@ladc ladc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, for symmetry I will just also check for exploding values in the nowcast tests and set the seeds fixed.

Comment thread pysteps/tests/test_blending_steps.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Automatic noise adjustment can produce NaN coefficients for a radar frame with exactly one wet pixel, contaminating nowcasting and blending forecasts; a finite fallback and regression tests are needed.

1 open issue
What changed in this PR

This PR temporarily forces conditional noise-adjustment statistics in STEPS nowcasting and blending to address extreme rainfall values reported in #579.

Changes:

  • Hardcodes conditional=True for automatic noise adjustment in both forecast implementations.
  • Documents that noise adjustment ignores the user’s conditional setting.
  • Adds precipitation-limit regression assertions and fixes random seeds for reproducibility.
File Description
pysteps/​tests/​test_nowcasts_steps.py Returns forecast values for a precipitation-limit assertion and sets a fixed seed.
pysteps/​tests/​test_blending_steps.py Adds low-rain-fraction cases, precipitation limits, and a fixed seed.
pysteps/​nowcasts/​steps.py Forces conditional noise adjustment and documents the override.
pysteps/​blending/​steps.py Restores conditional noise adjustment and documents the temporary workaround.

Review effort: Balanced (adaptive)

Comment thread pysteps/nowcasts/steps.py Resolved
Set adjustment to 1.0 in case of NaNs (e.g. single wet pixel).
@ladc
ladc requested a review from FelixE91 November 25, 2026 10:39
@ladc

ladc commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

By the way, in addition to reverting back to the previous behaviour for both blended and nonblended steps, this now also puts any NaN values in the stddev to 1.0 (e.g. in case of a single wet pixel stddev is not defined = NaN as detected by the copilot review), and this makes the code a bit more robust.

FelixE91
FelixE91 previously approved these changes Nov 25, 2026

@FelixE91 FelixE91 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes should fix the issue #579 temporarily, which is the objective of this PR.

@ladc I have two comments/questions to discuss before it's merged into main (see review).

In addition: Is a similar fix planned for v1.x - since this fixes main?

Comment thread pysteps/blending/steps.py Resolved
Comment thread pysteps/tests/test_blending_steps.py Resolved
@FelixE91
FelixE91 dismissed their stale review November 25, 2026 14:30

I found something we should fix first

@FelixE91 FelixE91 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests need a little bit of work (see comments).

We should also add a test for 1 wet pixel to test if it is fixed (see copilot's issue).

Comment thread pysteps/tests/test_nowcasts_steps.py Resolved
@ladc
ladc requested a review from FelixE91 November 25, 2026 15:59

@FelixE91 FelixE91 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed latest changes and this solves #579 temporarily.

The 1-wet-pixel test is a more general thing that will be treated in its own issue.

Guess we are good to go here.

@ladc
ladc merged commit f265dce into main Nov 25, 2026
18 of 19 checks passed
@ladc
ladc deleted the revert_conditional branch November 25, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants