-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug when to_gis() is called on a network with a leak #458
Conversation
wntr/tests/test_network.py
Outdated
junction_name = wn.junction_name_list[0] | ||
junction = wn.get_node(junction_name) | ||
junction.add_leak(wn, area=1, start_time=0, end_time=3600) | ||
wn.to_dict() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest adding from_dict
to make sure the leak can be recreated in a water network model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
…creating geojsons instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes all look good.
This PR addresses the bug reported in #456.
Summary
to_dict
method for controls so that the case when the target object is a Node can be handled._read_control_line
for Nodes. Previously only link elements were expected.from_dict
Tests and documentation
A test case is added that runs
to_dict
on a network with a leak and verifies that the leak controls and attributes persist after the dictionary representation is read back in withfrom_dict
.Acknowledgement
By contributing to this software project, I acknowledge that I have reviewed the software quality assurance guidelines and that my contributions are submitted under the Revised BSD License.