Skip to content

r3.gradient

Computes gradient of a 3D raster map and outputs gradient components as three 3D raster maps.

r3.gradient input=name output=grad_x,grad_y,grad_z [,grad_x,grad_y,grad_z,...] [blocksize=size_x,size_y,size_z [,size_x,size_y,size_z,...]] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r3.gradient input=name output=grad_x,grad_y,grad_z

grass.script.run_command("r3.gradient", input, output, blocksize="30,30,20", overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r3.gradient", input="name", output="grad_x,grad_y,grad_z")

Parameters

input=name [required]
    Name of input 3D raster map
output=grad_x,grad_y,grad_z [,grad_x,grad_y,grad_z,...] [required]
    Name for output 3D raster map(s)
blocksize=size_x,size_y,size_z [,size_x,size_y,size_z,...]
    Size of blocks
    Default: 30,30,20
--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

input : str, required
    Name of input 3D raster map
    Used as: input, raster_3d, name
output : list[tuple[str, str, str]] | tuple[str, str, str] | list[str] | str, required
    Name for output 3D raster map(s)
    Used as: output, raster_3d, grad_x,grad_y,grad_z
blocksize : list[tuple[str, str, str]] | tuple[str, str, str] | list[str] | str, optional
    Size of blocks
    Used as: size_x,size_y,size_z
    Default: 30,30,20
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 r3.gradient computes gradient from a 3D raster map. Results are three 3D raster maps describing the x, y, z components of the computed gradient field.

EXAMPLES

# create a 3D raster
g.region s=0 n=100 w=0 e=100 b=0 t=100 -p
r3.mapcalc "test_gradient = sqrt(row()*row() +col()*col()+ depth()*depth())"

# compute gradient
r3.gradient input=test_gradient output=grad_x,grad_y,grad_z

SEE ALSO

r3.flow, r.flow

AUTHOR

Anna Petrasova, NCSU GeoForAll Lab, developed during GSoC 2014.

SOURCE CODE

Available at: r3.gradient source code (history)
Latest change: Thursday Feb 27 06:05:37 2025 in commit 49a2352