swn.SurfaceWaterNetwork.segments#

property SurfaceWaterNetwork.segments#

GeoDataFrame of stream segments derived from the lines input.

This GeoDataFrame is created by from_lines().

Examples

>>> import geopandas
>>> import swn
>>> lines = geopandas.GeoSeries.from_wkt([
...    "LINESTRING (60 100, 60  80)",
...    "LINESTRING (40 130, 60 100)",
...    "LINESTRING (70 130, 60 100)"])
>>> lines.index += 100
>>> n = swn.SurfaceWaterNetwork.from_lines(lines)
>>> n.segments.columns
Index(['geometry', 'to_segnum', 'from_segnums', 'cat_group', 'num_to_outlet',
       'dist_to_outlet', 'sequence', 'stream_order', 'upstream_length'],
      dtype='object')
>>> n.segments[["to_segnum", "from_segnums", "cat_group", "num_to_outlet",
...             "sequence", "stream_order"]]
     to_segnum from_segnums  cat_group  num_to_outlet  sequence  stream_order
100          0   {101, 102}        100              1         3             2
101        100           {}        100              2         1             1
102        100           {}        100              2         2             1
Attributes:
indexany

Unique index for each segment, with an optional name attribute. Copied from lines.index. This is often defined externally, and is used to relate and exchange stream information.

geometrygeometry

LineString or LineStringZ geometries, copied from lines.

to_segnumsame type as index

Index to which segment connects downstream to. If this is an outlet, the value is END_SEGNUM.

from_segnumsset

A set of zero or more indexes from which a segment connects upstream from. This will be an empty set (pandas displays this as {} rather than set()), then it is a headwater segment.

cat_groupsame type as index

Catchment group for each outlet.

num_to_outletint

Number of segments to the outlet.

dist_to_outletfloat

Distance to outlet.

sequenceint

Unique downstream sequence.

stream_orderint

Strahler number.

upstream_lengthfloat

Total lengths of streams upstream. See evaluate_upstream_length() for details.

upstream_areafloat

If catchments are defined, this is the upstream catchment area. See evaluate_upstream_area() for details.

widthfloat

If upstream_area is defined, this is an estimate of stream width. See estimate_width() for details.

diversionsset

If diversions are defined, this is a set of zero or more indexes to which the segment connects to.