swmmio.inp#

class swmmio.core.inp(file_path)[source]#
Attributes:
aquifers

Get/set the aquifers section of the INP file.

buildup

Get/set buildup section of the INP file.

conduits

Get/set conduits section of the INP file.

controls

Get/set controls section of the model

coordinates

Get/set coordinates section of model

coverages

Get/set coverages section of the INP file.

curves

get/set curves section of model

dividers

Get/set dividers section of the INP file.

dwf

Get/set DWF section of model

evaporation

get/set evaporation section of model

files

Get/set files section of the INP file.

groundwater

Get/set the groundwater section of the INP file.

headers

Return all headers and associated column names found in the INP file.

hydrographs

Get/set hydrographs section of the INP file.

infiltration

Get/set infiltration section of the INP file.

inflows

Get/set inflows section of model

inlet_usage

Get/set inlet usage section of the INP file.

inlets

Get/set inlets section of the INP file.

junctions

Get/set junctions section of the INP file.

landuses

Get/set landuses section of the INP file.

lid_usage

Get/set LID_USAGE section of the INP file.

loadings

Get/set loadings section of the INP file.

losses

get/set losses section of model

options

Get/set options section of the INP file.

orifices

Get/set orifices section of the INP file.

outfalls

Get/set outfalls section of the INP file.

outlets

Get/set outlets section of the INP file.

patterns

Get/set patterns section of the model

pollutants

get/set pollutants section of model

polygons

get/set polygons section of model

pumps

Get/set pumps section of the INP file.

raingages

get/set raingages section of model

rdii

Get/set RDII section of the INP file.

report

Get/set report section of the INP file.

storage

Get/set storage section of the INP file.

streets

Get/set streets section of the INP file.

subareas

Get/set subareas section of the INP file.

subcatchments

Get/set subcatchments section of the INP file.

tags

Get/set tags section of the INP file.

timeseries

get/set timeseries section of model

vertices

get/set vertices section of model

washoff

Get/set washoff section of the INP file.

weirs

Get/set weirs section of the INP file.

xsections

Get/set xsections section of the INP file.

Methods

save([target_path])

Save the inp file to disk.

validate()

Detect and remove invalid model elements

trim_to_nodes

property aquifers#

Get/set the aquifers section of the INP file.

>>> from swmmio.examples import groundwater
>>> groundwater.inp.aquifers.loc['1'] 
Por        0.500
WP         0.150
FC         0.300
Ksat       0.100
Kslope    12.000
Tslope    15.000
ETu        0.350
ETs       14.000
Seep       0.002
Ebot       0.000
Egw        3.500
Umc        0.400
Name: 1, dtype: float64
property buildup#

Get/set buildup section of the INP file.

Examples:

>>> from swmmio.examples import walnut
>>> walnut.inp.buildup[['Pollutant', 'Function', 'Normalizer']] 
            Pollutant Function Normalizer
LandUse
Residential      Lead     NONE       AREA
Residential       TSS      SAT       AREA
Undeveloped      Lead     NONE       AREA
Undeveloped       TSS      SAT       AREA
property conduits#

Get/set conduits section of the INP file.

Returns:

Conduits section of the INP file

Return type:

pandas.DataFrame

Examples:

>>> import swmmio
>>> from swmmio.tests.data import MODEL_FULL_FEATURES__NET_PATH
>>> model = swmmio.Model(MODEL_FULL_FEATURES__NET_PATH)
>>> model.inp.conduits[['InletNode', 'OutletNode', 'Length', 'Roughness']] 
      InletNode OutletNode  Length  Roughness
Name
C1:C2        J1         J2  244.63      0.01
C2.1         J2         J3  666.00      0.01
1             1          4  400.00      0.01
2             4          5  400.00      0.01
3             5         J1  400.00      0.01
4             3          4  400.00      0.01
5             2          5  400.00      0.01
property controls#

Get/set controls section of the model

Returns:

dataframe of controls

>>> from swmmio.examples import pump_control
>>> pump_control.inp.controls  
                                                                    Control
Name                                                                       
RULE PUMP1A  IF NODE SU1 DEPTH >= 4 THEN PUMP PUMP1 status = ON PRIORITY 1 
RULE PUMP1B  IF NODE SU1 DEPTH < 1 THEN PUMP PUMP1 status = OFF PRIORITY 1 
property coordinates#

Get/set coordinates section of model :return: dataframe of model coordinates

property coverages#

Get/set coverages section of the INP file.

Examples:

>>> from swmmio.examples import walnut
>>> walnut.inp.coverages 
                  LandUse  Percent
Subcatchment
1             Residential    100.0
2             Residential     50.0
2             Undeveloped     50.0
3             Residential    100.0
4             Residential     50.0
4             Undeveloped     50.0
5             Residential    100.0
6             Undeveloped    100.0
7             Undeveloped    100.0
8             Undeveloped    100.0
property curves#

get/set curves section of model :return: multi-index dataframe of model curves

property dividers#

Get/set dividers section of the INP file.

Returns:

dividers section of the INP file

Return type:

pandas.DataFrame

