Output.node_attribute¶
- Output.node_attribute(time, attribute=('invert_depth', 'flooding_losses', 'total_inflow'), asframe=True)[source]¶
For all nodes at a given time, get one or more attributes.
- Parameters:
- time: Union[str, int, datetime]
The datetime or simulation index for which to pull data, defaults to None
- attribute: int | str | EnumMeta | Sequence[int | str | EnumMeta] | None,
The attribute index or name.
On of:
invert_depth, hydraulic_head, ponded_volume, lateral_inflow, total_inflow, flooding_losses.
defaults to: (‘invert_depth’,’flooding_losses’,’total_inflow’)
Can also input the integer index of the attribute you would like to pull or the actual enum from Output.node_attributes.
Setting to None indicates all attributes.
- 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 attribute values in each column for requested simulation time.
Examples
Pull all attributes from middle of simulation
>>> from swmm.pandas import Output,example_out_path >>> out = Output(example_out_path) >>> out.node_attribute(out.period/2) invert_depth hydraulic_head ponded_volume ... groundwater pol_rainfall sewage node ... JUNC1 8.677408 10.177408 0.000000 ... 0.260937 99.739067 0.000000 JUNC2 4.286304 3.246305 0.000000 ... 0.366218 96.767433 2.475719 JUNC3 11.506939 8.036940 35.862713 ... 0.615687 94.522049 4.862284 JUNC4 14.936149 9.686150 6107.279785 ... 0.381425 96.532028 3.086555 JUNC5 11.190232 4.690233 0.000000 ... 0.443388 95.959351 3.597255 JUNC6 1.650765 1.650765 0.000000 ... 0.963940 91.113075 7.922997 OUT1 0.946313 1.046313 0.000000 ... 0.969624 91.060143 7.970241 OUT2 0.000000 -1.040001 0.000000 ... 0.367271 96.756134 2.479369 STOR1 18.282972 3.032968 7550.865723 ... 0.961457 91.136200 7.902364 [9 rows x 9 columns]