RichDEM Python Reference

richdem.BreachDepressions(dem, mode='Complete', fill=False, max_path_len=None, max_path_depth=None, in_place=False)

Attempts to breach depressions in a DEM using in-place modification.

Parameters:
  • dem (rdarray) – An elevation model
  • mode (str) – String. Breaching mode to use (see below).
  • fill (bool) – True/False. If depressions can’t be breached, should they be filled?
  • max_path_len (int) – Maximum path length in cells that can be dug while breaching a depression.
  • max_path_depth (float) – Maximum depth in z-units that can be dug along the breaching path.

Modes

Complete Breach everything. Ignore max_path_len, max_path_depth. There will be no depressions. There will be no mercy.
Selective Only breach those depressions that can be breached using the above criteria.
Constrained Dig as long a path as necessary, but don’t dig it deeper than max_path_depth.
Returns:DEM with depressions breached, filled, or left unaltered, per the above options.
richdem.FillDepressions(dem, epsilon=False, in_place=False)

Fills all depressions in a DEM using in-place modification.

Parameters:
  • dem (rdarray) – An elevation model
  • epsilon (float) – If True, an epsilon gradient is imposed to all flat regions. This ensures that there is always a local gradient.
Returns:

DEM without depressions.

richdem.FlowAccumulation(dem, method=None, exponent=None)

Calculates flow accumulation. A variety of methods are available.

Parameters:
  • dem (rdarray) – An elevation model
  • method (str) – Flow accumulation method to use. (See below.)
  • exponent (float) – Some methods require an exponent; refer to the relevant publications for details.
Method Note Reference
Tarboton Alias for Dinf. Taroboton (1997) doi: 10.1029/96WR03137
Dinf Alias for Tarboton. Taroboton (1997) doi: 10.1029/96WR03137
Quinn Holmgren with exponent=1. Quinn et al. (1991) doi: 10.1002/hyp.3360050106
Holmgren(E) Generalization of Quinn. Holmgren (1994) doi: 10.1002/hyp.3360080405
Freeman(E) TODO Freeman (1991) doi: 10.1016/0098-3004(91)90048-I
FairfieldLeymarie Alias for Rho8. Fairfield and Leymarie (1991) doi: 10.1029/90WR02658
Rho8 Alias for FairfieldLeymarie. Fairfield and Leymarie (1991) doi: 10.1029/90WR02658
OCallaghan Alias for D8. O’Callaghan and Mark (1984) doi: 10.1016/S0734-189X(84)80011-0
D8 Alias for OCallaghan. O’Callaghan and Mark (1984) doi: 10.1016/S0734-189X(84)80011-0

Methods marked (E) require the exponent argument.

Returns:Flow accumulation according to the desired method.
richdem.LoadGDAL(filename, no_data=None)

Read a GDAL file.

Opens any file GDAL can read, selects the first raster band, and loads it and its metadata into a RichDEM array of the appropriate data type.

If you need to do something more complicated, look at the source of this function.

Parameters:
  • filename (str) – Name of the raster file to open
  • no_data (float) – Optionally, set the no_data value to this.
Returns:

A RichDEM array

richdem.SaveGDAL(filename, rda)

Save a GDAL file.

Saves a RichDEM array to a data file in GeoTIFF format.

If you need to do something more complicated, look at the source of this function.

Parameters:
  • filename (str) – Name of the raster file to be created
  • rda (rdarray) – Data to save.
Returns:

No Return

richdem.TerrainAttribute(dem, attrib, zscale=1.0)

Calculates terrain attributes. A variety of methods are available.

Parameters:
  • dem (rdarray) – An elevation model
  • attrib (str) – Terrain attribute to calculate. (See below.)
  • zscale (float) – How much to scale the z-axis by prior to calculation
Method Reference
slope_riserun Horn (1981) doi: 10.1109/PROC.1981.11918
slope_percentage Horn (1981) doi: 10.1109/PROC.1981.11918
slope_degrees Horn (1981) doi: 10.1109/PROC.1981.11918
slope_radians Horn (1981) doi: 10.1109/PROC.1981.11918
aspect Horn (1981) doi: 10.1109/PROC.1981.11918
curvature Zevenbergen and Thorne (1987) doi: 10.1002/esp.3290120107
planform_curvature Zevenbergen and Thorne (1987) doi: 10.1002/esp.3290120107
profile_curvature Zevenbergen and Thorne (1987) doi: 10.1002/esp.3290120107
Returns:A raster of the indicated terrain attributes.