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

direct_damage example fails when residential roads are not included #435

Closed sahand-asgarpour closed 1 month ago

sahand-asgarpour commented 3 months ago

Ra2ce version checks

Reproducible example

in the example_direct_damage, remove the residential from the road_types of the network.ini.

Current behaviour

Then direct_damage crashes during the analysis at:

direct_utils

dictionary = dict(gdf.groupby("road_type")["lanes"].agg(pd.Series.mode))

Desired behaviour

Carles: Simply log that no information was found for this road type and continue. In addition, try to create a failing test for easiness is issue reproduction.

Additional context

No response

ArdtK commented 1 month ago

Huizinga case

from ra2ce.ra2ce_handler import Ra2ceHandler from ra2ce.network.network_config_data.network_config_data_reader import NetworkConfigDataReader from ra2ce.analysis.analysis_config_data.analysis_config_data_reader import AnalysisConfigDataReader

Load network data.

_network_config_data = NetworkConfigDataReader().read(root_dir.joinpath("network.ini")) _road_types = [_rt for _rt in _network_config_data.network.road_types if _rt.name != "RESIDENTIAL"] _network_config_data.network.road_types = _road_types

Load analysis data.

_analysis_config_data = AnalysisConfigDataReader().read(root_dir.joinpath("analysis.ini"))

_analysis_config_data.input_path = root_dir.joinpath("input_analysis_data")