Back to all posts

PySubcatchment

This class interacts with the subcatchment data in the SWMM model input file. The class object is obtained with pcpy.SWMM.Subcatchments, which returns a dictionary of PySubcatchment with subcatchment name as the dictionary key. It can be created with function pcpy.SWMM.add_subcatchment.

Properties

Both get and set operations are supported for properties unless indicated. For all properties with data type float, their corresponding units are as displayed in the Attributes panel.

Property Explanation Data Type

Name

User-assigned name of subcatchment.

Example: subcatchment.Name = "S1_1"

string

Description

Optional comment or description.

Example:

subcatchment.Description= "split from S1"

string

Tag

Optional category or classification.

Example: subcatchment.Tag = "imported"

string

RainGage

Rain gauge assigned to subcatchment.

Example: subcatchment.RainGage = "RG83"

string

Outlet

Name of node or another subcatchment that receives runoff.

Example: subcatchment.Outlet = "J23"

string

Area

Area of subcatchment.

Example: subcatchment.Area = 34.586

float

ImpervPercent

Percent of impervious area.

Example: subcatchment.ImpervPercent = 35

float

Width

Width of overland flow path. Can be set only when the FlowLength property is read-only.

Example: subcatchment.Width = 340.6

float

FlowLength

Length of overland sheet flow. Can be set only when the Width property is read-only.

Example: subcatchment.FlowLength = 629.4

float

Slope

Average surface slope.

Example: subcatchment.Slope = 1.25

float

CurbLength

Curb length (if needed for pollutant buildup functions).

Example: subcatchment.CurbLength = 350

float
DStoragePattern

Name of optional monthly pattern that adjusts depression depth.

Applicable to SWMM version 5.1.013 and later.

Example: subcatchment.DStoragePattern = 'PAT2'

string
InfilPattern

Name of optional monthly pattern that adjusts infiltration rate.

Applicable to SWMM version 5.1.013 and later.

Example: subcatchment.InfilPattern = 'INPAT1'

string

SnowPack

Name of snow pack parameter set (for snow melt analysis only).

Example: subcatchment.SnowPack = "SnowPack1"

string

ImpervN

Manning's N for impervious area.

Example: subcatchment.ImpervN = 0.011

float

PervN

Manning's N for pervious area.

Example: subcatchment.PervN = 0.2

float

ImpervDStorage

Depth of depression storage on impervious area.

Example: subcatchment.ImpervDStorage = 1.25

float

PervDStorage

Depth of depression storage on pervious area.

Example: subcatchment.PervDStorage = 3.5

float

ZeroImpervPercent

Percent of impervious area with no depression storage.

Example: subcatchment.ZeroImpervPercent = 25

float

Routing

Choice of internal routing of runoff between pervious and impervious areas.

Values can be "PERVIOUS", "IMPERVOUS", or "OUTLET".

Example: subcatchment.Routing = "PERVIOUS"

string

PercentRouted

Percent of runoff routed between sub-areas.

Example: subcatchment.PercentRouted = 50

float

SuctionHead

Soil capillary suction head.

Can be get/set only when Green-Ampt or Modified Green-Ampt infiltration method is used.

Example: subcatchment.SuctionHead = 45.6

float

Conductivity

Soil saturated hydraulic conductivity.

Can be get/set only when Green-Ampt or Modified Green-Ampt infiltration method is used.

Example: subcatchment.SuctionHead = 3.3

float

InitialDeficit

Initial soil moisture deficit.

Can be get/set only when Green-Ampt or Modified Green-Ampt infiltration is used.

Example: subcatchment.InitialDeficit = 0.11

float

MaxInfilRate

Maximum rate on the Horton infiltration curve.

Can be get/set only when Horton or Modified Horton infiltratio method is used.

Example: subcatchment.MaxInfilRate = 5

float

MinInfilRate

Minimum rate on the Horton infiltration curve.

Can be get/set only when Horton or Modified Horton infiltration method is used.

Example: subcatchment.MinInfilRate = 1.25

float

DecayConst

Decay constant for the Horton infiltration curve.

Can be get/set only when Horton or Modified Horton infiltration method is used.

Example: subcatchment.DecayConst = 4

float

DryingTime

Time for a fully saturated soil to completely dry.

Can be get/set only when Horton or Modified Horton or SCS Curve Number infiltration method is used.

Example: subcatchment.DryingTime = 10

float

MaxInfilVol

Maximum infiltration volume possible (0 if not applicable).

Can be get/set only when Horton or Modified Horton infiltration method is used.

Example: subcatchment.MaxInfilVol = 5.4

float

CurveNumber

SCS runoff curve number.

Can be get/set only when SCS Curve Number infiltration method is used.

Example: subcatchment.CurveNumber = 78

integer

ModelGW

Whether ground water component will be modeled for this subcatchment.

Values can be "YES" or "NO".

Example: subcatchment.ModeGW = "YES"

string

GWAquifer

Name of aquifer object that lies below subcatchment (use empty string for no groundwater).

Example: subcatchment.GWAquifer = "Aquifer1"

string

GWReceiveNode

Name of node that receives groundwater from the aquifer.

Example: subcatchment.GWReceiveNode = "J1"

string

GWSurfaceElev

Elevation of ground surface for the subcatchment.

Example: subcatchment.GWSurfaceElev = 151.24

float

GWA1

Multiplier of distance between actual and threshold GW levels.

Example: subcatchment.GWA1 = 0

float

GWA2

Multiplier of distance between surface water level and threshold GW level.

Example: subcatchment.GWA2 = 1

float

GWB1

Exponent of distance between actual and threshold GW levels.

Example: subcatchment.GWB1 = 0

float

GWB2

