Output

Constructor and Properties

class swmm.pandas.Output(binfile)[source]

Base class for a SWMM binary output file.

The output object provides several options to process timeseries within binary output file.

Output files should be closed after use prevent memory leaks. Close them explicitly with the _close() method or deleting the object using del, or use it with a context manager.

# Using a the _close method
>>> from swmm.pandas import Output
>>> out = Output('tests/Model.out')
>>> print(out.project_size)
[3, 9, 8, 1, 3]
>>> out._close() # can also use `del out`
>>>
# Using a context manager
>>> with Output('tests/Model.out') as out:
...     print(out.pollutants)
('groundwater', 'pol_rainfall', 'sewage')
Parameters
binfile: str

model binary file path

subcatch_attributes

Subcatchment attribute enumeration: By default has

‘rainfall’, ‘snow_depth’, ‘evap_loss’, ‘infil_loss’, ‘runoff_rate’, ‘gw_outflow_rate’, ‘gw_table_elev’, ‘soil_moisture’

Link attribute enumeration: By default has

‘flow_rate’, ‘flow_depth’, ‘flow_velocity’, ‘flow_volume’, ‘capacity’,

node_attributes

Node attribute enumeration: By default has

‘invert_depth’, ‘hydraulic_head’, ‘ponded_volume’, ‘lateral_inflow’, ‘total_inflow’, ‘flooding_losses’

system_attributes

System attribute enumeration: By default has

‘air_temp’, ‘rainfall’, ‘snow_depth’, ‘evap_infil_loss’, ‘runoff_flow’, ‘dry_weather_inflow’, ‘gw_inflow’, ‘rdii_inflow’, ‘direct_inflow’, ‘total_lateral_inflow’, ‘flood_losses’, ‘outfall_flows’, ‘volume_stored’, ‘evap_rate’, ‘ptnl_evap_rate’

subcatchments

Return a tuple of subcatchments available in SWMM output binary file.

Returns
Tuple[str]

A tuple of model subcatchment names.

Return a tuple of links available in SWMM binary output file.

Returns
Tuple[str]

A tuple of model link names.

nodes

Return a tuple of nodes available in SWMM binary output file.

Returns
Tuple[str]

A tuple of model node names.

pollutants

Return a tuple of pollutants available in SWMM binary output file.

Returns
Tuple[str]

A tuple of pollutant names.

project_size

Returns the number of each model element type available in out binary output file in the following order:

[subcatchment, node, link, system, pollutant]

Returns
list

A list of numbers of each model type.

[nSubcatchments, nNodes, nLinks, nSystems(1), nPollutants]

report

Return the reporting timestep in seconds.

Returns
int

The reporting timestep in seconds.

start

Return the reporting start datetime.

Returns
datetime

The reporting start datetime.

end

Return the reporting end datetime.

Returns
datetime

The reporting end datetime.

period

Return the number of reporting timesteps in the binary output file.

Returns
int

The number of reporting timesteps.

units

Return SWMM binary output file unit type from swmm.toolkit.shared_enum.UnitSystem.

Returns
List[str]

List of string names for system units, flow units, and units for each pollutant.

Values returned are the names from swmm.toolkit.shared_enum:

UnitSystem FlowUnits ConcUnits

Time Series Data

Get time series data for one or more elements and one or more variables.

Output.link_series

Get one or more time series for one or more link attributes.

Output.node_series

Get one or more time series for one or more node attributes.

Output.subcatch_series

Get one or more time series for one or more subcatchment attributes.

Output.system_series

Get one or more a time series for one or more system attributes.

Element Attribute Data

Get attribute for a given time step for all elements of a given type.

Output.link_attribute

For all links at a given time, get one or more attributes.

Output.node_attribute

For all nodes at a given time, get one or more attributes.

Output.subcatch_attribute

For all subcatchments at a given time, get a one or more attributes.

Output.system_attribute

For all nodes at given time, get a one or more attributes.

Element Result Data

Get all attributes for a given set time steps for given set of elements.

Output.link_result

For a link at one or more given times, get all attributes.

Output.node_result

For one or more nodes at one or more given times, get all attributes.

Output.subcatch_result

For a subcatchment at one or more given times, get all attributes.

Output.system_result

For a given time, get all system attributes.

Helper Methods

Output.getStructure

Return a structure object for a given list of links and nodes.


Last update: Mar 31, 2022