GRASS logo

NAME

r.dem.bias - Remove terrain-correlated systematic bias from a DoD

KEYWORDS

raster, DEM, bias, change detection, regression

SYNOPSIS

r.dem.bias
r.dem.bias --help
r.dem.bias dod=name output=name method=string [predictors=name[,name,...]] [stable_mask=name] [mask=name] [bias_field=name] [output_se=name] [output_leverage=name] [fit_json=name] [spline_tension=float] [spline_smooth=float] [spline_npoints=integer] [spline_res=float] [log_predictors=string[,string,...]] [window=integer] [trim_low=float] [trim_high=float] [--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:

dod=name [required]
Input DEM of Difference raster to correct
output=name [required]
Output bias-corrected DoD raster
method=string [required]
Bias-correction method
Options: regression, forest, spline
predictors=name[,name,...]
Terrain predictor rasters (method=regression)
stable_mask=name
Stable-terrain mask defining the regression fit region (method=regression)
mask=name
Mask of cells used for the local bias field, e.g. forest (method=forest)
bias_field=name
Optional output of the estimated bias field that was subtracted
output_se=name
Output coefficient-uncertainty SE raster of the bias model, sqrt(x' Cov x) (method=regression, 1 sigma, excludes residual variance)
output_leverage=name
Output extrapolation-distance raster d = sqrt(n*h - 1) in fit-sd units (method=regression)
fit_json=name
JSON file persisting the fit (n, s2, coefficients, covariance, transforms; method=regression)
spline_tension=float
v.surf.rst tension for the spline bias field (method=spline)
Default: 40.0
spline_smooth=float
v.surf.rst smoothing for the spline bias field (method=spline; oversmoothing is the safe direction for a long-wavelength field)
Default: 5.0
spline_npoints=integer
Stable cells sampled as spline fit points (method=spline; deterministic seed)
Default: 50000
spline_res=float
Interpolation resolution (m) for the spline bias field, resampled bilinearly to the analysis grid (method=spline)
Default: 10.0
log_predictors=string[,string,...]
Predictors to log-transform before z-scoring (must be listed in predictors; explicit, never data-triggered)
window=integer
Window size in cells for the local bias field (method=forest)
Default: 21
trim_low=float
Lower trimming percentile for the local bias core (method=forest)
Default: 2.5
trim_high=float
Upper trimming percentile for the local bias core (method=forest)
Default: 97.5

Table of contents

DESCRIPTION

r.dem.bias removes terrain-correlated systematic bias that remains in a DEM of Difference (DoD) after rigid co-registration. Alignment tools such as r.dem.coregister, r.dem.nk, and r.dem.icp remove translation and rotation, but a residual elevation difference often still varies with terrain (for example a positive canopy bump in forest, or error that scales with slope, roughness, or point density). This tool models that residual and subtracts it.

Three methods are provided through the method option.

method=regression

Fits a multivariable linear model of the DoD on z-scored terrain predictors over stable terrain, then subtracts the fitted surface from the full DoD.

Predictor rasters are typically produced by r.dem.stats (slope, roughness, landform diversity, local sigma) together with a reference-DEM uncertainty surface.

method=spline

Interpolates the stable-cell residuals into a smooth spatial bias field with v.surf.rst and subtracts it; no terrain predictors, no collinearity pathologies. The field is fit from spline_npoints randomly sampled stable cells (deterministic seed) at the coarse spline_res resolution with spline_tension and spline_smooth, then resampled bilinearly to the analysis grid. Most trustworthy near stable cells; validate with a holdout before trusting extrapolation.

method=forest

Estimates a local trimmed-median bias field over a masked subset of cells (classically a forest canopy bump) and subtracts it.

However, a local trimmed median cannot separate a canopy bump from real elevation change, so any deposition or scour inside mask is removed along with the bias. Keep known and suspected change areas out of the mask, using the footprint from a coarse r.dem.screen pass where one is available.

NOTES

The optional bias_field output stores the estimated correction surface that was subtracted, which is useful for inspection and reporting.

For method=regression the corrected DoD is NULL wherever any predictor is NULL (the fitted surface is undefined there); output_se follows the same predictor-driven NULL pattern, and is defined even where the input DoD is NULL.

The mask used by method=forest is applied through a temporary mask context and is removed automatically; the user's existing mask and computational region are left untouched. Intermediate rasters are removed on exit.

EXAMPLES

The commands below use the example scene built in the r.dem toolset manual, which is derived from the North Carolina sample dataset. Build it there first.

The scene carries three bias components, and each method removes a different one. Chain them: no single method removes all three.

Start with the long-wavelength dome, fitted from the stable cells and interpolated across the map:

g.region raster=elev_lid792_1m

r.dem.bias dod=dod_raw output=dod_spline method=spline \
    stable_mask=stable_terrain bias_field=bias_spline

Then the canopy bump, estimated as a local trimmed median under the forest mask:

r.dem.bias dod=dod_spline output=dod_debiased method=forest \
    mask=forest window=21

The residual on stable terrain falls from 0.17 m to under 0.01 m, and the residual over forest falls from 1.68 m to under 0.01 m.

The regression path models the bias against terrain predictors instead, keeping the coefficient uncertainty for the uncertainty budget downstream:

r.dem.bias dod=dod_raw output=dod_regression method=regression \
    predictors=roughness stable_mask=stable_terrain \
    output_se=bias_se output_leverage=bias_leverage \
    fit_json=bias_fit.json
r.dem.bias example
Figure: Raw DoD carrying the survey bias, the fitted spline bias field, and the difference after the spline and forest stages.

SEE ALSO

r.dem, r.dem.coregister, r.dem.errprop, r.dem.stats, r.neighbors, v.surf.rst

AUTHORS

Corey T. White, Center for Geospatial Analytics, NC State University

SOURCE CODE

Available at: r.dem.bias source code (history)

Accessed: Sunday Sep 13 08:27:39 2026


Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2026 GRASS Development Team, GRASS 8.5.1dev Reference Manual