sewergraph
v0.1.4
Building upon Networkx, this package provides tools for analysis and manipulation of sewer network data.
Goals
Provide graph functions to tackle analytical problems typical in sewer collections systems:
- traverse sewer networks up/downstream
- accumulation calculations
- downstream choke-point analysis
- data gap handling (within reason, folks)
- design capacity analysis
Installation
Inspired by osmnx, sewergraph depends on Networkx and Pandas. For most use cases, installation is easy:
$ pip install sewergraph
Additional functionality is provided that makes use of GeoPandas, scipy and Shapely. It's recommended to install GeoPandas with conda first, then install sewergraph via pip:
$ conda install geopandas
$ pip install sewergraph
If you have ArcMap installed, be sure that the GeoPandas installation doesn't conflict with arcpy. To avoid risks, install sewergraph in a conda environment:
$ conda create --name myenv
$ activate myenv #enter the new environment
$ conda install geopandas
$ pip install sewergraph
Examples
Create a Networkx DiGraph with a shapefile of a sewer network.
import sewergraph as sg
#read shapefile into DiGraph
shapefile_path = r'path/to/sewers.shp'
G = sg.graph_from_shp(shapefile_path)
Attributes of each sewer segment are stored as edge data. Geometry is parse and stored in the geometry attribute along with whatever other fields exist in the shapefile.
#sewer connecting node 0 to node 1
print(G[0][1])
{
'OBJECTID': 115081,
'STREET': 'ADAINVILLE DR',
'ShpName': 'sample_sewer_network_1',
'diameter': 8,
'facilityid': 'BCE7B25E',
'geometry': <shapely.geometry.linestring.LineString at 0x12a6caf0>,
'height': 0,
'length': 164.758,
'local_area': 39449.474,
'material': 'VCP',
'pipeshape': 'CIR',
'slope': 0.01,
'width': 0
}
Calculate the total drainage area at each sewer by accumulating local_area from the top to bottom of the network (i.e. sewershed).
#accumulate drainage area
G = sg.accumulate_downstream(G, 'local_area', 'total_area')
#convert to GeoDataFrame and sort the sewers by total_area
sewers = sg.gdf_from_graph(G)
sewers = sewers.sort_values(by = 'total_area', ascending=False)
sewers.head()
| total_area | OBJECTID | facilityid | pipeshape | diameter | height | width | length | slope | material | STREET | local_area | geometry | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 19 | 4,233,504 | 112545 | A58064DF | BOX | 0 | 12 | 16 | 327.279370 | 0.0075 | RCP | None | 119043.524941 | LINESTRING (6558821.45028765 2032961.24586616,... |
| 18 | 4,114,461 | 112546 | 5890D18F | BOX | 0 | 12 | 16 | 318.081402 | 0.0100 | RCP | None | 171961.403740 | LINESTRING (6558826.08945222 2032643.19829701,... |
| 24 | 3,942,499 | 112563 | 12FF7372 | BOX | 0 | 12 | 16 | 131.352534 | 0.0100 | RCP | None | 16557.605522 | LINESTRING (6558821.78250872 2032511.9163921, ... |
More functions are provided for calculating basic hydraulic capacity, outfall loading, flow splits, travel time, and identifying downstream constrictions from every point of the network.
#perform basic sewer capacity calculations (full flow Mannings capacity)
G = hhcalcs_on_network(G)
#id flow split sewers and calculate split fractions
G = analyze_flow_splits(G)
#accumulating travel times
G = accumulate_travel_time(G)
Running Tests
Test are located in the sewergraph > tests directory and are run with pytest.
Metadata
Release files for sewergraph 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sewergraph-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Release files / sewergraph-0.1.4-py3-none-any.whl
| Download URL | sewergraph-0.1.4-py3-none-any.whl |
|---|---|
| Size | 29.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4897a898919c54f7333748af10e15e4e883aa009b6b27d064e2d890de2588a72
|
|
BLAKE2b-256 checksum How to use checksums |
5053c5120c9c31e1b4da022cba7c4ff6fafef187c64d83f5b7304c07309a7a59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.13
|
Security for sewergraph 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.