>>> from swmmio.examples import spruce
>>> spruce.inp.dividers   
           Elevation Diverted Link    Type  Parameters
Name
NODE5            3.0            C6  CUTOFF         1.0
property dwf#

Get/set DWF section of model :return: dataframe of model DWF section

property evaporation#

get/set evaporation section of model

Returns:

dataframe of evaporation section in inp file

Examples:

>>> from swmmio.examples import walnut
>>> walnut.inp.evaporation 
         Value
Key
CONSTANT   0.0
DRY_ONLY    NO
property files#

Get/set files section of the INP file.

Returns:

files section of the INP file

Return type:

pandas.DataFrame

property groundwater#

Get/set the groundwater section of the INP file.

>>> from swmmio.examples import groundwater
>>> groundwater.inp.groundwater.loc['1'] 
Aquifer    1.0
Node       2.0
Esurf      6.0
A1         0.1
B1         1.0
A2         0.0
B2         0.0
A3         0.0
Dsw        0.0
Egwt       4.0
Name: 1, dtype: float64
property headers#

Return all headers and associated column names found in the INP file.

property hydrographs#

Get/set hydrographs section of the INP file.

Examples:

>>> from swmmio.examples import walnut
>>> walnut.inp.hydrographs 
            RainGage/Month
Hydrograph
Hydrograph1            TS1
property infiltration#

Get/set infiltration section of the INP file.

>>> import swmmio
>>> from swmmio.tests.data import MODEL_FULL_FEATURES__NET_PATH
>>> m = swmmio.Model(MODEL_FULL_FEATURES__NET_PATH)
>>> m.inp.infiltration  
              MaxRate  MinRate  Decay  DryTime  MaxInfil
Subcatchment
S1                3.0      0.5      4        7         0
S2                3.0      0.5      4        7         0
S3                3.0      0.5      4        7         0
S4                3.0      0.5      4        7         0
property inflows#

Get/set inflows section of model

Returns:

dataframe of nodes with inflows

>>> from swmmio.examples import jersey
>>> jersey.inp.inflows[['Constituent', 'Mfactor', 'Baseline']]  
     Constituent  Mfactor  Baseline
Node
J3          Flow      1.0         1
J2          FLOW      1.0         1
J1          FLOW      1.0         1
property inlet_usage#

Get/set inlet usage section of the INP file.

Returns:
pandas.DataFrame

Examples

Access the inlet usage section of the inp file

>>> from swmmio.examples import streets
>>> streets.inp.inlet_usage[['Inlet', 'Node', 'Number', '%Clogged']] 
              Inlet Node  Number  %Clogged
Link
Street1  ComboInlet   J1       1        50
Street3  ComboInlet  J2a       1         0
Street4  ComboInlet   J2       1         0
Street5  ComboInlet  J11       2         0
property inlets#

Get/set inlets section of the INP file.

Returns:
pandas.DataFrame

Examples

Access the inlets section of the inp file

>>> from swmmio.examples import streets
>>> streets.inp.inlets 
             Type  Param1  Param2      Param3
Name
ComboInlet  GRATE       2     2.0    P_BAR-50
ComboInlet   CURB       2     0.5  HORIZONTAL
property junctions#

Get/set junctions section of the INP file.

Returns:

junctions section of the INP file

Return type:

pandas.DataFrame

Examples:

>>> import swmmio
>>> from swmmio.tests.data import MODEL_FULL_FEATURES__NET_PATH
>>> model = swmmio.Model(MODEL_FULL_FEATURES__NET_PATH)
>>> model.inp.junctions 
      InvertElev  MaxDepth  InitDepth  SurchargeDepth  PondedArea
Name
J3         6.547        15          0               0           0
1         17.000         0          0               0           0
2         17.000         0          0               0           0
3         16.500         0          0               0           0
4         16.000         0          0               0           0
5         15.000         0          0               0           0
J2        13.000        15          0               0           0
property landuses#

Get/set landuses section of the INP file.

Examples:

>>> from swmmio.examples import walnut
>>> walnut.inp.landuses 
             CleaningInterval  FractionAvailable  LastCleaned
Name
Residential                 0                  0            0
Undeveloped                 0                  0            0
property lid_usage#

Get/set LID_USAGE section of the INP file.

property loadings#

Get/set loadings section of the INP file.

property losses#

get/set losses section of model

Returns:

dataframe of evaporation section in inp file

>>> from swmmio.examples import spruce
>>> spruce.inp.losses  
       Inlet  Outlet  Average Flap Gate  SeepageRate
Link
C1:C2      0       0        0       YES            0
C2.1       0       0        0       YES            0
property options#

Get/set options section of the INP file.

Returns:

options section of the INP file

Return type:

pandas.DataFrame

>>> import swmmio
>>> from swmmio.tests.data import MODEL_FULL_FEATURES_XY
>>> model = swmmio.Model(MODEL_FULL_FEATURES_XY)
>>> model.inp.options.loc['INFILTRATION']
Value    HORTON
Name: INFILTRATION, dtype: object
>>> model.inp.headers['[INFILTRATION]']
['Subcatchment', 'MaxRate', 'MinRate', 'Decay', 'DryTime', 'MaxInfil']
>>> model.inp.options.loc['INFILTRATION', 'Value'] = 'GREEN_AMPT'
>>> model.inp.headers['[INFILTRATION]']
['Subcatchment', 'Suction', 'HydCon', 'IMDmax', 'Param4', 'Param5']
property orifices#

