xdem.DEM.get_terrain_attribute#
- DEM.get_terrain_attribute(attribute, **kwargs)[source]#
Derive one or multiple terrain attributes from a DEM. The attributes are based on:
Slope, aspect, hillshade (first method) from Horn (1981), http://dx.doi.org/10.1109/PROC.1981.11918,
- Slope, aspect, hillshade (second method), and terrain curvatures from Zevenbergen and Thorne (1987),
http://dx.doi.org/10.1002/esp.3290120107, with curvature expanded in Moore et al. (1991),
- Curvatures (profile, tangential, planform, flowline, max, min) following the methods outlined
in Minár et al. (2020), https://doi.org/10.1016/j.earscirev.2020.103414,
Topographic Position Index from Weiss (2001), http://www.jennessent.com/downloads/TPI-poster-TNC_18x22.pdf.
- Terrain Ruggedness Index (topography) from Riley et al. (1999),
http://download.osgeo.org/qgis/doc/reference-docs/Terrain_Ruggedness_Index.pdf.
Terrain Ruggedness Index (bathymetry) from Wilson et al. (2007), http://dx.doi.org/10.1080/01490410701295962.
Roughness from Dartnell (2000), thesis referenced in Wilson et al. (2007) above.
Rugosity from Jenness (2004), https://doi.org/10.2193/0091-7648(2004)032[0829:CLSAFD]2.0.CO;2.
Fractal roughness from Taud et Parrot (2005), https://doi.org/10.4000/geomorphologie.622.
Aspect and hillshade are derived using the slope, and thus depend on the same method. More details on the equations in the functions get_quadric_coefficients() and get_windowed_indexes().
This function can be run out-of-memory in multiprocessing by passing a Multiproc config argument.
Attributes:
‘slope’: The slope in degrees or radians (degs: 0=flat, 90=vertical). Default method: “Horn”.
‘aspect’: The slope aspect in degrees or radians (degs: 0=N, 90=E, 180=S, 270=W).
‘hillshade’: The shaded slope in relation to its aspect.
‘curvature’: The second derivative of elevation (the rate of slope change per pixel), multiplied by 100.
- ‘profile_curvature’: The curvature of a normal section having a common tangent line with a steepest slope,
multiplied by 100.
‘tangential_curvature’: The curvature perpendicular to the profile curvature, multiplied by 100.
‘planform_curvature’: The curvature of a projected contour line, multiplied by 100.
‘flowline_curvature’: The curvature of a projected slope line, multiplied by 100.
- ‘max_curvature’: The maximal (geometric) or maximum (directional derivative) curvature at a point in any
direction, multiplied by 100.
- ‘min_curvature’: The minimal (geometric) or minimum (directional derivative) curvature at a point in any
direction, multiplied by 100.
‘surface_fit’: A quadric surface fit for each individual pixel.
- ‘topographic_position_index’: The topographic position index defined by a difference to the average of
neighbouring pixels.
- ‘terrain_ruggedness_index’: The terrain ruggedness index. For topography, defined by the squareroot of squared
differences to neighbouring pixels. For bathymetry, defined by the mean absolute difference to neighbouring pixels. Default method: “Riley” (topography).
‘roughness’: The roughness, i.e. maximum difference between neighbouring pixels.
‘rugosity’: The rugosity, i.e. difference between real and planimetric surface area.
‘fractal_roughness’: The roughness based on a volume box-counting estimate of the fractal dimension.
- ‘texture_shading’: Texture shaded relief using fractional Laplacian operator to enhance terrain texture and
fine-scale topographic features.
- Parameters:
attribute (
str|list[str]) – Terrain attribute(s) to calculate.degrees – Whether to convert radians to degrees.
hillshade_altitude – Shading altitude in degrees (0-90°). 90° is straight from above.
hillshade_azimuth – Shading azimuth in degrees (0-360°) going clockwise, starting from north.
hillshade_z_factor – Vertical exaggeration factor.
slope_method – Deprecated. Use surface_fit instead. Accepts “Horn” or “ZevenbergThorne”.
surface_fit – Surface fit method to use for slope, aspect, hillshade and curvatures: “Horn”, “ZevenbergThorne” or “Florinsky”.
curv_method – Method to calculate the curvatures: “geometric” or “directional”.
tri_method – Method to calculate the Terrain Ruggedness Index: “Riley” (topography) or “Wilson” (bathymetry).
window_size – Window size for windowed attributes (TPI, TRI, roughnesses, rugosity).
engine – Engine to use for computing the attributes, windowed and surface fit attributes all support “scipy” or “numba”.
out_dtype – Output dtype of the terrain attributes, can only be a floating type. Defaults to that of the input DEM if floating type or to float32 if integer type.
mp_config – Multiprocessing configuration, run the function in multiprocessing if not None.
- Raises:
ValueError – If the inputs are poorly formatted or are invalid.
- Return type:
TypeVar(RasterType, bound= Raster) |list[TypeVar(RasterType, bound= Raster)]