wntr.morph.skel module

The wntr.morph.skel module contains functions to skeletonize water network models.

wntr.morph.skel.skeletonize(wn, pipe_diameter_threshold, branch_trim=True, series_pipe_merge=True, parallel_pipe_merge=True, max_cycles=None, use_epanet=True, return_map=False, return_copy=True)[source]

Perform network skeletonization using branch trimming, series pipe merge, and parallel pipe merge operations. Candidate pipes for removal is based on a pipe diameter threshold.

Parameters
  • wn (wntr WaterNetworkModel) – Water network model

  • pipe_diameter_threshold (float) – Pipe diameter threshold used to determine candidate pipes for skeletonization

  • branch_trim (bool, optional) – If True, include branch trimming in skeletonization

  • series_pipe_merge (bool, optional) – If True, include series pipe merge in skeletonization

  • parallel_pipe_merge (bool, optional) – If True, include parallel pipe merge in skeletonization

  • max_cycles (int or None, optional) – Maximum number of cycles in the skeletonization process. One cycle performs branch trimming for all candidate pipes, followed by series pipe merging for all candidate pipes, followed by parallel pipe merging for all candidate pipes. If max_cycles is set to None, skeletonization will run until the network can no longer be reduced.

  • use_epanet (bool, optional) – If True, use the EpanetSimulator to compute headloss in pipes. If False, use the WNTRSimulator to compute headloss in pipes.

  • return_map (bool, optional) – If True, return a skeletonization map. The map is a dictionary that includes original nodes as keys and a list of skeletonized nodes that were merged into each original node as values.

  • return_copy (bool, optional) – If True, modify and return a copy of the WaterNetworkModel object. If False, modify and return the original WaterNetworkModel object.

Returns

  • wntr WaterNetworkModel – Skeletonized water network model

  • dictionary – Skeletonization map (if return_map = True) which includes original nodes as keys and a list of skeletonized nodes that were merged into each original node as values.