Exponent of distance between surface water level and threshold GW level.

Example: subcatchment.GWB2 = 1

float

GWA3

Multiplier of product of GW height and surface water height above aquifer bottom.

Example: subcatchment.GWA3 = -1

float

GWSurfaceWaterDepth

Depth of surface water above channel bottom. Set to 0 to use depth from flow routing.

Example: subcatchment.GWSurfaceWaterDepth = 3

float

GWThresholdWaterElev

Minimum water table elevation for flow to occur. Set to -99 to use node's invert elevation.

Example: subcatchment.GWThresholdWaterElev = 12.5

float

GWBottomElev

Elevation of the bottom of the aquifer. Set to -99 to use aquifer value.

Example: subcatchment.GWBottomElev = 11.24

float

GWInitWaterElev

Initial water table elevation. Set to -99 to use aquifer value.

Only apply to SWMM5.1.006 and later.

Example: subcatchment.GWInitWaterElev = 12.1

float

GWInitMoistureFrac

Initial moisture content of the unsaturated upper zone. Set to -99 to use aquifer value.

Only apply to SWMM5.1.006 and later.

Example: subcatchment.GWInitMoistureFraction = 0.42

float

GWLateralFlowEq

Custom expression to use in addition to the standard equation for groundwater flow.

Set to empty string to use only the standard equation. Only apply to SWMM5.1.006 and later.

Example: subcatchment.GWLateralFlowEq = "0.001*Hgw*STEP(Hgw-5)"

string

GWDeepFlowEquation

Custom equation for deep groundwater flow.

Example: subcatchment.GWDeepFlowEquation = "Hsw*(Hgw+5)"

string

NPervPattern

Manning's N time pattern for pervious area.

Can be get/set for a model using OpenSWMM5.1.907 and later, and SWMM5.1.013.

Example: subcatchment.NPervPattern = "NPervPattern1"

string

DStoragePervPattern

Depth time pattern of depression storage on pervious area.

Can be get/set for a model using OpenSWMM5.1.907 and later, and SWMM5.1.013.

Example: subcatchment.DStoragePervPattern = "DStoragePervPattern1"

string

SuctionHeadPattern

Soil capillary suction head time pattern.

Can be get/set only when any OpenSWMM engine and Green-Ampt infiltration method is used.

Example: subcatchment.SuctionHeadPattern = "SuctionHeadPattern1"

string

ConductivityPattern

Soil saturated hydraulic conductivity time pattern.

Can be get/set only when any OpenSWMM engine and Green-Ampt infiltration method is used.

Example: subcatchment.ConductivityPattern = "ConductPattern1"

string

InitialDeficitPattern

Initial soil moisture deficit time pattern.

Can be get/set only when any OpenSWMM engine and Green-Ampt infiltration method is used.

Example: subcatchment.InitialDeficitPattern = "InitDefPattern1"

string

MaxInfilRatePattern

Maximum infiltration rate time pattern.

Can be get/set only when any OpenSWMM engine and Horton or Modified Horton infiltration method is used.

Example: subcatchment.MaxInfilRatePattern = "MaxInfilPattern1"

string

MinInfilRatePattern

Minimum infiltration rate time pattern.

Can be get/set only when any OpenSWMM engine and Horton or Modified Horton infiltration method is used.

Example: subcatchment.MinInfilRatePattern = "MinInfilPattern1"

string

DecayPattern

Decay constant time pattern.

Can be get/set only when any OpenSWMM engine and Horton or Modified Horton infiltration method is used.

Example: subcatchment.DecayPattern = "DecayPattern1"

string

LIDUsages

Get a dictionary of PyLIDUsage

dict.

key = LID usage name.

value = PyLIDUsage object.

Index Properties

Index properties are supported to get/set value associated with user-defined pollutants and land uses. Since the names of pollutants and land uses are dynamic, it is not appropriate to define each as a class property.

Operator Explanation Data Type
InitBuildup

Get/set initial buildup of pollutant.

Example: subcatchment.InitBuildup['TSS'] = 0.5

float

Landuse

Get/set the percentage of land use.

Example: subcatchment.Landuse['Resid'] = 25

float

Methods

Method Input Arguments Explanation Data Type
add_lid_usage(name)

name: name of the lid control.

Add an lid control into subcatchment.

Example:

lid = subcatchment.add_lid_usage('PerviousConcrete')

PyLIDUsage
delete_lid_usage(name) name: name of the lid control.

Delete an lid control from subcatchment.

Example:

subcatchment.delete_lid_usage('RainBarrel1')

None

Examples

Work with existing subcatchments

# get subcatchment 'S2'
sub = pcpy.SWMM.Subcatchments['S2']

# update the subcatchment area to 3.976 hectares
sub.Area = 3.976

# update the subcatchment width to 300 metres
sub.Width = 300

# update the subcatchment slope to 1.5%
sub.Slope = 1.5

Add a new subcatchment

name = 'S1'
# if the entity already exists, delete it
if pcpy.SWMM.Subcatchments.has_key(name):
  pcpy.SWMM.delete_subcatchment(name)

# add new entity to the model
sub = pcpy.SWMM.add_subcatchment(name)

# create a list of vertices forming the geometry of the entity
p1 = pcpy.Vertex(254450.628, 5014704.682)
p2 = pcpy.Vertex(254391.053, 5014822.887)
p3 = pcpy.Vertex(254467.65, 5014848.419)
p4 = pcpy.Vertex(254518.241, 5014662.601)
vertices = [p1, p2, p3, p4]

# get the corresponding entity in the model layer to set its geometry
en = sub.get_entity()
en.Geometry.Vertices = vertices

# refresh the map. without it, the new entity will not be shown on the Map panel
pcpy.Map.refresh()