Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the package to generate an UDN #381

Open
AnuPal1Hydro123 opened this issue Mar 5, 2025 · 3 comments
Open

Using the package to generate an UDN #381

AnuPal1Hydro123 opened this issue Mar 5, 2025 · 3 comments

Comments

@AnuPal1Hydro123
Copy link

Hi

I want to use this package to generate an Urban Drainage network shapefile for Houston City, Texas and want to compare it with the real drainage network and Manholes. I do not wish to use SWMM model and will probably go with other models. Any advice on how to do this? Thank you

@barneydobson
Copy link
Collaborator

Hi @AnuPal1Hydro123 , thanks for the question. I would suggest starting with running with --verbose=True (if you are using the CLI). This will save each set of graphs to your specified base_dir (within the file structure, so it will actually be <base_dir>/<project>/bbox_1/model_1), including the final graph that matches the SWMM model (nodes.geojson and edges.geojson). Inspect these geojsons and see if they are suitable for your purposes, they will be dimensioned and with chamber floor depths. Note, Houston is massive, so definitely try this out on a much smaller area until you are happy with the results!

Also, if you don't want to run the model in SWMM, you will soon be able to switch this behaviour off by setting run_model: False in your config file, once I merge #383 , should be pretty quick.

@AnuPal1Hydro123
Copy link
Author

Image

Hi

I have two questions. On LHS figure, the generated network (edge) is quite similar to the existing road network. Is there any specific reason for this? Also, I found there is huge overprediction of nodes as compared to Real nodes , and some of them have crossed the bounding polygon. Is there a way to modify this? Thank you

@barneydobson
Copy link
Collaborator

barneydobson commented Mar 6, 2025

Regarding the similarity to road network, this is by design, see the paper for more details.

Regarding the density of nodes, this is parameterised behaviour that can be edited. If you want less dense nodes then you will want to do things such as add the following to your config file:

parmameter_overrides:
  subcatchment_derivation:
    max_street_length: 80
    node_merge_distance: 20

See this part of the extended demo for more details.

And regarding crossing the boundary polygon, this will need clipping to a custom area. This will be behaviour I will add to the full package in due course, but for now you can use the following graph function:

import networkx as nx

from swmmanywhere.graph_utilities import BaseGraphFunction, register_graphfcn
from swmmanywhere.metric_utilities import nodes_to_subs


@register_graphfcn
class trim_to_real(BaseGraphFunction):
    """Trim to real outline."""

    def __init__(self):
        """Initialise the class."""
        super().__init__()
        self.required_node_attributes = ["x", "y"]

    def __call__(self, G: nx.Graph, **kwargs) -> nx.Graph:
        """Call the graph function."""
        outline = gpd.read_file(</path/to/outline.geojson>)
        nodes_joined = nodes_to_subs(G, outline)
        G = G.subgraph(nodes_joined.id).copy()
        return G

You will need to follow the instructions on adding a custom graphfcn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants