Skip to content

Commit

Permalink
Add river/street graph combine
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobson committed Feb 9, 2024
1 parent 26d1aaf commit 5eab0d0
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion swmmanywhere/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pathlib import Path

import geopandas as gpd
import networkx as nx
import pandas as pd

from swmmanywhere import geospatial_utilities as go
Expand Down Expand Up @@ -242,4 +243,21 @@ def run_downloads(bbox: tuple[float, float, float, float],
target_crs)
gu.save_graph(river_network, addresses.river)
else:
print('river network already exists')
print('river network already exists')

def create_starting_graph(addresses: parameters.FilePaths):
"""Create the starting graph.
Create the starting graph by combining the street and river networks.
Args:
addresses (FilePaths): Class containing the addresses of the directories.
Returns:
nx.Graph: Combined street and river network.
"""
river = gu.load_graph(addresses.river)
nx.set_edge_attributes(river, 'river', 'edge_type')
street = gu.load_graph(addresses.street)
nx.set_edge_attributes(street, 'street', 'edge_type')
return nx.compose(river, street)

0 comments on commit 5eab0d0

Please sign in to comment.