Skip to content

Commit

Permalink
remove change from another branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobson committed May 9, 2024
1 parent 7485b79 commit f0b4c17
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
22 changes: 0 additions & 22 deletions swmmanywhere/graph_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 0 additions & 20 deletions tests/test_graph_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit f0b4c17

Please sign in to comment.