ra2ce.network.avg_speed package#
Submodules#
ra2ce.network.avg_speed.avg_speed module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class AvgSpeed(default_speed=50.0, speed_per_road_type=<factory>)[source]#
Bases:
object
- Parameters:
default_speed (float)
speed_per_road_type (defaultdict[RoadTypeEntry, float])
-
default_speed:
float
= 50.0#
- get_avg_speed(road_type)[source]#
- Return type:
float
- Parameters:
road_type (list[RoadTypeEnum])
- static get_road_type_list(road_type)[source]#
- Return type:
list
[RoadTypeEnum
] |None
- Parameters:
road_type (str | list[str] | None)
- property road_types: list[list[RoadTypeEnum]]#
- set_avg_speed(road_type, avg_speed)[source]#
- Return type:
None
- Parameters:
road_type (list[RoadTypeEnum])
avg_speed (float)
-
speed_per_road_type:
defaultdict
[RoadTypeEntry
,float
]#
- class RoadTypeEntry(road_type)[source]#
Bases:
object
- Parameters:
road_type (list[RoadTypeEnum])
-
road_type:
list
[RoadTypeEnum
]#
ra2ce.network.avg_speed.avg_speed_calculator module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class AvgSpeedCalculator(graph, link_type_column, output_graph_dir)[source]#
Bases:
object
Class to calculate the average speed of a road network based on the maximum speed of the roads.
- Parameters:
graph (Graph)
link_type_column (str)
output_graph_dir (Path | None)
- assign()[source]#
Assigns the average speed and time to roads in an existing (OSM) graph. If a road does not have a ‘maxspeed’ attribute, the average speed will be assigned based on the road type.
Args: None
- Return type:
Graph
- Returns:
graph (NetworkX graph): NetworkX graph with an additional attribute ‘avgspeed’ and ‘time’
-
graph:
Graph
#
-
link_type_column:
str
#
- static parse_speed(speed_input)[source]#
Parse the average speed from the input string(s).
- Return type:
float
- Parameters:
speed_input (float | str | list[str])
- Args:
- speed_input (float | str | list[str]): (List of) string(s) with the speed(s).
Can have different formats, e.g. nan(float), 30.0, “50 mph”, “50”, “50;60”, “50-60”, “50|60”.
- Returns:
- float: Average speed of the input string(s).
0.0 is returned if the input is empty or can’t be parsed correctly.
ra2ce.network.avg_speed.avg_speed_reader module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class AvgSpeedReader(*args, **kwargs)[source]#
Bases:
FileReaderProtocol
ra2ce.network.avg_speed.avg_speed_writer module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class AvgSpeedWriter(*args, **kwargs)[source]#
Bases:
Ra2ceExporterProtocol