Skip to content

r.geomorphon: Add tests for parameter validation, outputs, flags, and comparison modes#6981

Open
sumitchintanwar wants to merge 5 commits intoOSGeo:mainfrom
sumitchintanwar:fix/add-tests-r-geomorphon
Open

r.geomorphon: Add tests for parameter validation, outputs, flags, and comparison modes#6981
sumitchintanwar wants to merge 5 commits intoOSGeo:mainfrom
sumitchintanwar:fix/add-tests-r-geomorphon

Conversation

@sumitchintanwar
Copy link
Contributor

@sumitchintanwar sumitchintanwar commented Jan 27, 2026

Description

This PR significantly strengthens the test suite for r.geomorphon by adding reference-data based validation using the NC dataset (nc_spm_full_v2beta1).

Tests now validate algorithm behavior by comparing outputs against reference data, improving regression detection and ensuring stability across parameters, flags, and modes.
Earlier smoke-style checks (mean, stddev bounds and consistency checks) have been replaced with reference comparisons.

Changes

  • Algorithm validation using referenced univariate statistics for real and synthetic data
  • Parameter validation for search/skip constraints, flatness threshold, and required outputs
  • Reference-based validation of multiple outputs (forms, ternary, intensity, elongation)
  • Flag behavior validation for extended correction (-e) and meter units (-m)
  • Reference validation of comparison modes (anglev1, anglev2, anglev2_distance)
  • JSON profile output format validation

Test Results

Test coverage increased from 2 to 12.
All tests pass successfully.

Notes:

  • The latest commit validates r.geomorphon outputs against fixed reference data from the NC (nc_spm_full_v2beta1) dataset. Earlier commits only used lightweight sanity checks such as mean/stddev bounds and consistency checks.
  • Some slow tests are skipped for CI

@sumitchintanwar
Copy link
Contributor Author

@wenzeslaus I have added the tests for r.geomorphon. Review appreciated.

@sakirr05
Copy link
Contributor

Hey @sumitchintanwar
Just to clarify, is this PR intended to address the JSON → parson refactor discussed in #6970, or is it focused specifically on test coverage?
Also, could you share how you tested these changes locally (GRASS version / environment)?

I’m interested in working on the parson-based JSON rewrite itself (keeping output semantics identical), so wanted to make sure efforts don’t overlap. Happy to coordinate if needed.

@github-actions github-actions bot added raster Related to raster data processing Python Related code is in Python module tests Related to Test Suite labels Jan 27, 2026
@echoix
Copy link
Member

echoix commented Jan 27, 2026

Hey @sumitchintanwar

Just to clarify, is this PR intended to address the JSON → parson refactor discussed in #6970, or is it focused specifically on test coverage?

Also, could you share how you tested these changes locally (GRASS version / environment)?

I’m interested in working on the parson-based JSON rewrite itself (keeping output semantics identical), so wanted to make sure efforts don’t overlap. Happy to coordinate if needed.

See #6924, I think he already did the refactor.

@sumitchintanwar sumitchintanwar changed the title r.geomorphon : Add tests for parameter validation, outputs, flags, and comparison modes r.geomorphon: Add tests for parameter validation, outputs, flags, and comparison modes Jan 28, 2026
@sumitchintanwar
Copy link
Contributor Author

Hey @sumitchintanwar
Just to clarify, is this PR intended to address the JSON → parson refactor discussed in #6970, or is it focused specifically on test coverage?
Also, could you share how you tested these changes locally (GRASS version / environment)?

I’m interested in working on the parson-based JSON rewrite itself (keeping output semantics identical), so wanted to make sure efforts don’t overlap. Happy to coordinate if needed.

Hwy @sakirr05, this PR is focused specifically on test coverage only. It doesn't address the JSON refactor from #6970.

Testing:
Grass Version: 8.4
Environment : Ubuntu 22.04
Command: "python3 test_r_geom.py" in the testsuite directory

I am currently not working on the JSON refactor. The tests I added should actually be helpful for validating the parson-based rewrite when you implement it. They ensure the modules behaviour remains consistent before/after the refactor.

Feel free to proceed with the parson work. No overlaps here.

Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are mostly smoke tests, still useful, but they don't test resulting values in any way and so if anything changes in the algorithm, they won't capture that. Also please add a test for the profileformat parameter that's relevant for the JSON.

@sumitchintanwar
Copy link
Contributor Author

sumitchintanwar commented Feb 8, 2026

@wenzeslaus @petrasovaa, a quick review and any feedback would be appreciated. The latest commit contains the finalised, reference-based tests using the NC dataset, which should now serve as proper regression tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants