ra2ce.network.exporters package#

Submodules#

ra2ce.network.exporters.geodataframe_network_exporter 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 GeoDataFrameNetworkExporter(*, basename, export_types=<factory>, pickle_path=None)[source]#

Bases: NetworkExporterBase

Parameters:
  • basename (str)

  • export_types (list[str])

  • pickle_path (Path)

export_to_gpkg(output_dir, export_data)[source]#

Exports the given data into a *.gpkg file.

Return type:

None

Parameters:
  • output_dir (Path)

  • export_data (GeoDataFrame)

Args:

output_dir (Path): Output directory where the save the exported data. export_data (NETWORK_TYPE): Data that needs to be exported.

export_to_pickle(output_dir, export_data)[source]#

Exports the given data into a *.p or .feather file.

Return type:

None

Parameters:
  • output_dir (Path)

  • export_data (GeoDataFrame)

Args:

output_dir (Path): Output directory where the save the exported data. export_data (NETWORK_TYPE): Data that needs to be exported.

ra2ce.network.exporters.json_exporter 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 JsonExporter(*args, **kwargs)[source]#

Bases: Ra2ceExporterProtocol

export(export_path, export_data)[source]#

Exports into JSON the given data at the given path. When the parent(s) directory does not exist then it will be created.

Return type:

None

Parameters:
  • export_path (Path)

  • export_data (Any)

Args:

export_path (Path): File path where to store the final ‘json’ file. export_data (Any): Data to export.

ra2ce.network.exporters.multi_graph_network_exporter 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 MultiGraphNetworkExporter(*, basename, export_types=<factory>, pickle_path=None)[source]#

Bases: NetworkExporterBase

Parameters:
  • basename (str)

  • export_types (list[str])

  • pickle_path (Path | None)

export_to_gpkg(output_dir, export_data)[source]#

Exports the given data into a *.gpkg file.

Return type:

None

Parameters:
  • output_dir (Path)

  • export_data (MultiGraph | MultiDiGraph)

Args:

output_dir (Path): Output directory where the save the exported data. export_data (NETWORK_TYPE): Data that needs to be exported.

export_to_pickle(output_dir, export_data)[source]#

Exports the given data into a *.p or .feather file.

Return type:

None

Parameters:
  • output_dir (Path)

  • export_data (MultiGraph | MultiDiGraph)

Args:

output_dir (Path): Output directory where the save the exported data. export_data (NETWORK_TYPE): Data that needs to be exported.

ra2ce.network.exporters.network_exporter_base 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 NetworkExporterBase(*, basename, export_types=<factory>, pickle_path=None)[source]#

Bases: Ra2ceExporterProtocol

Parameters:
  • basename (str)

  • export_types (list[str])

  • pickle_path (Path)

basename: str#
export(export_path, export_data)[source]#

Exports the given data to the specified types. TODO: I do not particularly like this approach, but at least gives better clarity on what the export options at the moment are.

Return type:

None

Parameters:
  • export_path (Path)

  • export_data (GeoDataFrame | MultiGraph | MultiDiGraph)

Args:

export_path (Path): Path to the output directory where to export the data. export_data (NETWORK_TYPE): Data that needs to be exported.

export_to_gpkg(output_dir, export_data)[source]#

Exports the given data into a *.gpkg file.

Return type:

None

Parameters:
  • output_dir (Path)

  • export_data (GeoDataFrame | MultiGraph | MultiDiGraph)

Args:

output_dir (Path): Output directory where the save the exported data. export_data (NETWORK_TYPE): Data that needs to be exported.

export_to_pickle(output_dir, export_data)[source]#

Exports the given data into a *.p or .feather file.

Return type:

None

Parameters:
  • output_dir (Path)

  • export_data (GeoDataFrame | MultiGraph | MultiDiGraph)

Args:

output_dir (Path): Output directory where the save the exported data. export_data (NETWORK_TYPE): Data that needs to be exported.

export_types: list[str]#
pickle_path: Path = None#

ra2ce.network.exporters.network_exporter_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 NetworkExporterFactory[source]#

Bases: object

export(network, basename, output_dir, export_types)[source]#
Return type:

None

Parameters:
  • network (GeoDataFrame | MultiGraph | MultiDiGraph)

  • basename (str)

  • output_dir (Path)

  • export_types (list[str])

static get_exporter_type(network)[source]#
Return type:

type[NetworkExporterBase]

Parameters:

network (GeoDataFrame | MultiGraph | MultiDiGraph)

get_pickle_path()[source]#
Return type:

Path

Module contents#