Output.link_result¶
- Output.link_result(link, time, asframe=True)[source]¶
For a link at one or more given times, get all attributes.
Only one of link or time can be multiple.
- Parameters:
- link: Union[int, str, Sequence[Union[int, str]], None],
The link(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 link(s) at given time(s).
Examples
Pull all attributes at start, middle, and end time steps for a single link
>>> from swmm.pandas import Output,example_out_path >>> out = Output(example_out_path) >>> out.link_result("COND1",[0,out.period/2,out.period-1]) flow_rate flow_depth flow_velocity flow_volume capacity groundwater pol_rainfall sewage datetime 1900-01-01 00:05:00 0.000031 0.053857 0.001116 23.910770 0.024351 79.488449 0.000000 0.000000e+00 1900-01-01 12:05:00 2.665548 1.000000 3.393882 732.276428 1.000000 0.491514 99.142815 2.742904e-01 1900-01-02 00:00:00 0.037800 0.312581 0.180144 212.443344 0.267168 32.083355 67.963829 5.049533e-08
Pull all attributes for all links at the start of the simulation
>>> from swmm.pandas import Output,example_out_path >>> out = Output(example_out_path) >>> out.link_result(out.links,'1900-01-01') flow_rate flow_depth flow_velocity flow_volume capacity groundwater pol_rainfall sewage link COND1 0.000031 0.053857 0.001116 23.910770 0.024351 79.488449 0.0 0.000000 COND2 0.000000 0.000100 0.000000 0.074102 0.000161 0.000000 0.0 0.000000 COND3 0.000000 0.000100 0.000000 0.076337 0.000113 0.000000 0.0 0.000000 COND4 0.027627 0.038128 0.304938 49.596237 0.026561 3.034879 0.0 86.882553 COND5 0.000000 0.000100 0.000000 0.012962 0.000127 0.000000 0.0 0.000000 COND6 0.000000 0.000100 0.000000 0.000404 0.000014 0.000000 0.0 0.000000 PUMP1 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.0 0.000000 WR1 0.000000 0.000000 0.000000 0.000000 1.000000 3.935642 0.0 95.884094