FlwdirRaster#
|
Flow-direction raster parsed into a common actionable format. |
Input/Output#
|
Parse a flow-direction raster into the actionable FlwDirRaster format. |
|
Derive local D8 flow directions from digital elevation data. |
|
Return 2D flow direction raster. |
Load serialized FlwdirRaster object from file |
|
Serialize the flow-direction graph to a file using pickle. |
Flow direction attributes#
The following attributes describe the flow direction and are at the core to the object.
Linear indices of downstream cell. |
|
Linear indices of main upstream cell, i.e. the upstream cell with the largest contributing area. |
|
Linear indices of valid cells ordered from down- to upstream. |
|
Linear indices of pits/outlets. |
|
Number of valid cells in the flow-direction raster. |
|
Number of valid cells. |
|
Cell Rank, i.e. distance to the outlet in no. |
|
True if the flow direction map is valid. |
|
Boolean array of valid cells in flow direction raster. |
|
Cell area [m2]. |
|
Distance to outlet [m] |
|
Number of immediate upstream connections for each node. |
Flow direction methods#
|
Order cells from down- to upstream. |
|
Return the main upstream node for each node. |
|
Add pits to the flow-direction raster. |
Repair loops by setting a pit at every cell which does not drain to a pit. |
|
|
Return each selected flow path as a LineString feature. |
Raster & geospatial attributes and methods#
The FlwdirRaster object contains FlwdirRaster.shape, FlwdirRaster.transform
and FlwdirRaster.latlon attributes describing its geospatial location. The first
attribute is required at initializiation, while the others can be set later.
|
Set the affine transform and coordinate-system type. |
|
Returns linear cell indices based on x, y coordinates. |
|
Returns x, y coordinates of the cell center based on linear cell indices. |
Returns the raster bounding box [xmin, ymin, xmax, ymax]. |
|
Returns the raster extent in cartopy format [xmin, xmax, ymin, ymax]. |
Streams and flow paths#
|
Return the Strahler (default) or classic stream-order map. |
|
Trace paths downstream or upstream from starting cells. |
|
Snap starting cells to a downstream or upstream target. |
|
Return linear indices of the most downstream cells within a region. |
|
Return linear indices of the most upstream cells within a region. |
|
Return the distance to the outlet or the next downstream True cell in mask. |
|
Return stream segments as LineString geographic features. |
|
Return geographic features for flow paths represented by linear indices. |
(Sub)basins#
|
Return a basin map with a unique ID for each basin. |
|
Return a subbasin map with unique IDs starting from 1. |
|
Return subbasins defined by stream-order changes and their outlet indices. |
|
Return subbasins using the Pfafstetter coding system. |
|
Return subbasins with a minimum contributing area of area_min. |
|
Return basin IDs and the linear index of each outlet cell. |
|
Return the bounding boxes of basins. |
|
Return a mask for the most downstream contiguous area within a region. |
Up- and downstream values#
|
Return the next downstream node's value for each node. |
|
Return the sum of values at each node's immediate upstream neighbors. |
Up- and downstream arithmetics#
|
Return accumulated data values along the flow directions. |
|
Return the upstream-area raster for the flow directions. |
|
Take the moving weighted average over the flow direction network |
|
Take the moving median over the flow direction network |
|
Return smoothed river length, by taking the window average of river length. |
|
Fill no-data nodes with values from valid upstream or downstream neighbors. |
Upscale and subgrid methods#
|
Upscale a flow-direction network to a lower resolution. |
|
Return an error map for the upscaled flow directions. |
|
Returns the subgrid river length [m] based on unit catchment outlet locations. |
|
Return the subgrid river slope [m/m] estimated at unit-catchment outlets. |
|
Return the average value over the subgrid river at unit-catchment outlets. |
|
Return the median value over the subgrid river at unit-catchment outlets. |
|
Return the high-resolution unit-catchment map and low-resolution cell areas. |
|
Return the high-resolution unit-catchment map and flood volumes by depth. |
|
Return linear indices of unit-catchment outlet pixels. |
Elevation#
|
Returns the hydrologically adjusted elevation where each downstream cell has the same or lower elevation as the current cell. |
|
Return elevation adjusted to satisfy D4 connectivity along river cells. |
|
Return the height above the nearest drain (HAND). |
|
Identify floodplain cells using an upstream-area-scaled HAND threshold. |