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
7 stars 1 forks source link

As a user I want to initialize an analysis with just the graph and gdf files. #487

Open Carsopre opened 2 weeks ago

Carsopre commented 2 weeks ago

Kind of request

Enhancement / new feature.

Enhancement Description

Given the classic output of the network package, ( networkx.MultiGraph and GeoDataFrame), it should be possible to initialize the AnalysisConfigWrapper directly and run an analysis straight after. In addition, we would also like to do the same from the corresponding files ( networkx.GraphFile, gpd file).

Use case

# 1. Get a network from a polygon.
_graph,_gdf = OsmNetworkWrapper.get_network_from_polygon(_network_config_data, polygon)

# 2. Generate the analysis wrapper.
_analysis_wrapper = AnalysisConfigWrapper.from_graph_and_network(_graph, gdf)
# Extra: 
# Allow to get the analysis config wrapper directly from the polygon / geojson?
# _analysis_wrapper = AnalysisConfigWrapper.from_polygon(_network_config_data, polygon)
# Allow to get the analysis config wrapper from files (skips step 1)
# _network_config = NetworkConfigWrapper.from_files(graph_file, gpd_file)
# _analysis_wrapper = AnalysisConfigWrapper.from_network_config(_network_config)

# ??. Potentially minimal modifications to set up some input / output paths?

# 3. Run analysis.
Ra2ceHandler.run_from_analysis_config_wrapper(_analysis_wrapper).

Additional Context

This issue comes as a pre-request from the intertwin team.