This module is the required first step of the Fill–Spill–Merge workflow (Barnes et al., 2020, 2021). Its outputs feed directly into r.richdem.fsm.
The hierarchy is stored as a forest of binary trees: each node represents a depression (leaf or meta), and the two children of any meta-depression are the two depressions that merged to form it. Separately, ocean links record depressions that drain directly to the ocean rather than to another depression.
Depression hierarchy terminology. (a) Binary tree relating leaf and meta depressions.
(b–d) Cross-sections illustrating nested leaf, marginal, and meta depressions.
(e) Volume–elevation relationship with Parent, Leaf, and Spillover components.
Figure 2 from Barnes, Callaghan & Wickert (2021), CC-BY 4.0.
A forest of binary trees representing the depression hierarchy of a landscape.
Solid lines connect parent meta-depressions to their two child depressions; dashed
arrows show geolinks (overflow connections between adjacent depressions) and ocean
links. Each numbered node corresponds to a leaf or meta depression label stored in
output_labels and output_hierarchy.
Figure 1 from Barnes, Callaghan & Wickert (2020), CC-BY 4.0.
output_flowdirs contains a D8 flow direction for each cell. Directions are encoded as integers 0–7 counting counter-clockwise from east (matching the RichDEM convention). Pit cells, which have no outflow direction, are stored with value 8.
Layer 1 — depressions table contains one feature per depression. Leaf depressions are represented as area polygons (derived from the labels raster). Meta-depressions are represented as points located at the saddle cell (out_cell) where their two child depressions merge. Attribute columns include:
Layer 2 — ocean_links table is a junction table with one row per direct ocean connection. Some depressions drain to the ocean through multiple independent pathways; this table records each (dep_label, linked_label) pair. Columns: cat, dep_label, linked_label.
Example output_labels outputs for a DEM of northern Madagascar.
(a) Leaf-depression labels: each distinct color is a separate leaf depression.
(b) Top-level (root) depression labels: only the largest containing hierarchy level is shown.
(c) Filtered labels retaining only depressions above a minimum area threshold.
Figure 9 from Barnes, Callaghan & Wickert (2020), CC-BY 4.0.
The input DEM does not need to be pre-conditioned (filled or breached); the algorithm handles all depressions, including nested ones. Raw DEMs with noise may produce a large number of very small leaf depressions.
The output labels raster stores uint32 values internally but is written to GRASS as a DCELL (double-precision float) map because GRASS has no native unsigned 32-bit integer raster type. All label values up to 232 − 2 are representable exactly as doubles.
This module requires the RichDEM Python package, which is not a standard GRASS GIS dependency and must be installed separately:
pip install richdem
If pip install richdem fails (the package requires a C++ compiler),
build from source:
git clone https://github.com/r-barnes/richdem.git cd richdem/wrappers/pyrichdem pip install -e .
Ensure that RichDEM is installed into the same Python environment used by GRASS GIS.
r.richdem.dephier input=dem \
output_labels=dep_labels \
output_flowdirs=dep_flowdirs \
output_hierarchy=dep_hierarchy
v.db.select map=dep_hierarchy layer=1 | head -20
# Select only leaf depressions v.extract input=dep_hierarchy layer=1 where="type='leaf'" output=leaf_deps v.colors map=leaf_deps use=attr column=dep_vol color=blues
r.richdem.fsm input=dem \
labels=dep_labels \
flowdirs=dep_flowdirs \
hierarchy=dep_hierarchy \
water_depth=wtd \
output=wtd_after
GRASS GIS bindings: Andrew D. Wickert, with assistance from Claude Sonnet 4.6
Available at: r.richdem.dephier source code (history)
Latest change: Sunday May 31 20:21:19 2026 in commit: 2163cf63360e0ce5bfae95f4815c63ffbb9dda5c
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
© 2003-2026 GRASS Development Team, GRASS 8.5.1dev Reference Manual