From 2ccf95c574517e5ec28c3749a1ceff796d304aad Mon Sep 17 00:00:00 2001 From: Dobson Date: Mon, 29 Apr 2024 15:47:37 +0100 Subject: [PATCH] Update graph_utilities.py more verbosity --- swmmanywhere/graph_utilities.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/swmmanywhere/graph_utilities.py b/swmmanywhere/graph_utilities.py index 16c9ad40..f4d62923 100644 --- a/swmmanywhere/graph_utilities.py +++ b/swmmanywhere/graph_utilities.py @@ -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 @@ -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