Gradient

The gradient is the steepest slope of the terrain in each cell, in any direction, computed from the 3x3 window of elevations around the cell. Three formulas are available:

  • Finite Differences: from the four neighbours along the rows and the columns;

  • Horn: from all the eight neighbours, weighting more the closest ones;

  • Evans: from all the eight neighbours, with the same weight.

Horn and Evans smooth the noise of the elevation better than the finite differences. The gradient differs from the Slope, which is measured along the drainage direction.

Parameters

Calculates the gradient of the elevation, the steepest slope in each cell, in any direction, from the 3x3 window around the cell.

Toolbox folder: Geomorphology
Status: Certified
Keywords: Geomorphology, Slope, Gradient
Authors: Daniele Andreis, Antonello Andrea, Erica Ghesla, Cozzini Andrea, Franceschi Silvia, Pisoni Silvano, Rigon Riccardo
Class: org.hortonmachine.modules.Gradient

Inputs

Parameter

Type

Unit

Default

Description

inElev

raster file

m

The map of the elevation.

pMode

String

Finite Differences

The formula of the gradient: finite differences, from the four neighbours, or the methods of Horn and of Evans, from all the eight neighbours and less sensitive to the noise of the elevation. Allowed values: Finite Differences, Horn, Evans.

doDegrees

boolean

false

Write the gradient in degrees; if not set, as the tangent of the slope angle.

Outputs

Parameter

Type

Unit

Description

outSlope

output file

m/m or °

The map of the gradient.

References

  • Horn, B. K. P. (1981). Hill shading and the reflectance map. Proceedings of the IEEE, 69(1), 14-47.

  • Evans, I. S. (1980). An integrated system of terrain analysis and slope mapping. Zeitschrift für Geomorphologie, Supplementband 36, 274-295.

Example

The example runs on the sample elevation model of the manual, dtm_flanginec.tif in docs/manual/modules/maps/data, each module on the outputs of the previous ones:

import org.hortonmachine.modules.Gradient

// the folder with the elevation model: change it to yours
var folder = "/data/flanginec/"

var gradient = new Gradient()
gradient.inElev = folder + "dtm_flanginec.tif"
gradient.pMode = "Horn"
gradient.outSlope = folder + "gradient.tif"
gradient.process()
The gradient of the sample area, with the method of Horn, as the tangent of the slope angle.

The gradient of the sample area, with the method of Horn, as the tangent of the slope angle.