Skip to content

r.plane: add tests for computed plane values - #7497

Merged
petrasovaa merged 4 commits into
OSGeo:mainfrom
Valyrian-Code:r.plane-value-tests
Jun 9, 2026
Merged

petrasovaa merged 4 commits into
OSGeo:mainfrom
Valyrian-Code:r.plane-value-tests

Conversation

@Valyrian-Code

Copy link
Copy Markdown
Contributor

Description

The existing r.plane testsuite only checks that the output raster exists; it
never verifies the computed values (and it needs the NC sample dataset). This
adds a pytest module that asserts the actual plane geometry on a small synthetic
XY region (no sample dataset required):

  • A 45-degree plane dipping east through the origin gives z == easting at every
    cell.
  • A horizontal plane (dip=0) equals the given elevation everywhere.

Motivation and context

r.plane computes a tilted plane from a dip, azimuth, and a point; that math was
untested. These assertions pin the geometry so a regression in the computation
would be caught.

How has this been tested?

pytest scripts/r.plane/tests/r_plane_test.py — 2 tests pass. Values were
confirmed against the running tool (r.out.xyz). ruff format and ruff check
are clean.

Types of changes

  • Tests

Copilot AI review requested due to automatic review settings June 3, 2026 18:02
@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 Jun 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds automated tests for r.plane to validate core plane-generation behaviors in a small synthetic region.

Changes:

  • Introduces a new pytest test module for r.plane.
  • Adds coverage for a 45° east-dipping plane and a horizontal (dip=0) plane.
  • Adds a small helper to parse r.out.xyz output for assertions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/r.plane/tests/r_plane_test.py Resolved
Comment thread scripts/r.plane/tests/r_plane_test.py Resolved
Comment thread scripts/r.plane/tests/r_plane_test.py Resolved
Comment thread scripts/r.plane/tests/r_plane_test.py Resolved
The existing testsuite only checks that the output raster exists. Add a pytest module that asserts the actual plane geometry on a synthetic XY region: a 45-degree plane dipping east through the origin gives z == easting, and a horizontal plane (dip=0) equals the given elevation everywhere.
@Valyrian-Code
Valyrian-Code force-pushed the r.plane-value-tests branch from 30faf76 to 4220ac0 Compare June 3, 2026 18:11
@RAJVEER42

Copy link
Copy Markdown

The failing macOS check here is unrelated to this PR. It is the flaky r.sim.water test_nodxdy (a stochastic, parallel SIMWE simulation — the test notes that parallelization affects the random number generator, and the failure is a tiny stochastic difference). This PR only adds tests for r.plane and does not touch r.sim.water; the same test passed on my other PRs from the same base. Could a maintainer re-run the failed job? Thanks!

@petrasovaa petrasovaa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use r.stats with format=json instead of r.out.xyz parsing.
Seems the gunittest test can be dropped, no need to duplicate.

@Valyrian-Code

Copy link
Copy Markdown
Contributor Author

Thanks Anna, done both:

  • The tests now use r.stats with format=json instead of parsing r.out.xyz, so there is no manual text parsing (the .json result is read directly with flags="gn").
  • Dropped the old gunittest (testsuite/test_r_plane.py); it only checked that the output map exists, which the value tests already cover.

Verified both tests pass locally.

@petrasovaa
petrasovaa merged commit 3cf1c70 into OSGeo:main Jun 9, 2026
26 checks passed
@github-actions github-actions Bot added this to the 8.6.0 milestone Jun 9, 2026
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Jul 7, 2026
The existing testsuite only checks that the output raster exists. Add a pytest module that asserts the actual plane geometry on a synthetic XY region: a 45-degree plane dipping east through the origin gives z == easting, and a horizontal plane (dip=0) equals the given elevation everywhere.
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