Skip to contents

Calculates slope gradient (i.e., slope steepness in degrees, radians, or percent) for each grid cell in an input digital elevation model (DEM).

Usage

wbw_slope(dem, units = "degrees", z_factor = 1)

Arguments

dem

Raster object of class WhiteboxRaster. See wbw_read_raster() for more details.

units

character, units of slope: "radians", "degrees", or "percent"

z_factor

double, Z conversion factor is only important when the vertical and horizontal units are not the same in the DEM. When this is the case, the algorithm will multiply each elevation in the DEM by the Z conversion factor

Value

WhiteboxRaster object containing slope values

Details

The tool uses Horn's (1981) 3rd-order finite difference method to estimate slope. Given the following clock-type grid cell numbering scheme (Gallant and Wilson, 2000).

References

Gallant, J. C., and J. P. Wilson, 2000, Primary topographic attributes, in Terrain Analysis: Principles and Applications, edited by J. P. Wilson and J. C. Gallant pp. 51-86, John Wiley, Hoboken, N.J.

For more information, see https://www.whiteboxgeo.com/manual/wbw-user-manual/book/tool_help.html#slope

Examples

f <- system.file("extdata/dem.tif", package = "wbw")
wbw_read_raster(f) |>
  wbw_slope(units = "radians")
#> +-----------------------------------------------+ 
#> | WhiteboxRaster                                |
#> | Slope (radians)                               |
#> |...............................................| 
#> | bands       : 1                               |
#> | dimensions  : 726, 800  (nrow, ncol)          |
#> | resolution  : 5.002392, 5.000243  (x, y)      |
#> | EPSG        : 2193  (Linear_Meter)            |
#> | extent      : 1925449 1929446 5582091 5585717 |
#> | min value   : 0.000000                        |
#> | max value   : 1.224033                        |
#> +-----------------------------------------------+