Skip to content
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

Added nodes/pipes to excluded to the skel proc #384

Conversation

frank-hulo
Copy link
Contributor

Provide a summary of the proposed changes, describe tests and documentation, and review the acknowledgement below.
#347

Summary

Added nodes and links to exclude in the skelenazation process. It is handled in the same manner as the nodes and links with controls.

Tests and documentation

Test copied from nodes and links with controls, should have the same impact.

Two new inputs added to the initialization of the class, so they can be extended to the nodes -links with controls. They could also be separated, but the if statements and the three separate stages are fairly complex, so I didn't want to add another and to it.

Only the naming could now be improved in the if statements, instead nodes_with_controls -> nodes_to_exclude, which makes it easier to read.

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.

@coveralls
Copy link

Coverage Status

coverage: 84.406% (+0.002%) from 84.404% when pulling da2b52d on HULO-ai:enhancement/fvdh_exclude_nodes_pipes_during_skelentonization into b841f07 on USEPA:main.

@kaklise
Copy link
Collaborator

kaklise commented Oct 10, 2023

Thanks for adding this feature! Since tanks and reservoirs are not included in skeletonization, I suggest changing the term node to junction in the updated code and documentation. I'll make some notes in the code review. Also, I agree that junc_with_controls and pipe_with_controls should be renamed to juncs_to_exclude, pipes_to_exclude in the skeletonization method.

@@ -82,6 +82,7 @@ This initial set of operations can generate new branch pipes, pipes in series, a
This cycle repeats until the network can no longer be reduced.
The user can specify if branch trimming, series pipe merge, and/or parallel pipe merge should be included in the skeletonization operations.
The user can also specify a maximum number of cycles to include in the process.
The user can also specify a list of nodes and pipes which should be excluded from skeletonization operations.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change nodes to junctions

@@ -43,6 +44,10 @@ def skeletonize(wn, pipe_diameter_threshold, branch_trim=True, series_pipe_merge
use_epanet: bool, optional
If True, use the EpanetSimulator to compute headloss in pipes.
If False, use the WNTRSimulator to compute headloss in pipes.
pipes_to_exclude: list, optional
List of pipe names to exclude from skeletonization
nodes_to_exclude: list, optional
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename nodes_to_exclude to juncs_to_exclude

self.pipe_with_controls = list(set(pipe_with_controls))
self.pipe_with_controls.extend(pipes_to_exclude)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename self.juncs_with_controls to self.juncs_to_exclude
rename self.pipe_with_controls to self.pipes_to_exclude


self.assertEqual(skel_wn.num_nodes, wn.num_nodes - 17)
self.assertEqual(skel_wn.num_links, wn.num_links - 22)

def test_series_merge_properties(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test would be stronger by asserting that pipe 60 and junction 13 are in skel_wn.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frank-hulo Will you be able to address the review comments? If not, we can make the minor updates in house.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaklise I could finish it within the next two weeks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frank-hulo We'd like to get this PR merged into main. Let me know if you can address the comments. I can finish it up next week if needed.

:class:`~wntr.network.model.WaterNetworkModel`
A water network model object
tuple
A tuple of two elements: a dictionary (OrderedDict) of sections, and a list of top comments

Copy link
Collaborator

@kaklise kaklise Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the changes in io.py were intended for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants