Repository navigation
r.colors.stddev: add tests - #7487
Merged
Merged
Conversation
r.colors.stddev had no test coverage. Add a pytest module that builds a raster with a known mean and standard deviation and checks the resulting color table: default mode places white at the mean and blue/red at mean -/+ two standard deviations, and banded mode (-b) centers the green band on mean -/+ one standard deviation.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds automated tests for r.colors.stddev to validate that generated color rules align with expected mean/stddev breakpoints for both default and banded modes.
Changes:
- Introduces a new pytest module covering default and
-b(banded) behavior. - Creates a small deterministic raster (values 1..9) to assert expected rule breakpoints via
r.colors.outJSON.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
echoix
approved these changes
Jun 3, 2026
echoix
enabled auto-merge (squash)
June 4, 2026 21:15
ninsbl
pushed a commit
to ninsbl/grass
that referenced
this pull request
Jul 7, 2026
r.colors.stddev had no test coverage. Add a pytest module that builds a raster with a known mean and standard deviation and checks the resulting color table: default mode places white at the mean and blue/red at mean -/+ two standard deviations, and banded mode (-b) centers the green band on mean -/+ one standard deviation.
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.
Description
r.colors.stddevhad no test coverage. This adds a pytest module that builds araster with a known mean and standard deviation (values 1..9) and checks the
resulting color table:
mean - 2*stddev, and redat
mean + 2*stddev.-b): the central green band spansmean - stddevtomean + stddev.The expected mean and (population) standard deviation are computed in the test
with the standard library, so the assertions are self-contained.
Motivation and context
scripts/r.colors.stddevis a small, deterministic script with no tests.Adding coverage fits the ongoing effort to write pytest tests for GRASS tools.
How has this been tested?
pytest scripts/r.colors.stddev/tests/r_colors_stddev_test.py— 2 tests pass.ruff formatandruff checkare clean.Types of changes