[GRASS-git] [OSGeo/grass] 6902cc: r.sim.water: Add pytest tests with synthetic data ...

Vaclav Petras noreply at github.com
Tue Sep 29 11:19:55 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 6902ccfbd608c6385aae23e7a5e8d0acf8461899
      https://github.com/OSGeo/grass/commit/6902ccfbd608c6385aae23e7a5e8d0acf8461899
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    A raster/r.sim/r.sim.water/tests/r_sim_water_landforms_test.py
    A raster/r.sim/r.sim.water/tests/r_sim_water_test.py

  Log Message:
  -----------
  r.sim.water: Add pytest tests with synthetic data (#7968)

Add 42 pytest tests for r.sim.water (SIMWE) on tiny synthetic domains
that need no sample dataset and run in 15 to 20 seconds, 31 tests of the
parameters and outputs on one-row and one-column slopes and 11 tests of
flow on small landforms (pit, peak, ridge, valley, saddle, hollow versus
spur, terraces).

The slope tests check that rain, Manning's n, infiltration, slope
steepness and the diffusion parameters move depth in the physically
expected direction, with the kinematic-wave exponents where they apply,
that depth increases cell by cell downstream, that raster and scalar
parameters agree, that discharge respects a mass-balance bracket, that
mintimestep acts as a floor with a predictable accuracy cost, and that
flow_control, duration, time-series output, observation points, walker
output, the error output, internally computed slopes, the -s flag and
nprocs behave as documented.

The landform tests assert what the model must do on each landform for
any random seed, with tolerances from multi-seed sweeps, and record the
full depth grid for seed 42 to two decimal places, compared at 0.01 mm,
so that any change in the simulated result shows up. Assertions on
single cells or columns run with 1000 or 10000 walkers, where the
seed-to-seed spread levels off. Elevation surfaces are NumPy arrays
passed directly to the tool, and rotated variants are derived with
np.rot90.

The suite complements the gunittest on the North Carolina sample
dataset, which pins realistic rasters at 1e-6 but needs the dataset and
cannot tell a wrong parameter direction from a right one. All tests use
a fixed seed with nprocs=1 because multi-threaded runs are not
reproducible at this point.

The tests, the seed sweeps and the tolerance analysis were done with
substantial AI assistance (Claude Code) and reviewed by the author.



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