Deltares / ra2ce

RA2CE helps to quantify resilience of critical infrastructure networks, prioritize interventions and adaptation measures and select the most appropriate action perspective to increase resilience considering future conditions.
https://deltares.github.io/ra2ce/
Other
9 stars 2 forks source link

Being able to load a network without hazard overlay in case that is not required #533

Open ArdtK opened 1 month ago

ArdtK commented 1 month ago

Ra2ce version checks

Reproducible example

_graph_files = GraphFilesCollection(
        base_graph=GraphFile(
            name="base_graph",
            folder=_base_graph_dir,
            graph=read_pickle(_base_graph_dir / "base_graph.p"),
            ),
        origins_destinations_graph=GraphFile(
            name="origins_destinations_graph",
            folder=_base_graph_dir,
            graph=read_pickle(_base_graph_dir / "origins_destinations_graph.p"),
            ),
    )

_network = NetworkConfigData()
_network.hazard.overlay_segmented_network = False
_analysis = AnalysisConfigData()
_handler = Ra2ceHandler(_network, _analysis)
_handler.input_config.network_config.graph_files = _ graph_files
_handler.configure()

Current behaviour

Currently next to the base_graph also the segmented base_network is assumed to be present if you pass the base_graph as input to the configure(). Also in case the network config option create_segmented_graph is set to False.

Desired behaviour

In case the network config option create_segmented_graph is set to False no base_graph is not required.

Additional context

In _get_stored_network_and_graph it crashes on: _network_gdf = get_graph("base_network", base_network_filepath)