ra2ce.network.network_wrappers package#
Subpackages#
- ra2ce.network.network_wrappers.osm_network_wrapper package
- Submodules
- ra2ce.network.network_wrappers.osm_network_wrapper.extremities_data module
- ra2ce.network.network_wrappers.osm_network_wrapper.osm_network_wrapper module
OsmNetworkWrapperOsmNetworkWrapper.drop_duplicates()OsmNetworkWrapper.drop_duplicates_in_edges()OsmNetworkWrapper.drop_duplicates_in_nodes()OsmNetworkWrapper.get_clean_graph()OsmNetworkWrapper.get_network()OsmNetworkWrapper.get_network_from_geojson()OsmNetworkWrapper.get_network_from_polygon()OsmNetworkWrapper.network_typeOsmNetworkWrapper.polygon_graphOsmNetworkWrapper.road_typesOsmNetworkWrapper.snap_nodes_to_edges()OsmNetworkWrapper.snap_nodes_to_nodes()OsmNetworkWrapper.with_polygon()
- ra2ce.network.network_wrappers.osm_network_wrapper.osm_utils module
- Module contents
Submodules#
ra2ce.network.network_wrappers.network_wrapper_factory 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 NetworkWrapperFactory(config_data)[source]#
Bases:
NetworkWrapperProtocol- Parameters:
config_data (NetworkConfigData)
- get_network()[source]#
Gets a network built within this wrapper instance. No arguments are accepted, the __init__ method is meant to assign all required attributes for a wrapper.
- Return type:
tuple[MultiGraph,GeoDataFrame]
- Returns:
tuple[MultiGraph, GeoDataFrame]: Tuple of MultiGraph representing the graph and GeoDataFrame representing the network.
ra2ce.network.network_wrappers.network_wrapper_protocol 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 NetworkWrapperProtocol(*args, **kwargs)[source]#
Bases:
Protocol- get_network()[source]#
Gets a network built within this wrapper instance. No arguments are accepted, the __init__ method is meant to assign all required attributes for a wrapper.
- Return type:
tuple[MultiGraph,GeoDataFrame]
- Returns:
tuple[MultiGraph, GeoDataFrame]: Tuple of MultiGraph representing the graph and GeoDataFrame representing the network.
ra2ce.network.network_wrappers.shp_network_wrapper 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 ShpNetworkWrapper(config_data)[source]#
Bases:
NetworkWrapperProtocol- Parameters:
config_data (NetworkConfigData)
- get_network()[source]#
Gets a network built within this wrapper instance. No arguments are accepted, the __init__ method is meant to assign all required attributes for a wrapper.
- Return type:
tuple[MultiGraph,GeoDataFrame]
- Returns:
tuple[MultiGraph, GeoDataFrame]: Tuple of MultiGraph representing the graph and GeoDataFrame representing the network.
ra2ce.network.network_wrappers.trails_network_wrapper 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 TrailsNetworkWrapper(config_data)[source]#
Bases:
NetworkWrapperProtocol- Parameters:
config_data (NetworkConfigData)
- get_network()[source]#
Creates a network which has been prepared in the TRAILS package
#Todo: we might later simply import the whole trails code as a package, and directly use these functions #Todo: because TRAILS is still in beta version we better wait with that untill the first stable version is # released
- Return type:
tuple[MultiGraph,GeoDataFrame]
- Returns:
graph_simple (NetworkX graph): Simplified graph (for use in the losses analyses). complex_edges (GeoDataFrame): Complex graph (for use in the damages analyses).
ra2ce.network.network_wrappers.vector_network_wrapper 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 VectorNetworkWrapper(config_data)[source]#
Bases:
NetworkWrapperProtocolA class for handling and manipulating vector files.
Provides methods for reading vector data, cleaning it, and setting up graph and network.
- Parameters:
config_data (NetworkConfigData)
- static clean_vector(gdf)[source]#
Cleans a GeoDataFrame.
- Return type:
GeoDataFrame- Parameters:
gdf (GeoDataFrame)
- Args:
gdf (gpd.GeoDataFrame): Input GeoDataFrame.
- Returns:
gpd.GeoDataFrame: Cleaned GeoDataFrame.
- static explode_and_deduplicate_geometries(gpd)[source]#
Explodes and deduplicates geometries a GeoDataFrame.
- Return type:
GeoDataFrame- Parameters:
gpd (GeoDataFrame)
- Args:
gpd (gpd.GeoDataFrame): Input GeoDataFrame.
- Returns:
gpd.GeoDataFrame: GeoDataFrame with exploded and deduplicated geometries.
- get_network()[source]#
Gets a network built from vector files.
- Return type:
tuple[Graph,GeoDataFrame]
- Returns:
nx.MultiGraph: MultiGraph representing the graph. gpd.GeoDataFrame: GeoDataFrame representing the network.
- static get_network_edges_and_nodes_from_graph(graph)[source]#
Sets up network nodes and edges from a given graph.
- Return type:
tuple[GeoDataFrame,GeoDataFrame]- Parameters:
graph (Graph)
- Args:
- graph (nx.Graph): Input graph with geometry for nodes and edges.
Must contain “crs” as graph property.
- Returns:
gpd.GeoDataFrame: GeoDataFrame representing the network edges with “edge_fid”, “node_A”, and “node_B”. gpd.GeoDataFrame: GeoDataFrame representing the network nodes with “node_fid”.