Skip to content

r.category: Add optional JSON input for r.category #6991

Open
sumitchintanwar wants to merge 3 commits intoOSGeo:mainfrom
sumitchintanwar:feat/r-category-support-json-inputs
Open

r.category: Add optional JSON input for r.category #6991
sumitchintanwar wants to merge 3 commits intoOSGeo:mainfrom
sumitchintanwar:feat/r-category-support-json-inputs

Conversation

@sumitchintanwar
Copy link
Contributor

@sumitchintanwar sumitchintanwar commented Jan 28, 2026

Fixes #4072
This PR adds optional JSON support for r.category rule files to reduce formatting errors and improve usability with external tools.

The changes are split into 3 parts:

  1. Declaration/helper addition at the header
  2. Core JSON parsing and Integration
  3. Tests for JSON rules input

All 12 tests passed.


platform linux -- Python 3.10.12, pytest-9.0.2, pluggy-1.6.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/sumit/grass/grass-8.4.latest.git
configfile: pyproject.toml
collected 12 items                                                                                                                                                                                                                                                                                                   

r_category_test.py::test_r_category_plain_output PASSED                                                                                                                                                                                                                                                        [  8%]
r_category_test.py::test_r_category_default_separator PASSED                                                                                                                                                                                                                                                   [ 16%]
r_category_test.py::test_r_category_with_range PASSED                                                                                                                                                                                                                                                          [ 25%]
r_category_test.py::test_r_category_float_map PASSED                                                                                                                                                                                                                                                           [ 33%]
r_category_test.py::test_r_category_separator_variants PASSED                                                                                                                                                                                                                                                  [ 41%]
r_category_test.py::test_r_category_input_separators PASSED                                                                                                                                                                                                                                                    [ 50%]
r_category_test.py::test_r_category_multiword_input PASSED                                                                                                                                                                                                                                                     [ 58%]
r_category_test.py::test_r_category_extreme_incorrect_values PASSED                                                                                                                                                                                                                                            [ 66%]
r_category_test.py::test_r_category_json_output PASSED                                                                                                                                                                                                                                                         [ 75%]
r_category_test.py::test_r_category_with_json_output_color PASSED                                                                                                                                                                                                                                              [ 83%]
r_category_test.py::test_r_category_with_plain_output_color PASSED                                                                                                                                                                                                                                             [ 91%]
r_category_test.py::test_r_category_json_input PASSED                                                                                                                                                                                                                                                          [100%]

@sumitchintanwar sumitchintanwar force-pushed the feat/r-category-support-json-inputs branch from a5a6d61 to 0159396 Compare January 28, 2026 21:18
@github-actions github-actions bot added raster Related to raster data processing Python Related code is in Python C Related code is in C libraries module tests Related to Test Suite labels Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C Related code is in C libraries module Python Related code is in Python raster Related to raster data processing tests Related to Test Suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] r.category: support JSON rules file

1 participant