r.geomorphon: replace testsuite with pytest reference - #7785
Conversation
petrasovaa
left a comment
There was a problem hiding this comment.
Remove all the nprocs tests, they will be needed in the parallelization PR.
|
|
||
| # A polynomial of row and col with cubic terms so curvature varies and | ||
| # several landform classes appear without any rand or trig. | ||
| DEM_EXPRESSION = ( |
There was a problem hiding this comment.
This results only in a few classes.
5f9c8bc to
1674d91
Compare
| ("forms_meters", "forms", {"flags": "m"}), | ||
| ("forms_skip1", "forms", {"skip": 1}), | ||
| ("forms_anglev2", "forms", {"comparison": "anglev2"}), | ||
| ("forms_anglev2_distance", "forms", {"comparison": "anglev2_distance"}), |
There was a problem hiding this comment.
The comparison parameter values are not actually being used, the case is not being triggered, the results are the same for the default parameter. So it may be less misleading to remove them from the test.
Similarly, the m flag with resolution 1 we wouldn't be able to see a difference, so please either remove or fix it.
There was a problem hiding this comment.
Removed forms_meters, forms_anglev2, and forms_anglev2_distance. They produced the same results as the default on this DEM, so the tests could not catch a regression there.
| """The forms output contains every landform class from flat to pit.""" | ||
| tools = Tools(session=fixed_region) | ||
| tools.r_geomorphon( | ||
| elevation="dem", forms="forms_all", search=SEARCH, overwrite=True |
There was a problem hiding this comment.
minor, but setting overwrite is generally not needed.
There was a problem hiding this comment.
Removed the overwrite setting from the calls
| assert stats[field] == pytest.approx(ref[field], rel=1e-6, abs=5e-8) | ||
|
|
||
|
|
||
| def test_landform_class_set(fixed_region): |
There was a problem hiding this comment.
The previous test was testing labels, might be worth keeping that here.
There was a problem hiding this comment.
Extended test_landform_class_set to also check the r.category labels like the old testsuite did.
Removes the untriggered comparison cases and overwrite flags and restores the label check.
This PR replaces the old gunittest testsuite for r.geomorphon with pytest. It has 8 reference tests checking output statistics on a small deterministic DEM across the main option combinations. It also has 4 parallel correctness tests that compare multi thread output against single thread. The parallel tests are marked skip for now since the module has no nprocs option yet. But, the skip gets removed in the parallelization PR #7783 once this merges.