diff --git a/swmmanywhere/preprocessing.py b/swmmanywhere/preprocessing.py index 4d5c5416..f0357a74 100644 --- a/swmmanywhere/preprocessing.py +++ b/swmmanywhere/preprocessing.py @@ -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 @@ -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') \ No newline at end of file + 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) \ No newline at end of file