[GRASS-git] [OSGeo/grass] ab6f35: r3.cross.rast: add test file (#6117)

Jayneel Shah noreply at github.com
Sat Jul 26 14:35:37 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: ab6f35014ec46c07f76b93fa6268ef9e4fa4b3b2
      https://github.com/OSGeo/grass/commit/ab6f35014ec46c07f76b93fa6268ef9e4fa4b3b2
  Author: Jayneel Shah <80264736+jayneel-shah18 at users.noreply.github.com>
  Date:   2025-07-26 (Sat, 26 Jul 2025)

  Changed paths:
    A raster3d/r3.cross.rast/testsuite/test_r3_cross_rast.py

  Log Message:
  -----------
  r3.cross.rast: add test file (#6117)

This PR introduces a regression test suite for the `r3.cross.rast` GRASS module. The tests are designed to validate the correctness and stability of 2D cross-section extraction from 3D voxel data using various elevation maps under controlled region settings.

### Tests Included:
* **test\_cross\_section\_at\_flat\_plane**: Verifies that extracting a cross-section at a constant elevation (z = 5) returns the correct voxel values. Serves as a baseline test for fixed Z-plane interpolation.

* **test\_cross\_section\_with\_diagonal\_elevation**: Tests cross-section generation with a sloped elevation surface defined as `(row() + col()) / 2`. Confirms statistics based on expected voxel data.

* **test\_elevation\_above\_voxel\_returns\_nulls**: Ensures that when elevation values lie above the 3D raster extent, the resulting 2D output is completely NULL. This validates correct handling of out-of-bound Z queries.

> **Note:** This test uses `r.univar -g` instead of `format=json` because the JSON output returns `None` when the entire map is NULL. If there is another way to detect this condition without using the deprecated `-g` flag, I will update the implementation accordingly.

* **test\_null\_cells\_in\_elevation\_propagate**: Confirms that NULL values in the input elevation raster result in NULL values in the corresponding output cells. This validates elevation NULL handling logic in the module.



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list