r.sim: disable broken nblock usage#7358
Open
petrasovaa wants to merge 3 commits into
Open
Conversation
metzm
previously approved these changes
May 2, 2026
Contributor
metzm
left a comment
There was a problem hiding this comment.
The changes look good to me, thanks!
Looking forward to a proposal enabling nblocks > 1.
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.
TL;DR
Disabled the broken nblock >1 auto-split in r.sim.water/r.sim.sediment by forcing nblock=1. Kept the variables so that nblocks functionality can be enabled in follow up PRs.
Fixed the err formula to the original fortran's Monte Carlo stddev (fixes #4799). As a result error map is now 0 and will become more useful once nblocks will be enabled to be > 1.
Background
nblock originated in the Fortran ancestor as a memory workaround for running more walkers than the static buffer held; the C port inherited the structure but eventually mangled the per-block walker
accounting (rwalk was never actually divided), silently producing biased depth/discharge for users beyond the MAXW cap.
Summary of changes
sqrt(|E[(gama·conn)²]/nblock − gama²|)); previously the C port had a wrong exponent and a missingpost-loop step that produced a quantity with no clean meaning (fixes [Bug] r.sim.water: error output is not error but sum of depths? #4799). With nblock = 1 today it's zero everywhere; it becomes meaningful when nblock > 1 is reintroduced.
and outputs are unchanged.
Behavior changes
to all-zeros (correct stddev for one sample).
Not in this PR