Repository navigation
r.univar: Fix max of all-null maps and zones - #8099
Merged
Merged
Conversation
Member
|
There’s a kind of outage when installing Ubuntu packages it seems. Let’s wait before trying to trigger new runs (I reran a couple and still failed) |
wenzeslaus
requested changes
Oct 21, 2026
wenzeslaus
left a comment
Member
There was a problem hiding this comment.
You could add the min test as suggested in my comment or given that both min and max can be tested and zd->bucket.n is thread-local, the lock can be acquired only later (hopefully slightly faster than the current code on main). The update test then continues to use the values in question.
// (Untested code)
if (zd->bucket.n != 0) {
#if defined(_OPENMP)
omp_set_lock(&minmax[z]);
#endif
// The max and min values are tested for NaN (their defaults).
if (stats[z].max < zd->max || stats[z].max != stats[z].max)
stats[z].max = zd->max;
if (stats[z].min > zd->min || stats[z].min != stats[z].min)
stats[z].min = zd->min;
#if defined(_OPENMP)
omp_unset_lock(&minmax[z]);
#endif
}
wenzeslaus
approved these changes
Oct 22, 2026
wenzeslaus
left a comment
Member
There was a problem hiding this comment.
Thank you! It is very important to keep improving r.univar, not only important to users, but we use that a lot in tests as well.
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.
Fix r.univar reporting -DBL_MAX instead of nan (JSON null) as the maximum of all-null maps and zones, wrong since 8.4.0 because #3512 changed the start value but not the merge check; adds a pytest test that fails without the fix.
Claude was used as a coding assistant.