Catchment Simulation Module

Package include method for simulate subcatchment with different features values from Storm Water Management Model

class catchment_simulation.catchment_features_simulation.FeaturesSimulation(subcatchment_id: str, raw_file: str)[source]

Bases: object

A class to simulate subcatchments with different features using the Storm Water Management Model (SWMM).

Parameters

subcatchment_idstr

The identifier of the subcatchment being simulated.

raw_filestr

The path to the raw SWMM input file.

Raises

FileNotFoundError

If the raw_file does not exist.

ValueError

If the subcatchment_id does not exist in the SWMM model.

DEPRESSION_STORAGE_VALUES: tuple[float, ...] = (1.27, 2.54, 5.08, 7.619999999999999)
MANNING_N_VALUES: tuple[float, ...] = (0.011, 0.012, 0.013, 0.014, 0.015, 0.024, 0.05, 0.06, 0.13, 0.15, 0.17, 0.24, 0.4, 0.41, 0.8)
RESULT_KEYS: tuple[str, ...] = ('runoff', 'peak_runoff_rate', 'infiltration', 'evaporation')
SWMM_SIDE_EXTENSIONS: tuple[str, ...] = ('.inp', '.rpt', '.out')
TIMESERIES_KEYS: tuple[str, ...] = ('rainfall', 'runoff', 'infiltration_loss', 'evaporation_loss', 'runon')
calculate() dict[str, Any][source]

Run a simulation using the SWMM model and return the statistics of the subcatchment with the ID self.subcatchment_id.

Returns

dict

The statistics of the subcatchment.

calculate_timeseries() DataFrame[source]

Run a simulation and collect per-timestep data for the subcatchment.

Returns

pd.DataFrame

DataFrame with a DatetimeIndex (name "datetime") and columns corresponding to TIMESERIES_KEYS.

copy_file(copy: str | None = None, suffix: str = 'copy') str[source]

Create a copy of a SWMM input file with a suffix added to the end of the file name.

Parameters

copystr, optional

The path to the file you want to copy. If not specified, it will use the raw_file.

suffixstr, optional

The suffix to add to the end of the file name, defaults to ‘copy’.

Returns

str

The new path of the copied file.

get_section(section: str = 'subcatchments') DataFrame[source]

Get a specified section from a SWMM input file as a pandas DataFrame.

Parameters

sectionstr, optional

The name of the section you want to get, defaults to ‘subcatchments’.

Returns

pd.DataFrame

The section of the inp file as a pandas DataFrame.

simulate_area(start: float = 1, stop: float = 10, step: float = 1) DataFrame[source]

Simulate the area of the subcatchment within a specified range of values.

Parameters

startfloat, optional

The starting value of the area to be varied, defaults to 1.

stopfloat, optional

The maximum value of the area to be simulated, defaults to 10.

stepfloat, optional

The step size for the simulation, defaults to 1.

Returns

pd.DataFrame

A DataFrame containing the results of the simulation.

simulate_curb_length(start: float = 0, stop: float = 100, step: float = 10) DataFrame[source]

Simulate the curb length of a subcatchment within a specified range of values.

Parameters

startfloat, optional

The starting value of the curb length to be varied, defaults to 0.

stopfloat, optional

The maximum value of the curb length to be simulated, defaults to 100.

stepfloat, optional

The step size for the simulation, defaults to 10.

Returns

pd.DataFrame

A DataFrame containing the results of the simulation.

simulate_destore(param: str) DataFrame[source]

Simulate the model for various depths of depression storage on the given area.

Parameters

paramstr

The name of the feature for which the depth of depression storage should be varied.

Returns

pd.DataFrame

A DataFrame with the following columns: - runoff - peak_runoff_rate - infiltration - evaporation - Destore-param

simulate_manning_n(param: str) DataFrame[source]

Simulate a subcatchment using various Manning’s n values.

Parameters

paramstr

The name of the feature for which Manning’s n values should be varied.

Returns

