swmmio.elements#
Objects encapsulating model elements
- class swmmio.elements.Links(model, inp_sections, join_sections=None, rpt_sections=None, columns=None)[source]#
Bases:
ModelSection
Generalized links object for working with link-like SWMM objects.
- Parameters:
model – swmmio.Model object
inp_sections – list of link-related sections from the inp file to concatenate in the object
join_sections – list of link-related sections from the inp file to join to the object
rpt_sections – list of link-related sections from the rpt file to join to the object
columns – optional subset of columns used to exclude unwanted columns in the resulting object
>>> from swmmio.examples import spruce >>> conduits = Links( ... spruce, ... inp_sections=['conduits'], ... rpt_sections=['Link Flow Summary'], ... columns=['MaxQ', 'MaxQPerc', 'coords'] ... ) >>> conduits.dataframe MaxQ MaxQPerc coords Name C1:C2 2.45 1.32 [(0.0, 0.0), (238.75, -53.332)] C2.1 0.00 0.00 [(238.75, -53.332), (295.63599999999997, -159.... 1 2.54 1.10 [(-77.021, -78.321), (-67.28399999999999, -37.... 2 2.38 1.03 [(-67.28399999999999, -37.603), (-56.662, 15.5... 3 1.97 0.67 [(-56.662, 15.507), (0.0, 0.0)] 4 0.16 0.10 [(-18.6, -71.23899999999999), (-23.91099999999... 5 0.00 0.00 [(-84.988, 43.833), (-85.87299999999999, 19.93... >>> # access data as geojson >>> conduits.geojson['features'][0]['geometry'] {"coordinates": [[0.0, 0.0], [238.75, -53.332]], "type": "LineString"} >>> conduits.geojson['features'][0]['properties'] {'MaxQ': 2.45, 'MaxQPerc': 1.32, 'Name': 'C1:C2'}
- Attributes:
dataframe
Return a Pandas.Dataframe representation of the group
geodataframe
Return a GeoPandas.GeoDataFrame representation of the group
geojson
Return a GeoJSON representation of the group
Methods
__call__
()collect all useful and available data related to the conduits and organize in one dataframe.
- class swmmio.elements.ModelSection(model, inp_sections, join_sections=None, rpt_sections=None, columns=None, geomtype='point')[source]#
Bases:
object
Base class of a group of model elements.
- Parameters:
model – swmmio.Model object
inp_sections – list of node-related sections from the inp file to concatenate in the object
join_sections – list of node-related sections from the inp file to join to the object
rpt_sections – list of node-related sections from the rpt file to join to the object
columns – optional subset of columns used to exclude unwanted columns in the resulting object
geomtype – type of geometry for section [point, linestring, polygon]
- Attributes:
dataframe
Return a Pandas.Dataframe representation of the group
geodataframe
Return a GeoPandas.GeoDataFrame representation of the group
geojson
Return a GeoJSON representation of the group
Methods
__call__
()collect all useful and available data related to the conduits and organize in one dataframe.
- property dataframe#
Return a Pandas.Dataframe representation of the group
- Returns:
pd.Dataframe
- property geodataframe#
Return a GeoPandas.GeoDataFrame representation of the group
- Returns:
GeoPandas.GeoDataFrame
- property geojson#
Return a GeoJSON representation of the group
- Returns:
GeoJSON string
- class swmmio.elements.Nodes(model, inp_sections, join_sections=None, rpt_sections=None, columns=None)[source]#
Bases:
ModelSection
Generalized nodes object for working with node-like SWMM objects.
- Parameters:
model – swmmio.Model object
inp_sections – list of node-related sections from the inp file to concatenate in the object
join_sections – list of node-related sections from the inp file to join to the object
rpt_sections – list of node-related sections from the rpt file to join to the object
columns – optional subset of columns used to exclude unwanted columns in the resulting object
>>> from swmmio.examples import spruce >>> nodes = Nodes( ... spruce, ... inp_sections=['junctions'], ... rpt_sections=['Node Depth Summary'], ... columns=['InvertElev', 'MaxHGL', 'coords'] ... ) >>> nodes.dataframe InvertElev MaxHGL coords Name J3 6.547 8.19 [(459.05800000000005, -113.145)] 1 17.000 17.94 [(-77.021, -78.321)] 2 17.000 17.00 [(-84.988, 43.833)] 3 16.500 16.89 [(-18.6, -71.23899999999999)] 4 16.000 16.87 [(-67.28399999999999, -37.603)] 5 15.000 16.00 [(-56.662, 15.507)] J2 13.000 13.00 [(238.75, -53.332)] >>> # access data as geojson >>> nodes.geojson['features'][0]['geometry'] {"coordinates": [[459.058, -113.145]], "type": "Point"} >>> nodes.geojson['features'][0]['properties'] {'InvertElev': 6.547, 'MaxHGL': 8.19, 'Name': 'J3'}
- Attributes:
dataframe
Return a Pandas.Dataframe representation of the group
geodataframe
Return a GeoPandas.GeoDataFrame representation of the group
geojson
Return a GeoJSON representation of the group
Methods
__call__
()collect all useful and available data related to the conduits and organize in one dataframe.