Skip to content

Commit

Permalink
Update graph_utilities.py
Browse files Browse the repository at this point in the history
more verbosity
  • Loading branch information
Dobson committed Apr 29, 2024
1 parent d8cddb1 commit 2ccf95c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions swmmanywhere/graph_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ def iterate_graphfcns(G: nx.Graph,
logger.info(f"graphfcn: {function} completed.")
if verbose:
save_graph(G, addresses.model / f"{function}_graph.json")
go.graph_to_geojson(G,
addresses.model / f"{function}_nodes.geojson",
addresses.model / f"{function}_edges.geojson",
G.graph['crs']
)

return G

@register_graphfcn
Expand Down Expand Up @@ -1114,6 +1120,11 @@ def __call__(self, G: nx.Graph,
G.remove_node(node)
del paths[node], shortest_paths[node]

if len(G.nodes) == 0:
raise ValueError("""No nodes with path to outlet, consider
broadening bounding box or removing trim_to_outlet
from config graphfcn_list""")

edges_to_keep: set = set()
for path in paths.values():
# Assign outlet
Expand Down

0 comments on commit 2ccf95c

Please sign in to comment.