diff --git a/swmmanywhere/graph_utilities.py b/swmmanywhere/graph_utilities.py index f8754dc1..c15a0016 100644 --- a/swmmanywhere/graph_utilities.py +++ b/swmmanywhere/graph_utilities.py @@ -913,28 +913,6 @@ def __call__(self, # Copy graph to run shortest path on G_ = G.copy() - if not matched_outlets: - # In cases of e.g., an area with no rivers to discharge into or too - # small a buffer - - # Identify the lowest elevation node - lowest_elevation_node = min(G.nodes, - key = lambda x: G.nodes[x]['surface_elevation']) - - # Create a dummy river to discharge into - dummy_river = {'id' : 'dummy_river', - 'x' : G.nodes[lowest_elevation_node]['x'] + 1, - 'y' : G.nodes[lowest_elevation_node]['y'] + 1} - G_.add_node('dummy_river') - nx.set_node_attributes(G_, {'dummy_river' : dummy_river}) - - # Update function's dicts - matched_outlets = {'dummy_river' : lowest_elevation_node} - river_points['dummy_river'] = shapely.Point(dummy_river['x'], - dummy_river['y']) - - logger.warning('No outlets found, using lowest elevation node as outlet') - # Add edges between the paired river and street nodes for river_id, street_id in matched_outlets.items(): # TODO instead use a weight based on the distance between the two nodes diff --git a/tests/test_graph_utilities.py b/tests/test_graph_utilities.py index cbd3b0a1..62b0b159 100644 --- a/tests/test_graph_utilities.py +++ b/tests/test_graph_utilities.py @@ -177,26 +177,6 @@ def test_calculate_weights(): for u, v, data in G.edges(data=True): assert 'weight' in data.keys() assert math.isfinite(data['weight']) - -def test_identify_outlets_no_river(): - """Test the identify_outlets in the no river case.""" - G, _ = load_street_network() - G = gu.assign_id(G) - G = gu.double_directed(G) - elev_fid = Path(__file__).parent / 'test_data' / 'elevation.tif' - addresses = parameters.FilePaths(base_dir = None, - project_name = None, - bbox_number = None, - model_number = None) - addresses.elevation = elev_fid - G = gu.set_elevation(G, addresses) - for ix, (u,v,d) in enumerate(G.edges(data=True)): - d['edge_type'] = 'street' - d['weight'] = ix - params = parameters.OutletDerivation() - G = gu.identify_outlets(G, params) - outlets = [(u,v,d) for u,v,d in G.edges(data=True) if d['edge_type'] == 'outlet'] - assert len(outlets) == 1 def test_identify_outlets_and_derive_topology(): """Test the identify_outlets and derive_topology functions."""