Surface water quality#

solver.surface2d.quality exposes 2D land-use coverage, initial buildup and curb-length tables. Acquire it after solver.open() and edit before initialization. The view retains its solver and becomes stale after structural or lifecycle changes; reacquire it after adding land uses or pollutants.

CellScope selects GLOBAL, TAG or CELL. More specific rows override broader ones at runtime. Cell indices are zero-based for both triangles and quads.

from openswmm.engine import CellScope

quality = solver.surface2d.quality
quality.set_coverage(CellScope.GLOBAL, {'URBAN': 100})
quality.set_loading(CellScope.GLOBAL, 'TSS', 10)
quality.set_loading(CellScope.TAG, 'TSS', 20, tag='PAN')
quality.set_curb_length(CellScope.GLOBAL, 25)

set_coverage replaces the entire land-use mapping at a scope. Values are percentages; names must identify existing land uses and the engine validates the total. Use remove_coverage(index) to clear a row. The coverages, loadings and curb_lengths properties are immutable snapshots. Removing a row shifts subsequent indices.

Initial loading and runtime buildup(species) use project pollutant mass per acre/hectare. Curb length uses project length units. buildup requires an active surface-quality kernel and returns an owned float64 array in cell order. Changing the returned array never changes the model. The native buildup and washoff configuration determines whether the kernel is active.

class SurfaceCoverage(scope, tag, cell, landuses)#

Bases: object

A whole land-use coverage set at one scope; pairs carry percentages.

Parameters:
scope: CellScope#
tag: str#
cell: int#
landuses: tuple[tuple[str, float], ...]#
class SurfaceCurbLength(scope, tag, cell, length)#

Bases: object

Authored curb length in project length units.

Parameters:
  • scope (CellScope)

  • tag (str)

  • cell (int)

  • length (float)

scope: CellScope#
tag: str#
cell: int#
length: float#
class SurfaceLoading(scope, tag, cell, species, value)#

Bases: object

Initial species buildup in project mass per acre/hectare.

Parameters:
scope: CellScope#
tag: str#
cell: int#
species: str#
value: float#
class SurfaceQuality(owner)#

Bases: object

Parameters:

owner (Any)

buildup(species)#
Parameters:

species (str)

Return type:

NDArray[float64]

property coverages: tuple[SurfaceCoverage, ...]#
property curb_lengths: tuple[SurfaceCurbLength, ...]#
property loadings: tuple[SurfaceLoading, ...]#
remove_coverage(index)#
Parameters:

index (int)

Return type:

None

remove_curb_length(index)#
Parameters:

index (int)

Return type:

None

remove_loading(index)#
Parameters:

index (int)

Return type:

None

set_coverage(scope, landuses, *, tag=Ellipsis, cell=Ellipsis)#
Parameters:
Return type:

None

set_curb_length(scope, length, *, tag=Ellipsis, cell=Ellipsis)#
Parameters:
  • scope (CellScope)

  • length (float)

  • tag (str)

  • cell (int)

Return type:

None

set_loading(scope, species, value, *, tag=Ellipsis, cell=Ellipsis)#
Parameters:
Return type:

None