swn.SurfaceWaterNetwork#
- class swn.SurfaceWaterNetwork(segments, END_SEGNUM=0, logger=None)#
Surface water network class.
- Attributes:
- END_SEGNUMint
Special segment number that indicates a line end, default is usually 0. This number is not part of segments.index.
- loggerlogging.Logger
Logger to show messages.
- warningslist
List of warning messages.
- errorslist
List of error messages.
Methods
accumulate_values
(values)Accumulate values down the stream network.
adjust_elevation_profile
([min_slope])Check and adjust (if necessary) Z coordinates of elevation profiles.
aggregate
(segnums[, follow_up])Aggregate segments (and catchments) to a coarser network of segnums.
coarsen
(level)Coarsen stream network to a minimum stream order level.
estimate_width
([a, b, upstream_area])Estimate stream width based on upstream area and fitting parameters.
Evaluate upstream area from catchments, adds to segments.
Evaluate upstream length of segments, adds to segments.
from_lines
(lines[, polygons])Create and evaluate a new SurfaceWaterNetwork from lines for segments.
from_pickle
(path)Read a pickled format from a file.
gather_segnums
(*[, upstream, downstream, ...])Return segnums upstream (inclusive) and downstream (exclusive).
locate_geoms
(geom, *[, override, ...])Return GeoDataFrame of data associated in finding geometies.
pair_segments_frame
(value[, value_out, ...])Generate a DataFrame of paired values for top/bottom of segments.
plot
([column, sort_column, cmap, legend, ax])Plot map of surface water network.
query
([upstream, downstream, barrier, ...])Return segnums upstream (inclusive) and downstream (exclusive).
remove
([condition, segnums])Remove segments (and catchments) in-place, preserving attributes.
route_segnums
(start, end, *[, allow_indirect])Return a list of segnums that connect a pair of segnums.
segments_series
(value[, name])Generate a Series along the segments index.
set_diversions
(diversions, *[, override, ...])Set surface water diversion locations.
to_pickle
(path[, protocol])Pickle (serialize) object to file.
- __init__(segments, END_SEGNUM=0, logger=None)#
Initialise SurfaceWaterNetwork.
- Parameters:
- segmentsgeopandas.GeoDataFrame
Primary GeoDataFrame for stream segments. Index is treated as a segment number or ID.
- END_SEGNUMint
Special segment number that indicates a line end, default is 0. This number is not part of segments.index.
- loggerlogging.Logger, optional
Logger to show messages.
Methods
__init__
(segments[, END_SEGNUM, logger])Initialise SurfaceWaterNetwork.
accumulate_values
(values)Accumulate values down the stream network.
adjust_elevation_profile
([min_slope])Check and adjust (if necessary) Z coordinates of elevation profiles.
aggregate
(segnums[, follow_up])Aggregate segments (and catchments) to a coarser network of segnums.
coarsen
(level)Coarsen stream network to a minimum stream order level.
estimate_width
([a, b, upstream_area])Estimate stream width based on upstream area and fitting parameters.
Evaluate upstream area from catchments, adds to segments.
Evaluate upstream length of segments, adds to segments.
from_lines
(lines[, polygons])Create and evaluate a new SurfaceWaterNetwork from lines for segments.
from_pickle
(path)Read a pickled format from a file.
gather_segnums
(*[, upstream, downstream, ...])Return segnums upstream (inclusive) and downstream (exclusive).
locate_geoms
(geom, *[, override, ...])Return GeoDataFrame of data associated in finding geometies.
pair_segments_frame
(value[, value_out, ...])Generate a DataFrame of paired values for top/bottom of segments.
plot
([column, sort_column, cmap, legend, ax])Plot map of surface water network.
query
([upstream, downstream, barrier, ...])Return segnums upstream (inclusive) and downstream (exclusive).
remove
([condition, segnums])Remove segments (and catchments) in-place, preserving attributes.
route_segnums
(start, end, *[, allow_indirect])Return a list of segnums that connect a pair of segnums.
segments_series
(value[, name])Generate a Series along the segments index.
set_diversions
(diversions, *[, override, ...])Set surface water diversion locations.
to_pickle
(path[, protocol])Pickle (serialize) object to file.
Attributes
Polygon GeoSeries of surface water catchments.
[Geo]DataFrame of surface water diversions.
Return partial Series of a set of segnums to connect upstream.
Return True if all segment lines have Z dimension.
Return index of headwater segments.
Return index of outlets.
GeoDataFrame of stream segments derived from the lines input.
Return Series of segnum to connect downstream.