Repository navigation
r.category: preserve raster title when using rules= - #7299
Merged
Merged
Conversation
Contributor
Author
|
@petrasovaa Can u please review it ? All checks have passed |
petrasovaa
requested changes
Apr 15, 2026
petrasovaa
left a comment
Contributor
There was a problem hiding this comment.
You have unrelated changes in your PR.
Replace direct cats-file reading with r.info -e (JSON format) to verify the preserved title. The cats file is an internal format; using the public API is more robust and is consistent with how other tests and tools read raster metadata.
HUN-sp
force-pushed
the
fix/r-category-preserves-title
branch
from
April 15, 2026 18:26
cb6b985 to
93d2bbd
Compare
Contributor
Author
|
@petrasovaa Cleaned up the branch, the unrelated commits were fixes for CI failures that came up while working on this PR and should have been separate PRs. Test now uses r.info -e with JSON format as suggested. |
petrasovaa
requested changes
Apr 15, 2026
- Remove extra braces around title-preservation block; move variable declarations to the top of the enclosing block - Use Rast_get_cats_title() instead of accessing the struct field directly - Use grass.tools Tools API in the test instead of grass.script - Drop unnecessary -e flag from r.info call in the test
HUN-sp
force-pushed
the
fix/r-category-preserves-title
branch
from
April 15, 2026 20:37
803fa99 to
989f3ff
Compare
Contributor
Author
|
Addressed all four comments:
|
Contributor
Author
|
@petrasovaa Hi , whenever u have time , please do review this. |
Contributor
Author
|
@petrasovaa Hi, any update on this ? |
petrasovaa
reviewed
Apr 21, 2026
HUN-sp
force-pushed
the
fix/r-category-preserves-title
branch
from
April 21, 2026 11:46
5fa045d to
a5fb815
Compare
petrasovaa
approved these changes
Apr 23, 2026
petrasovaa
enabled auto-merge (squash)
April 23, 2026 20:32
Contributor
Author
|
Thank you @petrasovaa for the reviews and guidance on getting this merged . |
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.
Summary
Fixes #7199.
When
rules=is used inr.category, the raster title gets overwritten because the category structure is initialized with an empty title. As a result, any previously set title is lost.This change preserves the existing raster title while still replacing category labels based on the provided rules.
Testing
r.supportr.category rules=r.info