GRASS logo

NAME

r.richdem.resolveflats - Resolve flat areas in a DEM by imposing a local gradient using RichDEM

KEYWORDS

raster, hydrology, flat areas

SYNOPSIS

r.richdem.resolveflats
r.richdem.resolveflats --help
r.richdem.resolveflats input=name output=name [--overwrite] [--help] [--verbose] [--quiet] [--ui]

Flags:

--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog

Parameters:

input=name [required]
Input (filled or breached) elevation raster
output=name [required]
Output elevation raster with resolved flats

Table of contents

DESCRIPTION

r.richdem.resolveflats imposes a small epsilon gradient on flat areas of a DEM so that every cell has a unique downhill neighbor and a well-defined flow direction. Flat areas—regions in which all cells share the same elevation—commonly arise after depression filling or in gently sloping terrain and prevent the computation of meaningful flow directions.

The algorithm of Barnes et al. (2014) constructs two auxiliary gradient fields and combines them to produce a gradient that drains away from higher terrain and toward lower terrain, ensuring that flow traverses flats in a physically plausible way without crossing drainage divides. The elevation adjustments are on the order of the floating-point epsilon, so they do not meaningfully alter the DEM's topographic properties.

NOTES

r.richdem.resolveflats is typically applied after r.richdem.filldepressions or r.richdem.breachdepressions to handle any flat areas created by the conditioning step.

An alternative approach is to use the -e flag in r.richdem.filldepressions directly, which combines filling and epsilon-gradient imposition in one step.

This module is not needed before running r.richdem.dephier, which handles flat areas internally.

REQUIREMENTS

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.

EXAMPLES

Resolve flat areas after depression filling:
r.richdem.filldepressions input=dem output=dem_filled
r.richdem.resolveflats input=dem_filled output=dem_conditioned
Resolve flats on a raw DEM before computing flow accumulation:
r.richdem.resolveflats input=dem output=dem_noflats
r.richdem.flowaccumulation input=dem_noflats output=flow_accum

REFERENCES

SEE ALSO

r.richdem.filldepressions, r.richdem.breachdepressions, r.richdem.flowaccumulation, r.fill.dir, r.watershed

AUTHORS

Richard Barnes (RichDEM library)

GRASS GIS bindings: Andrew D. Wickert, with assistance from Claude Sonnet 4.6

SOURCE CODE

Available at: r.richdem.resolveflats 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