r.dem.dod
Computes a DEM of Difference (DoD)
r.dem.dod dem=name reference=name output=name [interp=string] [range=float] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
r.dem.dod dem=name reference=name output=name
grass.tools.Tools.r_dem_dod(dem, reference, output, interp="bilinear", range=None, overwrite=None, verbose=None, quiet=None, superquiet=None)
Example:
tools = Tools()
tools.r_dem_dod(dem="name", reference="name", output="name")
This grass.tools API is experimental in version 8.5 and expected to be stable in version 8.6.
grass.script.run_command("r.dem.dod", dem, reference, output, interp="bilinear", range=None, overwrite=None, verbose=None, quiet=None, superquiet=None)
Example:
gs.run_command("r.dem.dod", dem="name", reference="name", output="name")
Parameters
dem=name [required]
Later DEM
reference=name [required]
Earlier reference DEM
output=name [required]
DEM of Difference
interp=string
Interpolation for inputs not aligned with the computational region
Allowed values: bilinear, bicubic
Default: bilinear
range=float
Absolute difference at which the color palette saturates
Default is the 98th percentile of |DoD|, rounded up to one significant digit
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
dem : str | np.ndarray, required
Later DEM
Used as: input, raster, name
reference : str | np.ndarray, required
Earlier reference DEM
Used as: input, raster, name
output : str | type(np.ndarray) | type(np.array) | type(gs.array.array), required
DEM of Difference
Used as: output, raster, name
interp : str, optional
Interpolation for inputs not aligned with the computational region
Allowed values: bilinear, bicubic
Default: bilinear
range : float, optional
Absolute difference at which the color palette saturates
Default is the 98th percentile of |DoD|, rounded up to one significant digit
overwrite : bool, optional
Allow output files to overwrite existing files
Default: None
verbose : bool, optional
Verbose module output
Default: None
quiet : bool, optional
Quiet module output
Default: None
superquiet : bool, optional
Very quiet module output
Default: None
Returns:
result : grass.tools.support.ToolResult | np.ndarray | tuple[np.ndarray] | None
If the tool produces text as standard output, a ToolResult object will be returned. Otherwise, None will be returned. If an array type (e.g., np.ndarray) is used for one of the raster outputs, the result will be an array and will have the shape corresponding to the computational region. If an array type is used for more than one raster output, the result will be a tuple of arrays.
Raises:
grass.tools.ToolError: When the tool ended with an error.
dem : str, required
Later DEM
Used as: input, raster, name
reference : str, required
Earlier reference DEM
Used as: input, raster, name
output : str, required
DEM of Difference
Used as: output, raster, name
interp : str, optional
Interpolation for inputs not aligned with the computational region
Allowed values: bilinear, bicubic
Default: bilinear
range : float, optional
Absolute difference at which the color palette saturates
Default is the 98th percentile of |DoD|, rounded up to one significant digit
overwrite : bool, optional
Allow output files to overwrite existing files
Default: None
verbose : bool, optional
Verbose module output
Default: None
quiet : bool, optional
Quiet module output
Default: None
superquiet : bool, optional
Very quiet module output
Default: None
DESCRIPTION
r.dem.dod computes a DEM of Difference (DoD), output = dem - reference,
on the current computational region. Negative values are surface lowering
(erosion) and positive values are surface raising (deposition). The output is
the DoD that r.dem.bias, r.dem.lod, r.dem.change, r.dem.errprop, and
r.dem.screen take through their dod option.
Inputs that are not aligned with the computational region, either because
their resolution differs or because their cell edges are offset from the
region grid, are resampled onto the region with r.resamp.interp before
differencing. The interp option selects bilinear (default) or
bicubic interpolation. A warning reports the resolution and origin offset
of every resampled input. Inputs already on the region grid, such as the
output of r.dem.nk, are differenced directly.
The output carries the r.dem DoD color palette: erosion runs yellow to orange
to red to magenta as it deepens, near-zero differences are pale green, and
deposition runs cyan to teal to blue to navy. The palette breaks sit at 0.1,
0.3, 0.6, and 1.0 times a saturation value R on either side of zero. range
sets R. Without it, R is the 98th percentile of |DoD| rounded up to one
significant digit. Differences beyond R keep the end colors.
The output metadata records the command, both source maps, the interpolation method, and R. Units are copied from dem. When both inputs have timestamps, the output receives the interval from the start of the reference timestamp to the end of the dem timestamp, so it can be registered in a space-time raster dataset with t.register.
NOTES
Differencing respects the computational region and the raster mask. Cells that are null in either input are null in the output.
When an input is finer than the computational region, interpolation samples
it without aggregating the cells in between. Aggregate it first with a method
like r.resamp.stats method=average if that matters for the analysis.
To compare multiple DoDs, for example before and after co-registration, pass the same range so the maps share one color scale.
EXAMPLES
Difference a co-registered post-event DEM against the reference lidar DEM:
g.region raster=elev_lid792_1m
r.dem.dod dem=dsm_post_nk reference=elev_lid792_1m output=dod
Two DoDs on a shared color scale, before and after co-registration:
r.dem.dod dem=dsm_post reference=elev_lid792_1m output=dod_raw range=1
r.dem.dod dem=dsm_post_nk reference=elev_lid792_1m output=dod_nk range=1
SEE ALSO
r.dem, r.dem.bias, r.dem.change, r.dem.lod, r.dem.nk, r.resamp.interp, r.resamp.stats, t.register
AUTHORS
Corey T. White, Center for Geospatial Analytics, NC State University
SOURCE CODE
Available at: r.dem.dod source code
(history)
Latest change: Wednesday Oct 28 15:04:20 2026 in commit 5aa5bee