You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to change the name attribute of junctions and pipes?
For example, if I want to change junctions id that contains 'NN' to 'J'
When using the following code, the output inp file will change the junction names in the PIPES section but not in the JUNCTIONS section. (COORDINATES section is also not changed)
for junction_name, junction in self.wn.junctions():
junction._name = junction_name.replace(NN, J)
So you are correct - this is not implemented. The main reason is because there are multiple places where a name might need to be changed, thus disconnecting things and breaking the simulation. However, we can look into making it so this can happen.
That said, it is weird that the junction name doesn't pass through to the junctions section... that shouldn't be able to happen...
Let me look into this more
@GalPerelman I did find the issue. I will need to make a function to perform a rename for nodes and links. The registries for nodes, links, patterns and sources, all use the name of the originally created junction/link/etc. as a key index. That is what gets looped over when you call (for node in wn.node_names), for example. So even though the internal name is changed, you can't actually find that new name in the registry, and it pulls out the old name. But for links, it's getting the internal name for the end nodes. So I will go in and make that change, though it may be a few days for a PR to go all the way up.
@dbhart Thanks for your response and the suggested solution, it seems that this will do the work for my needs
Let me know if there is anything I can do to help
Is it possible to change the name attribute of junctions and pipes?
For example, if I want to change junctions id that contains 'NN' to 'J'
When using the following code, the output inp file will change the junction names in the PIPES section but not in the JUNCTIONS section. (COORDINATES section is also not changed)
When trying to use
junction.name
instead ofjunction._name
AttributeError is raisedAttributeError: can't set attribute
The text was updated successfully, but these errors were encountered: