[GRASS-git] [OSGeo/grass] ddf66e: r.sim: Add -p flag with format=json run summary an...

Corey White noreply at github.com
Tue Sep 29 21:04:25 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: ddf66e9d5c9e03068bb0a46620d09f22a023fc8e
      https://github.com/OSGeo/grass/commit/ddf66e9d5c9e03068bb0a46620d09f22a023fc8e
  Author: Corey White <smortopahri at gmail.com>
  Date:   2026-09-30 (Wed, 30 Sep 2026)

  Changed paths:
    M raster/r.sim/CMakeLists.txt
    M raster/r.sim/r.sim.sediment/main.c
    M raster/r.sim/r.sim.sediment/r.sim.sediment.html
    M raster/r.sim/r.sim.sediment/r.sim.sediment.md
    A raster/r.sim/r.sim.sediment/tests/r_sim_sediment_summary_test.py
    M raster/r.sim/r.sim.water/main.c
    M raster/r.sim/r.sim.water/r.sim.water.html
    M raster/r.sim/r.sim.water/r.sim.water.md
    A raster/r.sim/r.sim.water/tests/r_sim_water_summary_test.py
    M raster/r.sim/simlib/Makefile
    M raster/r.sim/simlib/hydro.c
    M raster/r.sim/simlib/input.c
    M raster/r.sim/simlib/output.c
    M raster/r.sim/simlib/simlib.h
    A raster/r.sim/simlib/summary.c

  Log Message:
  -----------
  r.sim: Add -p flag with format=json run summary and normalize history (#7972)

* r.sim: Add -p flag with format=json run summary and normalize history

Add a -p flag and a format=plain|json option to r.sim.water and
r.sim.sediment which print a summary of the run (walker counts, time
step, iteration counts, mean velocity, mean Manning's n, mean source
rate, early stop, and the names and simulated times of the written maps)
to standard output. Without -p nothing is printed to standard output.

Replace the three inconsistent history blocks in simlib with one helper
whose labels are the same keys as the printed summary, and record the
same values for every written map. Free the time series map names which
were leaked before, and compute the simulated time of the final maps
from the number of completed iterations rather than the loop counter.
Convert stray printf calls in the walker loop to G_debug so standard
output stays clean.

Add pytest tests on the shared raster fixture, and document the keys and
units in both manuals.

Addresses #7923. Seeds are left to #7884.

AI assisted.

* r.sim: Address review of the run summary

Report time_step as the simulated time per iteration (the time step
times the time coefficient) and drop time_coefficient,
iterations_per_output, elevation_min and elevation_max. Rename
walkers_active to walkers_remaining. Report transport_capacity and
tlimit_erosion_deposition once at the top level of the sediment summary
since they are written before the simulation starts. Emit null for a
non-finite sediment time step instead of dropping the key. List only the
given input maps in the history data source fields instead of formatting
NULL names. Reuse the simulated time helper in the main loop, link parson
only from the library, and add the SPDX header to summary.c.

AI assisted.

* r.sim: Report simulated time with fractions and add SPDX headers to tests

The number of iterations is rounded down, so the simulated time reached
is slightly less than the requested duration. Reporting it as an integer
hid that. Report it as a floating point number in the summary and in the
history, and use the same value for the map timestamps.

AI assisted.



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