Get/set orifices section of the INP file.

property outfalls#

Get/set outfalls section of the INP file.

Returns:

outfalls section of the INP file

Return type:

pandas.DataFrame

Examples:

>>> import swmmio
>>> from swmmio.tests.data import MODEL_FULL_FEATURES__NET_PATH
>>> model = swmmio.Model(MODEL_FULL_FEATURES__NET_PATH)
>>> model.inp.outfalls  
      InvertElev OutfallType StageOrTimeseries
Name
J4             0        FREE                NO
property outlets#

Get/set outlets section of the INP file.

Returns:
pandas.DataFrame

Examples

Access the outlets section of the inp file

>>> from swmmio.examples import streets
>>> streets.inp.outlets.loc['C11'] 
InletNode                     J11
OutletNode                     O1
OutflowHeight                   0
OutletType       FUNCTIONAL/DEPTH
Qcoeff/QTable                  10
Qexpon                        0.5
FlapGate                       NO
Name: C11, dtype: object
property patterns#

Get/set patterns section of the model

Returns:

dataframe of patterns

>>> from swmmio.examples import pump_control
>>> # NOTE, only the first 5 columns are shown in the following example
>>> pump_control.inp.patterns.iloc[:,0:5]  
        Type  Factor1  Factor2  Factor3  Factor4
Name                                            
DWF   HOURLY   0.0151  0.01373  0.01812  0.01098
property pollutants#

get/set pollutants section of model

Returns:

dataframe of pollutants section in inp file

Examples: The walnut example model contains two entries in the POLLUTANTS section, one of which is TSS. Below we show how to retrieve this information, by accessing the TSS index of the pollutants dataframe:

>>> from swmmio.examples import walnut
>>> walnut.inp.pollutants.loc['TSS'] 
MassUnits           MG/L
RainConcen           0.0
GWConcen             0.0
I&IConcen              0
DecayCoeff           0.0
SnowOnly              NO
CoPollutName           *
CoPollutFraction     0.0
DWFConcen              0
InitConcen             0
Name: TSS, dtype: object
property polygons#

get/set polygons section of model :return: dataframe of model coordinates

property pumps#

Get/set pumps section of the INP file.

property raingages#

get/set raingages section of model

Returns:

dataframe of raingages in the model

Examples:

>>> from swmmio.examples import philly
>>> philly.inp.raingages 
       RainType TimeIntrvl  SnowCatch  DataSource DataSourceName
Name
RG1   INTENSITY       1:00        1.0  TIMESERIES   design-storm
property rdii#

Get/set RDII section of the INP file.

Examples:

>>> from swmmio.examples import walnut
>>> walnut.inp.rdii 
     UnitHydrograph  SewerArea
Node
13      Hydrograph1  58.944186
14      Hydrograph1  58.944186
property report#

Get/set report section of the INP file.

Returns:

report section of the INP file

Return type:

pandas.DataFrame

>>> from swmmio.examples import jersey
>>> jersey.inp.report  
              Status
Param
INPUT            YES
CONTROLS         YES
SUBCATCHMENTS   NONE
NODES            ALL
LINKS           NONE
save(target_path=None)[source]#

Save the inp file to disk. File will be overwritten unless a target_path is provided

Parameters:

target_path – optional path to new inp file

Returns:

None

>>> from swmmio.examples import philly
>>> philly.inp.save('copy-of-philly.inp')
property storage#

Get/set storage section of the INP file.

Returns:

storage section of the INP file

Return type:

pandas.DataFrame

Examples:

property streets#

Get/set streets section of the INP file.

Returns:
pandas.DataFrame

Examples

Access the streets section of the inp file

>>> from swmmio.examples import streets
>>> streets.inp.streets[['Tcrown', 'Hcurb']] 
             Tcrown  Hcurb
Name
HalfStreet      20    0.5
FullStreet      20    0.5
property subareas#

Get/set subareas section of the INP file.

property subcatchments#

Get/set subcatchments section of the INP file.

Returns:

subcatchments section of the INP file

Return type:

pandas.DataFrame

Examples:

property tags#

Get/set tags section of the INP file.

property timeseries#

get/set timeseries section of model :return: multi-index dataframe of model curves

trim_to_nodes(node_ids)[source]#
validate()[source]#

Detect and remove invalid model elements

Returns:

None

property vertices#

get/set vertices section of model :return: dataframe of model coordinates

property washoff#

Get/set washoff section of the INP file.

Examples:

>>> from swmmio.examples import walnut
>>> walnut.inp.washoff[['Pollutant', 'Function']] 
            Pollutant Function
LandUse
Residential      Lead      EMC
Residential       TSS      EXP
Undeveloped      Lead      EMC
Undeveloped       TSS      EXP
property weirs#

Get/set weirs section of the INP file.

property xsections#

Get/set xsections section of the INP file.