pd.DataFrame

A DataFrame containing the results of the simulation.

simulate_n_imperv() DataFrame[source]

Simulate Manning’s n for impervious area.

Returns

pd.DataFrame

A DataFrame with the simulated values of Manning’s n for the impervious area.

simulate_n_perv() DataFrame[source]

Simulate Manning’s n for pervious area.

Returns

pd.DataFrame

A DataFrame with the simulated values of Manning’s n for the pervious area.

simulate_percent_impervious(start: float = 0, stop: float = 100, step: float = 10) DataFrame[source]

Simulate the percent impervious of a subcatchment within a specified range of values.

Parameters

startfloat, optional

The starting value of the percent impervious to be varied, defaults to 0.

stopfloat, optional

The maximum value of the percent impervious to be simulated, defaults to 100.

stepfloat, optional

The step size for the simulation, defaults to 10.

Returns

pd.DataFrame

A DataFrame containing the results of the simulation.

simulate_percent_slope(start: float = 0, stop: float = 100, step: float = 10) DataFrame[source]

Simulate the percent slope of a subcatchment within a specified range of values.

Parameters

startfloat, optional

The starting value of the percent slope to be varied, defaults to 0.

stopfloat, optional

The maximum value of the percent slope to be simulated, defaults to 100.

stepfloat, optional

The step size for the simulation, defaults to 10.

Returns

pd.DataFrame

A DataFrame containing the results of the simulation.

simulate_percent_zero_imperv(start: float = 0, stop: float = 100, step: float = 10) DataFrame[source]

Run a series of simulations with different percentages of impervious area with no depression storage.

Parameters

startfloat, optional

The starting value for the percent impervious, defaults to 0.

stopfloat, optional

The maximum percent impervious to test, defaults to 100.

stepfloat, optional

The step size for the percent impervious, defaults to 10.

Returns

pd.DataFrame

A DataFrame with the results of the simulation.

simulate_s_imperv() DataFrame[source]

Simulate the impervious depth of depression storage on area.

Returns

pd.DataFrame

A DataFrame with the simulated values of the impervious surface area.

simulate_s_perv() DataFrame[source]

Simulate the pervious depth of depression storage on area.

Returns

pd.DataFrame

A DataFrame with the simulated values of the S_perv variable.

simulate_subcatchment(feature: str, start: float = 0, stop: float = 100, step: float = 10) DataFrame[source]

Simulate a subcatchment with varying feature values using the SWMM model.

Parameters

featurestr

The name of the parameter to be varied in the simulation.

startfloat, optional

The starting value of the parameter, defaults to 0.

stopfloat, optional

The maximum value of the parameter to be simulated, defaults to 100.

stepfloat, optional

The step size for the simulation, defaults to 10.

Returns

pd.DataFrame

A DataFrame containing the results of the simulation.

simulate_subcatchment_timeseries(feature: str, start: float = 0, stop: float = 100, step: float = 10) dict[float, DataFrame][source]

Simulate a subcatchment with varying feature values, collecting timeseries.

Works like simulate_subcatchment() but returns per-timestep data instead of summary statistics.

Parameters

featurestr

The name of the parameter to be varied in the simulation.

startfloat, optional

The starting value of the parameter, defaults to 0.

stopfloat, optional

The maximum value of the parameter to be simulated, defaults to 100.

stepfloat, optional

The step size for the simulation, defaults to 10.

Returns

dict[float, pd.DataFrame]

Mapping of parameter values to DataFrames with timeseries data.

simulate_width(start: float = 0, stop: float = 100, step: float = 10) DataFrame[source]

Simulate the width of a subcatchment within a specified range of values.

Parameters

startfloat, optional

The starting value of the width to be varied, defaults to 0.

stopfloat, optional

The maximum value of the width to be simulated, defaults to 100.

stepfloat, optional

The step size for the simulation, defaults to 10.

Returns

pd.DataFrame

A DataFrame containing the results of the simulation.