Subcatchments#

class Subcatchments(model)[source]#

Subcatchment Iterator Methods.

Parameters:

model (object) – Open Model Instance

Examples:

>>> from pyswmm import Simulation, Subcatchments
>>>
>>> with Simulation('tests/data/model_weir_setting.inp') as sim:
...     for subcatchment in Subcatchments(sim):
...         print(subcatchment)
...         print(subcatchment.subcatchmentid)
<swmm5.Subcatchment object at 0x031B0350>
S1
<swmm5.Subcatchment object at 0x030693D0>
S2
<swmm5.Subcatchment object at 0x031B0350>
S3
<swmm5.Subcatchment object at 0x030693D0>
S4

Iterating over Subcatchments Object

>>> subcatchments = Subcatchments(sim)
>>> for subcatchment in subcatchments:
...     print(subcatchment.subcatchmentid)
S0
S1
S2
S3

Testing Existence

>>> subcatchments = Subcatchments(sim)
>>> "S1" in subcatchments
True

Initializing a subcatchment Object

>>> subcatchments = Subcatchments(sim)
>>> s1 = subcatchments['S1']
>>> print(s1.area)
12
>>>
>>> s1.area = 200
>>> print(s1.area)
200

Methods