-
I have a SWMM model with the Tag field populated for several links. Is it possible to report/include that value in the data frame? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@aerispaha - any thoughts? |
Beta Was this translation helpful? Give feedback.
-
Hey @bowguy, what you're trying to do makes a lot of sense. I could see this being useful in several situations. Currently, the import swmmio
from swmmio.examples import streets
# get a dataframe of tags using the inp object
tags = streets.inp.tags
# to make this easy to join to a Links dataframe, set the index to the Name column
tags = tags.set_index('Name')
tags
# create a Links dataframe with the columns we're interested in.
# keeping things simple here for demonstration purposes
links = swmmio.elements.Links(
model=streets,
inp_sections=['conduits', 'outlets'],
columns=['InletNode', 'OutletNode']
)
# join the tags dataframe to the links dataframe
links.dataframe.join(tags)
Does that do the trick for you for now? In the future, we might consider including tags in the nodes and links dataframe more easily or be default. |
Beta Was this translation helpful? Give feedback.
Hey @bowguy, what you're trying to do makes a lot of sense. I could see this being useful in several situations.
Currently, the
swmmio.elements.Links
object won't do this out of the box for us though. The main reason is the quirk in the [TAGS] section of the INP file in which the first column stores the Element Type (e.g. Link, Node). However, there is a fairly painless work around to achieve what I think you're after. We can join the [TAGS] dataframe after creating Links dataframe. I'll use thestreets
example model to demonstrate what I mean: