Model definitions
These views expose the definitions behind the model, including aquifers, snowmelt parameters, curves, and patterns. This is where you look when a node or subcatchment refers to something configured elsewhere.
Edit aquifer and snowmelt configuration while the owner is OPEN or ENDED.
Assignments check types and finite numbers immediately, then retain the complete
requested values in project units.
The related checks happen together at start(): aquifer ordering and positivity,
snowmelt coefficient ordering and removal-sum limits, pattern and subcatchment
relationships, and native normalization. If preparation fails, both your
requested values and the previous prepared native state remain intact. Repair
the declaration and retry without starting the whole project over.
from swmmrs import ConfigurationError, Simulation
with Simulation("model.inp", "model.rpt") as simulation:
aquifer = simulation.aquifers["UPPER"]
aquifer.update(
porosity=0.45,
field_capacity=0.30,
wilting_point=0.12,
upper_evaporation_pattern=simulation.time_patterns["MONTHLY-EVAP"],
)
snowmelt = simulation.snowmelt_sets["SNOW-1"]
snowmelt.update(plowable_fraction=0.25, plow_depth=0.5)
snowmelt.impervious.update(
minimum_melt_coefficient=0.05,
maximum_melt_coefficient=0.01, # Retained for validation at start().
)
try:
simulation.start()
except ConfigurationError as error:
for diagnostic in error.diagnostics:
print(diagnostic.property_path, diagnostic.message)
snowmelt.impervious.maximum_melt_coefficient = 0.20
simulation.start()
Curves, time series, patterns, land uses, pollutants, controls, transects, custom shapes, streets, inlet designs, and other generated model definitions are generation-bound read-only views unless this page explicitly documents an edit operation. A time pattern may be selected by an aquifer, but this interface does not edit the pattern itself.
from swmmrs import Simulation
with Simulation("model.inp", "model.rpt") as simulation:
print(tuple(simulation.curves))
curve = simulation.curves["PUMP-CURVE"]
first_pattern = simulation.time_patterns.by_index(0)
aquifer = simulation.aquifers["UPPER"]
pattern = aquifer.upper_evaporation_pattern
print(curve.id, first_pattern.id)
if pattern is not None:
print("selected evaporation pattern:", pattern.id)
See Inspect model definitions for collection names, lookup behavior, relationship traversal, and the editable versus read-only matrix.
Typed, generation-bound views over configured SWMM project objects.
All view instances retain the simulation and project generation that created them. They validate that identity before accessing native state, so retained views cannot silently address a subsequently reopened project.
| CLASS | DESCRIPTION |
|---|---|
Aquifer |
Expose a generation-bound editable aquifer definition. |
ControlRule |
Expose a generation-bound control-rule definition. |
Curve |
Expose a generation-bound curve definition. |
CustomShape |
Expose a generation-bound custom-shape definition. |
LandUse |
Expose a generation-bound land-use definition. |
Pollutant |
Expose a generation-bound pollutant definition. |
SnowmeltParameterSet |
Expose a generation-bound editable snowmelt parameter-set definition. |
SnowmeltSurface |
Expose one fixed snowmelt surface as a live project-unit view. |
Street |
Expose a generation-bound street definition. |
TimePattern |
Expose a generation-bound time-pattern definition. |
Transect |
Expose a generation-bound transect definition. |
InletDesign |
Expose a generation-bound inlet-design definition. |
Aquifer
flowchart TD
swmmrs.objects.Aquifer[Aquifer]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.Aquifer
click swmmrs.objects.Aquifer href "" "swmmrs.objects.Aquifer"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose a generation-bound editable aquifer definition.
| METHOD | DESCRIPTION |
|---|---|
update |
Atomically update supplied aquifer fields in project units. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
bottom_elevation |
Return aquifer bottom elevation in project length units.
TYPE:
|
conductivity_slope |
Return hydraulic conductivity slope.
TYPE:
|
field_capacity |
Return field-capacity moisture as a fraction.
TYPE:
|
hydraulic_conductivity |
Return saturated hydraulic conductivity in project rainfall units.
TYPE:
|
lower_evaporation_depth |
Return lower-zone evaporation depth in project length units.
TYPE:
|
lower_loss_coefficient |
Return lower-zone loss coefficient in project rainfall units.
TYPE:
|
porosity |
Return aquifer porosity as a fraction.
TYPE:
|
tension_slope |
Return soil moisture tension slope in project length units.
TYPE:
|
upper_evaporation_fraction |
Return the upper-zone evaporation fraction.
TYPE:
|
upper_evaporation_pattern |
Return the optional upper-zone evaporation pattern relationship.
TYPE:
|
upper_moisture |
Return initial upper-zone moisture as a fraction.
TYPE:
|
water_table_elevation |
Return initial water-table elevation in project length units.
TYPE:
|
wilting_point |
Return wilting-point moisture as a fraction.
TYPE:
|
bottom_elevation
property
writable
bottom_elevation: float
Return aquifer bottom elevation in project length units.
field_capacity
property
writable
field_capacity: float
Return field-capacity moisture as a fraction.
hydraulic_conductivity
property
writable
hydraulic_conductivity: float
Return saturated hydraulic conductivity in project rainfall units.
lower_evaporation_depth
property
writable
lower_evaporation_depth: float
Return lower-zone evaporation depth in project length units.
lower_loss_coefficient
property
writable
lower_loss_coefficient: float
Return lower-zone loss coefficient in project rainfall units.
tension_slope
property
writable
tension_slope: float
Return soil moisture tension slope in project length units.
upper_evaporation_fraction
property
writable
upper_evaporation_fraction: float
Return the upper-zone evaporation fraction.
upper_evaporation_pattern
property
writable
upper_evaporation_pattern: TimePattern | None
Return the optional upper-zone evaporation pattern relationship.
upper_moisture
property
writable
upper_moisture: float
Return initial upper-zone moisture as a fraction.
water_table_elevation
property
writable
water_table_elevation: float
Return initial water-table elevation in project length units.
update
update(**changes: object) -> None
Atomically update supplied aquifer fields in project units.
ControlRule
flowchart TD
swmmrs.objects.ControlRule[ControlRule]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.ControlRule
click swmmrs.objects.ControlRule href "" "swmmrs.objects.ControlRule"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose a generation-bound control-rule definition.
Curve
flowchart TD
swmmrs.objects.Curve[Curve]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.Curve
click swmmrs.objects.Curve href "" "swmmrs.objects.Curve"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose a generation-bound curve definition.
CustomShape
flowchart TD
swmmrs.objects.CustomShape[CustomShape]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.CustomShape
click swmmrs.objects.CustomShape href "" "swmmrs.objects.CustomShape"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose a generation-bound custom-shape definition.
LandUse
flowchart TD
swmmrs.objects.LandUse[LandUse]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.LandUse
click swmmrs.objects.LandUse href "" "swmmrs.objects.LandUse"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose a generation-bound land-use definition.
Pollutant
flowchart TD
swmmrs.objects.Pollutant[Pollutant]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.Pollutant
click swmmrs.objects.Pollutant href "" "swmmrs.objects.Pollutant"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose a generation-bound pollutant definition.
SnowmeltParameterSet
flowchart TD
swmmrs.objects.SnowmeltParameterSet[SnowmeltParameterSet]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.SnowmeltParameterSet
click swmmrs.objects.SnowmeltParameterSet href "" "swmmrs.objects.SnowmeltParameterSet"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose a generation-bound editable snowmelt parameter-set definition.
| METHOD | DESCRIPTION |
|---|---|
update |
Atomically update supplied root snowmelt fields in project units. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
impervious |
Return the fixed impervious-surface Live View.
TYPE:
|
pervious |
Return the fixed pervious-surface Live View.
TYPE:
|
plow_depth |
Return the snow depth at which plowing begins in project units.
TYPE:
|
plowable |
Return the fixed plowable-surface Live View.
TYPE:
|
plowable_fraction |
Return the fraction of impervious area that is plowable.
TYPE:
|
removal_fractions |
Return fractions routed to five plowed-snow destinations. |
removal_subcatchment |
Return the optional subcatchment receiving removed snow.
TYPE:
|
plow_depth
property
writable
plow_depth: float
Return the snow depth at which plowing begins in project units.
plowable_fraction
property
writable
plowable_fraction: float
Return the fraction of impervious area that is plowable.
removal_fractions
property
writable
Return fractions routed to five plowed-snow destinations.
removal_subcatchment
property
writable
removal_subcatchment: Subcatchment | None
Return the optional subcatchment receiving removed snow.
update
update(**changes: object) -> None
Atomically update supplied root snowmelt fields in project units.
SnowmeltSurface
Expose one fixed snowmelt surface as a live project-unit view.
| METHOD | DESCRIPTION |
|---|---|
update |
Atomically update supplied surface fields in project units. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
base_temperature |
Return the base temperature in project temperature units.
TYPE:
|
free_water_fraction |
Return the snowpack free-water fraction.
TYPE:
|
initial_free_water |
Return the initial free-water depth in project rain-depth units.
TYPE:
|
initial_snow_depth |
Return the initial snow depth in project rain-depth units.
TYPE:
|
maximum_melt_coefficient |
Return the maximum melt coefficient in project snowmelt units.
TYPE:
|
minimum_melt_coefficient |
Return the minimum melt coefficient in project snowmelt units.
TYPE:
|
snow_depth_for_full_coverage |
Return the snow depth for complete areal coverage.
TYPE:
|
base_temperature
property
writable
base_temperature: float
Return the base temperature in project temperature units.
free_water_fraction
property
writable
free_water_fraction: float
Return the snowpack free-water fraction.
initial_free_water
property
writable
initial_free_water: float
Return the initial free-water depth in project rain-depth units.
initial_snow_depth
property
writable
initial_snow_depth: float
Return the initial snow depth in project rain-depth units.
maximum_melt_coefficient
property
writable
maximum_melt_coefficient: float
Return the maximum melt coefficient in project snowmelt units.
minimum_melt_coefficient
property
writable
minimum_melt_coefficient: float
Return the minimum melt coefficient in project snowmelt units.
snow_depth_for_full_coverage
property
writable
snow_depth_for_full_coverage: float
Return the snow depth for complete areal coverage.
update
update(**changes: object) -> None
Atomically update supplied surface fields in project units.
Street
flowchart TD
swmmrs.objects.Street[Street]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.Street
click swmmrs.objects.Street href "" "swmmrs.objects.Street"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose a generation-bound street definition.
TimePattern
flowchart TD
swmmrs.objects.TimePattern[TimePattern]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.TimePattern
click swmmrs.objects.TimePattern href "" "swmmrs.objects.TimePattern"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose a generation-bound time-pattern definition.
Transect
flowchart TD
swmmrs.objects.Transect[Transect]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.Transect
click swmmrs.objects.Transect href "" "swmmrs.objects.Transect"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose a generation-bound transect definition.
InletDesign
flowchart TD
swmmrs.objects.InletDesign[InletDesign]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.InletDesign
click swmmrs.objects.InletDesign href "" "swmmrs.objects.InletDesign"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose a generation-bound inlet-design definition.