RichDEM Python Reference¶
-
richdem.
BreachDepressions
(dem, in_place=False, topology='D8')¶ Breaches all depressions in a DEM.
Parameters: - dem (rdarray) – An elevation model
- in_place (bool) – If True, the DEM is modified in place and there is no return; otherwise, a new, altered DEM is returned.
- topology (string) – A topology indicator
Returns: DEM without depressions.
-
richdem.
FillDepressions
(dem, epsilon=False, in_place=False, topology='D8')¶ Fills all depressions in a DEM.
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.
- in_place (bool) – If True, the DEM is modified in place and there is no return; otherwise, a new, altered DEM is returned.
- topology (string) – A topology indicator
Returns: DEM without depressions.
-
richdem.
FlowAccumFromProps
(props, weights=None, in_place=False)¶ Calculates flow accumulation from flow proportions.
Parameters: - props (rdarray) – An elevation model
- weights (rdarray) – Flow accumulation weights to use. This is the amount of flow generated by each cell. If this is not provided, each cell will generate 1 unit of flow.
- in_place (bool) – If True, then
weights
is modified in place. An accumulation matrix is always returned, but it will just be a view of the modified data ifin_place
is True.
Returns: A flow accumulation array. If
weights
was provided andin_place
was True, then this matrix is a view of the modified data.
-
richdem.
FlowAccumulation
(dem, method=None, exponent=None, weights=None, in_place=False)¶ 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.
- weights (rdarray) – Flow accumulation weights to use. This is the amount of flow generated by each cell. If this is not provided, each cell will generate 1 unit of flow.
- in_place (bool) – If True, then
weights
is modified in place. An accumulation matrix is always returned, but it will just be a view of the modified data ifin_place
is True.
Methods marked (E) require the exponent argument.
Returns: A flow accumulation according to the desired method. If weights
was provided andin_place
was True, then this matrix is a view of the modified data.
-
richdem.
FlowProportions
(dem, method=None, exponent=None)¶ Calculates flow proportions. 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.
Methods marked (E) require the exponent argument.
Returns: A flow proportion 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.
ResolveFlats
(dem, in_place=False)¶ Attempts to resolve flats by imposing a local gradient
Parameters: - dem (rdarray) – An elevation model
- in_place (bool) – If True, the DEM is modified in place and there is no return; otherwise, a new, altered DEM is returned.
Returns: DEM modified such that all flats drain.
-
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.
-
class
richdem.
rd3array
¶
-
class
richdem.
rdarray
¶