Output.subcatch_result¶
- Output.subcatch_result(subcatchment, time, asframe=True)[source]¶
For a subcatchment at one or more given times, get all attributes.
Only one of subcatchment or time can be multiple (eg. a list), not both.
- Parameters:
- subcatchment: Union[int, str, Sequence[Union[int, str]], None],
The subcatchment(s) name(s) or index(s).
- time: Union[int, str, Sequence[Union[int, str]], None],
THe datetime(s) or simulation index(s).
- asframe: bool
A switch to return an indexed DataFrame. Set to False to get an array of values only, defaults to True.
- Returns:
- Union[pd.DataFrame,np.ndarray]
A DataFrame or ndarray of all attribute values subcatchment(s) at given time(s).
Examples
Pull all attributes at start, middle, and end time steps for a single catchment
>>> from swmm.pandas import Output,example_out_path >>> out = Output(example_out_path) >>> out.subcatch_result("SUB1",[0,out.period/2,out.period-1]) rainfall snow_depth evap_loss infil_loss ... soil_moisture groundwater pol_rainfall sewage datetime ... 1900-01-01 00:05:00 0.030 0.0 0.0 0.020820 ... 0.276035 0.0 0.0 0.0 1900-01-01 12:05:00 1.212 0.0 0.0 0.594862 ... 0.281631 0.0 100.0 0.0 1900-01-02 00:00:00 0.000 0.0 0.0 0.027270 ... 0.280026 0.0 100.0 0.0 [3 rows x 11 columns]
Pull all attributes for all catchments at the start of the simulation
>>> from swmm.pandas import Output,example_out_path >>> out = Output(example_out_path) >>> out.subcatch_result(out.subcatchments,'1900-01-01') rainfall snow_depth evap_loss infil_loss ... soil_moisture groundwater pol_rainfall sewage subcatchment ... SUB1 0.03 0.0 0.0 0.020820 ... 0.276035 0.0 0.0 0.0 SUB2 0.03 0.0 0.0 0.017824 ... 0.275048 0.0 0.0 0.0 SUB3 0.03 0.0 0.0 0.011365 ... 0.279013 0.0 0.0 0.0 [3 rows x 11 columns]