pyflwdir.FlwdirRaster.streams#

FlwdirRaster.streams(mask=None, min_sto=1, xs=None, ys=None, idxs_out=None, max_len=0, direction='up', **kwargs)[source]#

Returns a list of stream segment as linestring geo-features.

A stream segment is defined by flow path between two confluences or if idxs_out is given, two outlet cells by idxs_out. The stream cells can be set using a boolean mask or a minimum stream order min_sto. Note that if a mask is given the minimum stream order is ignored.

Additional key-word arguments are maps from which a value is sampled at the most downstram cell of a stream segment.

Parameters:
  • kind ({streams, flwdir}) – Kind of LineString features: either streams of local flow directions.

  • mask (2D array of bool) – Mask of valid cells.

  • min_sto (int) – Minimum Strahler Order recognized as river, by the default 1. A stream order map can optionally be passed using the key-word argument strord.

  • xs (2D array of float) – Raster with cell x, y coordinates, by default None and inferred from cell center.

  • ys (2D array of float) – Raster with cell x, y coordinates, by default None and inferred from cell center.

  • idxs_out (1D array of int) – Linear indices of segment end cells. Stream segments are based on the path between two segment end cells in up- or downstream flow direction, see direction argument. By default None in which case segements are based on confluences.

  • direction ({"up", "down"}) – Flow direction to define path between segment end points. Only used in combination with idxs_out.

  • max_len (int, optional) – Maximum length of a single stream segment measured in cells. Longer streams segments are divided into smaller segments of equal length as close as possible to max_len.

  • kwargs (extra sample maps key-word arguments) – optional maps to sample from

Returns:

feats – Geofeatures, to be parsed by e.g. geopandas.GeoDataFrame.from_features

Return type:

list of dict