Skip to content

r.divergence

Computes divergence of a vector field defined by magnitude and direction

r.divergence magnitude=name direction=name output=name [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.divergence magnitude=name direction=name output=name

grass.script.run_command("r.divergence", magnitude, direction, output, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r.divergence", magnitude="name", direction="name", output="name")

Parameters

magnitude=name [required]
    Name of input raster map representing magnitude
direction=name [required]
    Name of input raster map representing direction
    Direction is in degrees ccw from the east
output=name [required]
    Name of output divergence raster
--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

magnitude : str, required
    Name of input raster map representing magnitude
    Used as: input, raster, name
direction : str, required
    Name of input raster map representing direction
    Direction is in degrees ccw from the east
    Used as: input, raster, name
output : str, required
    Name of output divergence raster
    Used as: output, raster, name
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

Module r.divergence computes the divergence of a vector field given by magnitude and direction raster maps. Direction is in degrees counterclockwise from the east and can be computed using r.slope.aspect. This module can be used for estimating erosion and deposition rates for a steady state overland flow using USPED (Unit Stream Power based Erosion Deposition) model. Net erosion/deposition is estimated as a change in sediment flow rate expressed by a divergence in sediment flow.

EXAMPLES

In North Carolina sample dataset, we compute net erosion/deposition.

g.region raster=elev_lid792_1m -p
r.slope.aspect elevation=elev_lid792_1m slope=slope aspect=aspect
r.flow elevation=elev_lid792_1m flowaccumulation=flowacc

# exponents m=1.3 and n=1.2
# multiply flowaccumulation by cell area/resolution to get contributing area per unit width
r.mapcalc "sflowtopo = pow(flowacc * 1.,1.3) * pow(sin(slope),1.2)"

# Compute sediment flow by combining the rainfall, soil and land cover factors
# with the topographic sediment transport factor.
# We use a constant value of 270. for rainfall intensity factor.
r.mapcalc "sedflow = 270. * soils_Kfactor * cfactorbare_1m * sflowtopo"
r.divergence magnitude=sedflow direction=aspect output=erosion_deposition

# set suitable color table
r.colors map=erosion_deposition rules=- << EOF
0% 100 0 100   #dark magenta
-100 magenta
-10 red
-1 orange
-0.1 yellow
0 200 255 200     #light green
0.1 cyan
1 aqua
10 blue
100 0 0 100       #dark blue
100% black
EOF

SEE ALSO

r.slope.aspect

AUTHORS

Anna Petrasova, NCSU GeoForAll Lab
Helena Mitasova, NCSU GeoForAll Lab

SOURCE CODE

Available at: r.divergence source code (history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819