ra2ce.network.hazard package#
Subpackages#
- ra2ce.network.hazard.hazard_intersect package
- Submodules
- ra2ce.network.hazard.hazard_intersect.hazard_intersect_builder_base module
- ra2ce.network.hazard.hazard_intersect.hazard_intersect_builder_for_gpkg module
- ra2ce.network.hazard.hazard_intersect.hazard_intersect_builder_for_table module
- ra2ce.network.hazard.hazard_intersect.hazard_intersect_builder_for_tif module
- ra2ce.network.hazard.hazard_intersect.hazard_intersect_builder_protocol module
- Module contents
Submodules#
ra2ce.network.hazard.hazard_common_functions 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/>.
- get_edges_geoms(graph)[source]#
Gets all edges geometry from a provided graph.
- Return type:
list
- Parameters:
graph (Graph)
- validate_extent_graph(extent_graph, tif_hazard_file)[source]#
- Return type:
None
- Parameters:
extent_graph (list[float])
tif_hazard_file (Path)
Validates the given extent graph to a hazard file (*.tif)
- Args:
extent_graph (list[float]): List of boundary points determening the extent of a graph. tif_hazard_file (Path): Hazard (*.tif) file.
- Raises:
ValueError: When the hazard raster and the graph geometries do not overlap.
ra2ce.network.hazard.hazard_files 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 HazardFiles(tif=<factory>, gpkg=<factory>, table=<factory>)[source]#
Bases:
object
- Parameters:
tif (list[Path])
gpkg (list[Path])
table (list[Path])
- classmethod from_hazard_map(hazard_map)[source]#
Create a HazardFiles object from a list of hazard map files.
- Return type:
- Parameters:
hazard_map (list[Path])
- Args:
hazard_map (list[Path]): _description_
- Returns:
HazardFiles: _description_
-
gpkg:
list
[Path
]#
-
table:
list
[Path
]#
-
tif:
list
[Path
]#
ra2ce.network.hazard.hazard_names 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 HazardNames(names_df)[source]#
Bases:
object
- Parameters:
names_df (DataFrame)
- classmethod from_config(analysis_config)[source]#
Create a HazardNames object from an analysis configuration.
- Return type:
- Parameters:
analysis_config (AnalysisConfigWrapper)
- Args:
analysis_config (AnalysisConfigWrapper): Analysis configuration.
- Returns:
HazardNames: HazardNames object.
- classmethod from_file(hazard_names_file)[source]#
Create a HazardNames object from a file.
- Return type:
- Parameters:
hazard_names_file (Path | None)
- Args:
hazard_names_file (Path): Path to the files with the hazard names.
- Returns:
HazardNames: HazardNames object.
- get_name(hazard)[source]#
Get the RA2CE name of a specific hazard.
- Return type:
str
- Parameters:
hazard (str)
- Args:
hazard (str): Name of the hazard.
- Returns:
str: RA2CE name of the hazard.
- property names: list[str]#
Get the list of hazard names.
- Returns:
list[str]: List of hazard names.
-
names_df:
DataFrame
#
ra2ce.network.hazard.hazard_overlay 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 HazardOverlay(config, graph_files)[source]#
Bases:
object
Class where the hazard overlay happens.
- Attributes:
network: GeoDataFrame of the network. graph_files: NetworkX graphs.
- Parameters:
config (NetworkConfigData)
graph_files (GraphFilesCollection)
- create()[source]#
Overlays the different possible graph and network objects with the hazard data
- Arguments:
None (implicit) : (self.graphs_files) : GraphFile object with the graph names and files as attributes
- Returns:
self.graph_files : same object, but with new graphs _hazard, which are copies of the graphs but with hazard data
- Effect:
write all the objects
- get_original_geoms_graph(graph_original, graph_new)[source]#
- Parameters:
graph_original (MultiGraph)
- get_point_hazard_from_network(points, network)[source]#
get hazard informations for points at nearest network locations.
- Return type:
GeoDataFrame
- Parameters:
points (GeoDataFrame)
network (GeoDataFrame)
- Args:
points (gpd.GeoDataFrame): points of interest, will be snapped to the network by nearest distance method. network (gpd.GeoDataFrame): network of interest
- Returns:
gpd.GeoDataFrame: points with relation to network and hazard informations
- Raise:
error: if node id columns do not exisit in the network
- get_reproject_graph(original_graph, in_crs, out_crs)[source]#
Reproject networkX graph
- Return type:
Graph
- Parameters:
original_graph (Graph)
in_crs (CRS)
out_crs (CRS)
- hazard_intersect(to_overlay)[source]#
Handler function that chooses the right function for overlaying the network with the hazard data.
- Return type:
GeoDataFrame
|Graph
- Parameters:
to_overlay (GeoDataFrame | Graph)
- od_hazard_intersect(graph, ods)[source]#
Overlays the origin and destination locations and edges with the hazard maps
- Return type:
tuple
[Graph
,GeoDataFrame
]- Parameters:
graph (Graph)
ods (GeoDataFrame)
- Args:
graph (NetworkX graph): The origin-destination graph that should be overlayed with the hazard raster(s)
- Returns:
graph (NetworkX graph): The origin-destination graph hazard raster(s) data joined to both the origin- and destination nodes and the edges.