Subcatchments
Edit stable configuration through SubcatchmentSettings. After a successful
setter or update() call, the Live View returns your requested value
immediately. The solver rebuilds surface, relationship, infiltration,
groundwater, snowpack, loading, and coverage records only when
Simulation.start() succeeds.
Type, identity, finiteness, range, and unit errors fail at the setter. Conflicts
with other declarations wait until preparation. An outlet cycle, a LID area
conflict, or a ground surface below the declared water table makes
Simulation.start() raise ConfigurationError with ordered diagnostics.
Your accepted declarations remain readable. Correct them and retry without
reopening the project.
Tags and report inclusion are metadata and do not mark configuration dirty. Precipitation scaling and external inputs are forcing, separate from stable declarations.
SubcatchmentSettings.infiltration is None when the input has no infiltration
declaration. A present declaration returns a generation-bound live view.
from swmmrs import ConfigurationError, Simulation
from swmmrs.objects import HortonInfiltrationSettings
with Simulation("model.inp", "model.rpt") as simulation:
subcatchment = simulation.subcatchments["S-1"]
settings = subcatchment.settings
settings.update(
area=12.5,
width=250.0,
outlet=simulation.nodes["J-1"],
infiltration=HortonInfiltrationSettings(
initial_rate=3.0,
minimum_rate=0.5,
decay_coefficient=4.0,
drying_time_days=7.0,
),
)
assert settings.width == 250.0 # Requested declaration reads back now.
# Cross-field errors are retained until preparation.
groundwater = settings.groundwater
if groundwater is not None:
groundwater.surface_elevation = groundwater.water_table_elevation - 1.0
try:
simulation.start() # Validate relationships and rebuild derived state.
except ConfigurationError as error:
for diagnostic in error.diagnostics:
print(diagnostic.property_path, diagnostic.message)
if groundwater is not None:
groundwater.surface_elevation = groundwater.water_table_elevation
simulation.start() # Repair and retry without reopening.
Changing SubcatchmentSettings.rain_gage also rebuilds configured rain-gage
usage, duplicate time-series sharing, and effective wet/dry/routing steps at the
next successful start(). The setting continues to return the requested gage
while dirty or after failed preparation. Persistent external precipitation and
rainfall overrides remain runtime forcing and take precedence without changing
the configured relationship.
from swmmrs import Simulation
with Simulation("model.inp", "model.rpt") as simulation:
subcatchment = simulation.subcatchments["S-1"]
gage = simulation.rain_gages["GAGE-2"]
subcatchment.settings.rain_gage = gage
assert subcatchment.settings.rain_gage == gage
# Forcing changes effective rain without replacing the configured relationship.
gage.use_external_precipitation(1.25)
gage.rainfall_override = 0.0
gage.rainfall_override = None # Resume the external source.
SubcatchmentSettings.initial_buildup and coverage_fractions are canonical
live mappings. Item assignment and update() are atomic sparse mutations;
item deletion resets one configured value to zero. clear() resets every
configured value to zero, while whole-property assignment completely replaces
the mapping and resets omitted identities to zero.
from swmmrs import Simulation
with Simulation("model.inp", "model.rpt") as simulation:
settings = simulation.subcatchments["S-1"].settings
settings.initial_buildup["TSS"] = 2.5
settings.initial_buildup.update({"Lead": 0.10})
del settings.initial_buildup["Lead"] # Reset Lead to zero.
settings.coverage_fractions.update({"Residential": 0.6, "Commercial": 0.4})
settings.coverage_fractions.clear() # Reset all configured land uses to zero.
# Whole-property assignment replaces all values; omitted pollutants become zero.
settings.initial_buildup = {"TSS": 4.0}
Runtime forcing remains top-level. external_rainfall and
external_snowfall are additive persistent scalar properties.
set_precipitation_scale_factors(rainfall=..., snowfall=...) atomically changes
both coupled gage multipliers without reading a sibling value in Python.
external_pollutant_buildup_increment is a separate persistent live mapping:
item assignment and update() are sparse atomic writes, deletion resets one
pollutant to zero, and clear() resets all configured pollutants. Unlike the
stable settings mappings above, whole-property assignment is unsupported.
from swmmrs import Simulation
with Simulation("model.inp", "model.rpt") as simulation:
subcatchment = simulation.subcatchments["S-1"]
subcatchment.external_rainfall = 0.25
subcatchment.external_snowfall = 0.0
subcatchment.set_precipitation_scale_factors(rainfall=1.10, snowfall=0.80)
buildup = subcatchment.external_pollutant_buildup_increment
buildup["TSS"] = 1.0
buildup.update({"Lead": 0.05})
del buildup["Lead"]
buildup.clear()
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 |
|---|---|
SubcatchmentCollection |
Provide subcatchment lookup and aligned hydraulic, quality, and statistics snapshots. |
Subcatchment |
Expose bindable settings, forcing, results, quality, and LID state. |
SubcatchmentSettings |
Expose declaration-backed stable configuration as a live project-unit view. |
SubcatchmentInfiltration |
Expose the current infiltration configuration slot as a live view. |
HortonInfiltrationSettings |
Store detached Horton infiltration settings. |
ModifiedHortonInfiltrationSettings |
Store detached modified-Horton infiltration settings. |
GreenAmptInfiltrationSettings |
Store detached Green-Ampt infiltration settings. |
ModifiedGreenAmptInfiltrationSettings |
Store detached modified Green-Ampt infiltration settings. |
CurveNumberInfiltrationSettings |
Store detached Curve Number infiltration settings. |
SubcatchmentGroundwater |
Expose one optional groundwater configuration slot as a live view. |
SubcatchmentGroundwaterSettings |
Store one detached subcatchment groundwater declaration. |
SubcatchmentCollection
flowchart TD
swmmrs.objects.SubcatchmentCollection[SubcatchmentCollection]
swmmrs.objects._collections._Collection[_Collection]
swmmrs.objects._collections._Collection --> swmmrs.objects.SubcatchmentCollection
click swmmrs.objects.SubcatchmentCollection href "" "swmmrs.objects.SubcatchmentCollection"
click swmmrs.objects._collections._Collection href "" "swmmrs.objects._collections._Collection"
Provide subcatchment lookup and aligned hydraulic, quality, and statistics snapshots.
| METHOD | DESCRIPTION |
|---|---|
__contains__ |
Return whether a case-insensitive object ID is configured. |
__getitem__ |
Return a subcatchment view by case-insensitive configured ID. |
__iter__ |
Return an iterator over object IDs in configured project order. |
__len__ |
Return the number of configured objects in this collection. |
by_index |
Return a subcatchment view by its zero-based configured position. |
quality_snapshot |
Copy current subcatchment quality in canonical or requested order. |
snapshot |
Copy current subcatchment hydraulics in canonical or requested order. |
statistics |
Copy cumulative subcatchment statistics in canonical or requested order. |
__contains__
__getitem__
__getitem__(key: str | int) -> Subcatchment
Return a subcatchment view by case-insensitive configured ID.
__iter__
Return an iterator over object IDs in configured project order.
by_index
by_index(index: int) -> Subcatchment
Return a subcatchment view by its zero-based configured position.
quality_snapshot
Copy current subcatchment quality in canonical or requested order.
snapshot
Copy current subcatchment hydraulics in canonical or requested order.
Subcatchment
flowchart TD
swmmrs.objects.Subcatchment[Subcatchment]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.Subcatchment
click swmmrs.objects.Subcatchment href "" "swmmrs.objects.Subcatchment"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose bindable settings, forcing, results, quality, and LID state.
Notes
Stable declarations are available only through settings. Result properties
reflect the current routing state, while snapshot and statistics methods
return owned, immutable records.
| METHOD | DESCRIPTION |
|---|---|
lid_snapshot |
Copy current LID-group runtime values in configured project units. |
set_precipitation_scale_factors |
Set both persistent gage multipliers. Lifecycle: |
| ATTRIBUTE | DESCRIPTION |
|---|---|
evaporation |
Return current evaporation in project evaporation-rate units.
TYPE:
|
external_pollutant_buildup_increment |
Return canonical persistent buildup increments as a live mutable mapping.
TYPE:
|
external_rainfall |
External rainfall. Setter lifecycle:
TYPE:
|
external_snowfall |
External snowfall. Setter lifecycle:
TYPE:
|
infiltration |
Return current infiltration in project rainfall units.
TYPE:
|
lid_units |
Return locally indexed LID Units owned by this subcatchment.
TYPE:
|
pollutant_buildup |
Return current area-weighted buildup by canonical pollutant ID. |
pollutant_total_load |
Return current total washoff load by canonical pollutant ID. |
ponded_pollutant_concentration |
Return current ponded concentrations by canonical pollutant ID. |
rain_scale_factor |
Return the persistent gage-rainfall multiplier.
TYPE:
|
rainfall |
Return current total rainfall and snowfall in project rainfall units.
TYPE:
|
runoff |
Return current runoff in project flow units.
TYPE:
|
runoff_pollutant_concentration |
Return current runoff concentrations by canonical pollutant ID. |
runon |
Return current runon in project flow units.
TYPE:
|
settings |
Return a live view of stable subcatchment settings in project units.
TYPE:
|
snow_depth |
Return current snow depth in project rain-depth units.
TYPE:
|
snow_scale_factor |
Return the persistent gage-snowfall multiplier.
TYPE:
|
statistics |
Return immutable cumulative statistics for this subcatchment.
TYPE:
|
evaporation
property
evaporation: float
Return current evaporation in project evaporation-rate units.
external_pollutant_buildup_increment
property
external_pollutant_buildup_increment: MutableMapping[str, float]
Return canonical persistent buildup increments as a live mutable mapping.
Item assignment and update() are atomic sparse mutations. Deletion resets
one configured pollutant to zero; clear() atomically resets every pollutant.
Mutation lifecycle: OPEN, RUNNING, ENDED.
external_rainfall
property
writable
external_rainfall: float
External rainfall. Setter lifecycle: OPEN, RUNNING, ENDED.
external_snowfall
property
writable
external_snowfall: float
External snowfall. Setter lifecycle: OPEN, RUNNING, ENDED.
lid_units
property
lid_units: LidUnitCollection
Return locally indexed LID Units owned by this subcatchment.
pollutant_buildup
property
Return current area-weighted buildup by canonical pollutant ID.
pollutant_total_load
property
Return current total washoff load by canonical pollutant ID.
ponded_pollutant_concentration
property
Return current ponded concentrations by canonical pollutant ID.
rainfall
property
rainfall: float
Return current total rainfall and snowfall in project rainfall units.
runoff_pollutant_concentration
property
Return current runoff concentrations by canonical pollutant ID.
settings
property
settings: SubcatchmentSettings
Return a live view of stable subcatchment settings in project units.
statistics
property
Return immutable cumulative statistics for this subcatchment.
lid_snapshot
Copy current LID-group runtime values in configured project units.
SubcatchmentSettings
Expose declaration-backed stable configuration as a live project-unit view.
Dependent edits remain readable immediately and are relationally validated by
:meth:Simulation.start, which can raise :class:swmmrs.ConfigurationError.
| METHOD | DESCRIPTION |
|---|---|
update |
Atomically retain supplied stable fields in project units. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
area |
Return the area in project land-area units.
TYPE:
|
coverage_fractions |
Return live coverage; deletion zeros one value and assignment replaces all.
TYPE:
|
curb_length |
Return curb length in project length units.
TYPE:
|
groundwater |
Return the optional groundwater configuration slot view.
TYPE:
|
impervious_depression_storage |
Return impervious depression storage in project rain-depth units.
TYPE:
|
impervious_fraction |
Return the impervious area fraction.
TYPE:
|
impervious_roughness |
Return impervious-area Manning roughness.
TYPE:
|
included_in_report |
Return whether detailed results are reported.
TYPE:
|
infiltration |
Return the current infiltration configuration view, if declared.
TYPE:
|
initial_buildup |
Return live buildup; deletion zeros one value and assignment replaces all.
TYPE:
|
outlet |
Return the node or subcatchment outlet relationship.
TYPE:
|
outlet_kind |
Return the typed outlet relationship kind.
TYPE:
|
pervious_depression_storage |
Return pervious depression storage in project rain-depth units.
TYPE:
|
pervious_roughness |
Return pervious-area Manning roughness.
TYPE:
|
rain_gage |
Return the requested rain-gage relationship.
TYPE:
|
slope |
Return the dimensionless average surface slope.
TYPE:
|
snowpack |
Return the optional snowmelt parameter-set relationship.
TYPE:
|
tag |
Return the metadata tag.
TYPE:
|
width |
Return characteristic overland-flow width in project length units.
TYPE:
|
zero_impervious_fraction |
Return the zero-depression-storage impervious fraction.
TYPE:
|
coverage_fractions
property
writable
coverage_fractions: MutableMapping[str, float]
Return live coverage; deletion zeros one value and assignment replaces all.
groundwater
property
writable
groundwater: SubcatchmentGroundwater | None
Return the optional groundwater configuration slot view.
impervious_depression_storage
property
writable
impervious_depression_storage: float
Return impervious depression storage in project rain-depth units.
impervious_fraction
property
writable
impervious_fraction: float
Return the impervious area fraction.
impervious_roughness
property
writable
impervious_roughness: float
Return impervious-area Manning roughness.
included_in_report
property
writable
included_in_report: bool
Return whether detailed results are reported.
infiltration
property
writable
infiltration: SubcatchmentInfiltration | None
Return the current infiltration configuration view, if declared.
initial_buildup
property
writable
initial_buildup: MutableMapping[str, float]
Return live buildup; deletion zeros one value and assignment replaces all.
outlet
property
writable
outlet: Node | Subcatchment
Return the node or subcatchment outlet relationship.
pervious_depression_storage
property
writable
pervious_depression_storage: float
Return pervious depression storage in project rain-depth units.
pervious_roughness
property
writable
pervious_roughness: float
Return pervious-area Manning roughness.
rain_gage
property
writable
rain_gage: RainGage
Return the requested rain-gage relationship.
Assignment is declaration-backed. Usage, duplicate-series sharing, and effective simulation steps are rebuilt at the next successful start.
snowpack
property
writable
snowpack: SnowmeltParameterSet | None
Return the optional snowmelt parameter-set relationship.
width
property
writable
width: float
Return characteristic overland-flow width in project length units.
zero_impervious_fraction
property
writable
zero_impervious_fraction: float
Return the zero-depression-storage impervious fraction.
update
update(**changes: object) -> None
Atomically retain supplied stable fields in project units.
Intrinsic errors fail here. Cross-object and aggregate relationships are checked when the simulation starts, and rejected declarations remain available for corrective edits and retry.
SubcatchmentInfiltration
Expose the current infiltration configuration slot as a live view.
| METHOD | DESCRIPTION |
|---|---|
update |
Atomically update supplied infiltration fields through the Simulation Owner. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
curve_number |
Return the Curve Number infiltration parameter.
TYPE:
|
decay_coefficient |
Return the Horton-family decay coefficient per hour.
TYPE:
|
drying_time_days |
Return the infiltration recovery drying time in days.
TYPE:
|
hydraulic_conductivity |
Return Green-Ampt-family conductivity in project rainfall units.
TYPE:
|
initial_moisture_deficit |
Return the Green-Ampt-family initial moisture deficit fraction.
TYPE:
|
initial_rate |
Return the initial Horton-family rate in project rainfall units.
TYPE:
|
kind |
Return the current infiltration model kind.
TYPE:
|
maximum_infiltration |
Return the optional maximum Horton-family infiltration depth.
TYPE:
|
minimum_rate |
Return the minimum Horton-family rate in project rainfall units.
TYPE:
|
suction_head |
Return Green-Ampt-family suction head in project rain-depth units.
TYPE:
|
decay_coefficient
property
writable
decay_coefficient: float
Return the Horton-family decay coefficient per hour.
drying_time_days
property
writable
drying_time_days: float
Return the infiltration recovery drying time in days.
hydraulic_conductivity
property
writable
hydraulic_conductivity: float
Return Green-Ampt-family conductivity in project rainfall units.
initial_moisture_deficit
property
writable
initial_moisture_deficit: float
Return the Green-Ampt-family initial moisture deficit fraction.
initial_rate
property
writable
initial_rate: float
Return the initial Horton-family rate in project rainfall units.
maximum_infiltration
property
writable
maximum_infiltration: float | None
Return the optional maximum Horton-family infiltration depth.
minimum_rate
property
writable
minimum_rate: float
Return the minimum Horton-family rate in project rainfall units.
suction_head
property
writable
suction_head: float
Return Green-Ampt-family suction head in project rain-depth units.
update
update(**changes: object) -> None
Atomically update supplied infiltration fields through the Simulation Owner.
HortonInfiltrationSettings
flowchart TD
swmmrs.objects.HortonInfiltrationSettings[HortonInfiltrationSettings]
swmmrs.objects._subcatchments._HortonInfiltrationSettings[_HortonInfiltrationSettings]
swmmrs.objects._subcatchments._HortonInfiltrationSettings --> swmmrs.objects.HortonInfiltrationSettings
click swmmrs.objects.HortonInfiltrationSettings href "" "swmmrs.objects.HortonInfiltrationSettings"
click swmmrs.objects._subcatchments._HortonInfiltrationSettings href "" "swmmrs.objects._subcatchments._HortonInfiltrationSettings"
Store detached Horton infiltration settings.
ModifiedHortonInfiltrationSettings
flowchart TD
swmmrs.objects.ModifiedHortonInfiltrationSettings[ModifiedHortonInfiltrationSettings]
swmmrs.objects._subcatchments._HortonInfiltrationSettings[_HortonInfiltrationSettings]
swmmrs.objects._subcatchments._HortonInfiltrationSettings --> swmmrs.objects.ModifiedHortonInfiltrationSettings
click swmmrs.objects.ModifiedHortonInfiltrationSettings href "" "swmmrs.objects.ModifiedHortonInfiltrationSettings"
click swmmrs.objects._subcatchments._HortonInfiltrationSettings href "" "swmmrs.objects._subcatchments._HortonInfiltrationSettings"
Store detached modified-Horton infiltration settings.
GreenAmptInfiltrationSettings
flowchart TD
swmmrs.objects.GreenAmptInfiltrationSettings[GreenAmptInfiltrationSettings]
swmmrs.objects._subcatchments._GreenAmptInfiltrationSettings[_GreenAmptInfiltrationSettings]
swmmrs.objects._subcatchments._GreenAmptInfiltrationSettings --> swmmrs.objects.GreenAmptInfiltrationSettings
click swmmrs.objects.GreenAmptInfiltrationSettings href "" "swmmrs.objects.GreenAmptInfiltrationSettings"
click swmmrs.objects._subcatchments._GreenAmptInfiltrationSettings href "" "swmmrs.objects._subcatchments._GreenAmptInfiltrationSettings"
Store detached Green-Ampt infiltration settings.
ModifiedGreenAmptInfiltrationSettings
flowchart TD
swmmrs.objects.ModifiedGreenAmptInfiltrationSettings[ModifiedGreenAmptInfiltrationSettings]
swmmrs.objects._subcatchments._GreenAmptInfiltrationSettings[_GreenAmptInfiltrationSettings]
swmmrs.objects._subcatchments._GreenAmptInfiltrationSettings --> swmmrs.objects.ModifiedGreenAmptInfiltrationSettings
click swmmrs.objects.ModifiedGreenAmptInfiltrationSettings href "" "swmmrs.objects.ModifiedGreenAmptInfiltrationSettings"
click swmmrs.objects._subcatchments._GreenAmptInfiltrationSettings href "" "swmmrs.objects._subcatchments._GreenAmptInfiltrationSettings"
Store detached modified Green-Ampt infiltration settings.
CurveNumberInfiltrationSettings
Store detached Curve Number infiltration settings.
SubcatchmentGroundwater
Expose one optional groundwater configuration slot as a live view.
| METHOD | DESCRIPTION |
|---|---|
update |
Atomically retain supplied groundwater fields through the Simulation Owner. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
aquifer |
Return the groundwater aquifer relationship.
TYPE:
|
bottom_elevation |
Return aquifer bottom elevation in project length units.
TYPE:
|
fixed_surface_depth |
Return fixed surface-water depth in project length units.
TYPE:
|
groundwater_coefficient |
Return the groundwater flow coefficient.
TYPE:
|
groundwater_exponent |
Return the groundwater flow exponent.
TYPE:
|
interaction_coefficient |
Return the groundwater/surface-water interaction coefficient.
TYPE:
|
node |
Return the groundwater outlet-node relationship.
TYPE:
|
surface_coefficient |
Return the surface-water flow coefficient.
TYPE:
|
surface_elevation |
Return ground surface elevation in project length units.
TYPE:
|
surface_exponent |
Return the surface-water flow exponent.
TYPE:
|
upper_moisture |
Return the initial upper-zone moisture fraction.
TYPE:
|
water_table_elevation |
Return initial water-table elevation in project length units.
TYPE:
|
bottom_elevation
property
writable
bottom_elevation: float
Return aquifer bottom elevation in project length units.
fixed_surface_depth
property
writable
fixed_surface_depth: float
Return fixed surface-water depth in project length units.
groundwater_coefficient
property
writable
groundwater_coefficient: float
Return the groundwater flow coefficient.
groundwater_exponent
property
writable
groundwater_exponent: float
Return the groundwater flow exponent.
interaction_coefficient
property
writable
interaction_coefficient: float
Return the groundwater/surface-water interaction coefficient.
surface_coefficient
property
writable
surface_coefficient: float
Return the surface-water flow coefficient.
surface_elevation
property
writable
surface_elevation: float
Return ground surface elevation in project length units.
upper_moisture
property
writable
upper_moisture: float
Return the initial upper-zone moisture 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 retain supplied groundwater fields through the Simulation Owner.
Identity, scalar range, and unit checks are immediate. Elevation ordering
and other relational checks are deferred to :meth:Simulation.start.
SubcatchmentGroundwaterSettings
Store one detached subcatchment groundwater declaration.