FloodAdapt
self, database_path: Path) FloodAdapt(
Methods
Name | Description |
---|---|
check_benefit_scenarios | Return a dataframe with the scenarios needed for this benefit assessment run. |
copy_event | Copy an event in the database. |
copy_measure | Copy a measure in the database. |
copy_projection | Copy a projection in the database. |
copy_strategy | Copy a strategy in the database. |
create_benefit | Create a new benefit object. |
create_benefit_scenarios | Create the benefit scenarios. |
create_event | Create a event object from a dictionary of attributes. |
create_event_set | Create a event set object from a dictionary of attributes. |
create_measure | Create a measure from a dictionary of attributes and a type string. |
create_projection | Create a new projection object. |
create_scenario | Create a new scenario object. |
create_strategy | Create a new strategy object. |
delete_benefit | Delete a benefit object from the database. |
delete_event | Delete an event from the database. |
delete_measure | Delete an measure from the database. |
delete_projection | Delete a projection from the database. |
delete_scenario | Delete a scenario from the database. |
delete_strategy | Delete a strategy from the database. |
get_aggregated_benefits | Get the aggregation benefits for a benefit assessment. |
get_aggregated_impacts | Return a dictionary with the aggregated impacts as geodataframes. |
get_aggregation_areas | Get a list of the aggregation areas that are provided in the site configuration. |
get_benefit | Get a benefit from the database by name. |
get_benefits | Get all benefits from the database. |
get_building_footprint_impacts | Return a geodataframe of the impacts at the footprint level. |
get_building_geometries | Get the buildings exposure that are used in Fiat. |
get_building_types | Get the building types/categories that are used in the exposure. |
get_completed_scenarios | Get all completed scenarios from the database. |
get_cyclone_track_by_index | Get a cyclone track from the database by index. |
get_depth_conversion | Return the flood depth conversion that is need in the gui to plot the flood map. |
get_event | Get an event from the database by name. |
get_events | Get all events from the database. |
get_green_infra_table | Return a table with different types of green infrastructure measures and their infiltration depths. |
get_index_path | Return the path of the index tiles which are used to connect each water level cell with the topobathy tiles. |
get_infographic | Return the HTML string of the infographic for the given scenario. |
get_infometrics | Return the metrics for the given scenario. |
get_max_water_level_map | Return the maximum water level for the given scenario. |
get_measure | Get a measure from the database by name. |
get_measures | Get all measures from the database. |
get_model_boundary | Get the model boundary that is used in SFINCS. |
get_model_grid | Get the model grid that is used in SFINCS. |
get_obs_point_timeseries | Return the HTML strings of the water level timeseries for the given scenario. |
get_obs_points | Get the observation points specified in the site.toml. |
get_projection | Get a projection from the database by name. |
get_projections | Get all projections from the database. |
get_road_impacts | Return a geodataframe of the impacts at roads. |
get_scenario | Get a scenario from the database by name. |
get_scenarios | Get all scenarios from the database. |
get_slr_scn_names | Get all sea level rise scenario names from the database. |
get_static_map | Get a static map from the database. |
get_strategies | Get all strategies from the database. |
get_strategy | Get a strategy from the database by name. |
get_svi_map | Get the SVI map that are used in Fiat. |
get_topobathy_path | Return the path of the topobathy tiles in order to create flood maps with water level maps. |
interp_slr | Interpolate sea level rise for a given scenario and year. |
plot_event_forcing | Plot forcing data for an event. |
plot_slr_scenarios | Plot sea level rise scenarios. |
run_benefit | Run the benefit assessment. |
run_scenario | Run a scenario hazard and impacts. |
save_benefit | Save a benefit object to the database. |
save_event | Save an event object to the database. |
save_measure | Save a measure object to the database. |
save_projection | Save a projection object to the database. |
save_scenario | Save the scenario to the database. |
save_strategy | Save a strategy object to the database. |
check_benefit_scenarios
FloodAdapt.check_benefit_scenarios(benefit: Benefit)
Return a dataframe with the scenarios needed for this benefit assessment run.
Parameters
benefit : Benefit
-
The benefit object to check.
Returns
copy_event
str, new_name: str, new_description: str) FloodAdapt.copy_event(old_name:
Copy an event in the database.
Parameters
copy_measure
str, new_name: str, new_description: str) FloodAdapt.copy_measure(old_name:
Copy a measure in the database.
Parameters
copy_projection
str, new_name: str, new_description: str) FloodAdapt.copy_projection(old_name:
Copy a projection in the database.
Parameters
copy_strategy
str, new_name: str, new_description: str) FloodAdapt.copy_strategy(old_name:
Copy a strategy in the database.
Parameters
create_benefit
dict[str, Any]) FloodAdapt.create_benefit(attrs:
Create a new benefit object.
Parameters
Returns
benefit : Benefit
-
The benefit object created from the attributes.
Raises
: ValueError
-
If the attributes do not adhere to the Benefit schema.
create_benefit_scenarios
FloodAdapt.create_benefit_scenarios(benefit: Benefit)
Create the benefit scenarios.
Parameters
benefit : Benefit
-
The benefit object to create scenarios for.
create_event
dict[str, Any] | Event) FloodAdapt.create_event(attrs:
Create a event object from a dictionary of attributes.
Parameters
Returns
event : Event
-
Depending on attrs.template an event object. Can be of type: Synthetic, Historical, Hurricane.
create_event_set
FloodAdapt.create_event_set(dict[str, Any] | EventSet,
attrs: list[Event],
sub_events: )
Create a event set object from a dictionary of attributes.
Parameters
Returns
event_set : EventSet
-
EventSet object
create_measure
dict[str, Any], type: str = None) FloodAdapt.create_measure(attrs:
Create a measure from a dictionary of attributes and a type string.
Parameters
Returns
measure : Measure
-
Measure object.
create_projection
dict[str, Any]) FloodAdapt.create_projection(attrs:
Create a new projection object.
Parameters
Returns
projection : Projection
-
The projection object created from the attributes.
Raises
: ValueError
-
If the attributes do not adhere to the Projection schema.
create_scenario
dict[str, Any]) FloodAdapt.create_scenario(attrs:
Create a new scenario object.
Parameters
Returns
scenario : Scenario
-
The scenario object created from the attributes.
Raises
: ValueError
-
If the attributes do not adhere to the Scenario schema.
create_strategy
dict[str, Any]) FloodAdapt.create_strategy(attrs:
Create a new strategy object.
Parameters
Returns
strategy : Strategy
-
The strategy object
Raises
: ValueError
-
If the strategy with the given name does not exist. If attrs does not adhere to the Strategy schema.
delete_benefit
str) FloodAdapt.delete_benefit(name:
Delete a benefit object from the database.
Parameters
name : str
-
The name of the benefit object to delete.
Raises
: ValueError
-
If the benefit object does not exist.
delete_event
str) FloodAdapt.delete_event(name:
Delete an event from the database.
Parameters
name : str
-
The name of the event to delete.
Raises
: ValueError
-
If the event does not exist. If the event is used in a scenario.
delete_measure
str) FloodAdapt.delete_measure(name:
Delete an measure from the database.
Parameters
name : str
-
The name of the measure to delete.
Raises
: ValueError
-
If the measure does not exist.
delete_projection
str) FloodAdapt.delete_projection(name:
Delete a projection from the database.
Parameters
name : str
-
The name of the projection to delete.
Raises
: ValueError
-
If the projection does not exist. If the projection is used in a scenario.
delete_scenario
str) FloodAdapt.delete_scenario(name:
Delete a scenario from the database.
Parameters
name : str
-
The name of the scenario to delete.
Raises
: ValueError
-
If the scenario does not exist.
delete_strategy
str) FloodAdapt.delete_strategy(name:
Delete a strategy from the database.
Parameters
name : str
-
The name of the strategy to delete.
Raises
: ValueError
-
If the strategy does not exist.
get_aggregated_benefits
str) FloodAdapt.get_aggregated_benefits(name:
Get the aggregation benefits for a benefit assessment.
Parameters
name : str
-
The name of the benefit assessment.
Returns
aggregated_benefits :
gpd
.GeoDataFrame-
The aggregation benefits for the benefit assessment.
get_aggregated_impacts
str) FloodAdapt.get_aggregated_impacts(name:
Return a dictionary with the aggregated impacts as geodataframes.
Parameters
name : str
-
The name of the scenario.
Returns
aggr_impacts : dict[str,
gpd
.GeoDataFrame]-
The aggregated impacts for the scenario.
get_aggregation_areas
FloodAdapt.get_aggregation_areas()
Get a list of the aggregation areas that are provided in the site configuration.
These are expected to much the ones in the FIAT model.
Returns
get_benefit
str) FloodAdapt.get_benefit(name:
Get a benefit from the database by name.
Parameters
name : str
-
The name of the benefit to retrieve.
Returns
Raises
: ValueError
-
If the benefit with the given name does not exist.
get_benefits
FloodAdapt.get_benefits()
Get all benefits from the database.
Returns
get_building_footprint_impacts
str) FloodAdapt.get_building_footprint_impacts(name:
Return a geodataframe of the impacts at the footprint level.
Parameters
name : str
-
The name of the scenario.
Returns
footprints :
gpd
.GeoDataFrame-
The impact footprints for the scenario.
get_building_geometries
FloodAdapt.get_building_geometries()
Get the buildings exposure that are used in Fiat.
Returns
buildings :
gpd
.GeoDataFrame-
gpd.GeoDataFrames with the buildings from FIAT exposure
get_building_types
FloodAdapt.get_building_types()
Get the building types/categories that are used in the exposure.
These are used to filter the buildings in the FIAT model, and can include types like: ‘Residential’, ‘Commercial’, ‘Industrial’, etc.
Returns
get_completed_scenarios
FloodAdapt.get_completed_scenarios()
Get all completed scenarios from the database.
Returns
get_cyclone_track_by_index
int) FloodAdapt.get_cyclone_track_by_index(index:
Get a cyclone track from the database by index.
Parameters
index : int
-
The index of the cyclone track to retrieve.
Returns
cyclone :
TropicalCyclone
-
The cyclone track object with the given index.
Raises
: ValueError
-
If the cyclone track database is not defined in the site configuration. If the cyclone track with the given index does not exist.
get_depth_conversion
FloodAdapt.get_depth_conversion()
Return the flood depth conversion that is need in the gui to plot the flood map.
Returns
fdc : float
-
The flood depth conversion.
get_event
str) FloodAdapt.get_event(name:
Get an event from the database by name.
Parameters
name : str
-
The name of the event to retrieve.
Returns
Raises
: ValueError
-
If the event with the given name does not exist.
get_events
FloodAdapt.get_events()
Get all events from the database.
Returns
get_green_infra_table
str) FloodAdapt.get_green_infra_table(measure_type:
Return a table with different types of green infrastructure measures and their infiltration depths.
Parameters
measure_type : str
-
The type of green infrastructure measure.
Returns
get_index_path
FloodAdapt.get_index_path()
Return the path of the index tiles which are used to connect each water level cell with the topobathy tiles.
Returns
index_path : str
-
The path to the index file.
get_infographic
str) FloodAdapt.get_infographic(name:
Return the HTML string of the infographic for the given scenario.
Parameters
name : str
-
The name of the scenario.
Returns
html : str
-
The HTML string of the infographic.
get_infometrics
str) FloodAdapt.get_infometrics(name:
Return the metrics for the given scenario.
Parameters
name : str
-
The name of the scenario.
Returns
Raises
: FileNotFoundError
-
If the metrics file does not exist.
get_max_water_level_map
str, rp: int = None) FloodAdapt.get_max_water_level_map(name:
Return the maximum water level for the given scenario.
Parameters
Returns
get_measure
str) FloodAdapt.get_measure(name:
Get a measure from the database by name.
Parameters
name : str
-
The name of the measure to retrieve.
Returns
measure : Measure
-
The measure object with the given name.
Raises
: ValueError
-
If the measure with the given name does not exist.
get_measures
FloodAdapt.get_measures()
Get all measures from the database.
Returns
get_model_boundary
FloodAdapt.get_model_boundary()
Get the model boundary that is used in SFINCS.
Returns
model_boundary :
GeoDataFrame
-
GeoDataFrame with the model boundary
get_model_grid
FloodAdapt.get_model_grid()
Get the model grid that is used in SFINCS.
Returns
grid :
QuadtreeGrid
-
QuadtreeGrid with the model grid
get_obs_point_timeseries
str) FloodAdapt.get_obs_point_timeseries(name:
Return the HTML strings of the water level timeseries for the given scenario.
Parameters
name : str
-
The name of the scenario.
Returns
html_path : str
-
The HTML strings of the water level timeseries
get_obs_points
FloodAdapt.get_obs_points()
Get the observation points specified in the site.toml.
These are also added to the flood hazard model. They are used as marker locations to plot water level time series in the output tab.
Returns
observation_points :
gpd
.GeoDataFrame-
gpd.GeoDataFrame with observation points from the site.toml.
get_projection
str) FloodAdapt.get_projection(name:
Get a projection from the database by name.
Parameters
name : str
-
The name of the projection to retrieve.
Returns
projection : Projection
-
The projection object with the given name.
Raises
: ValueError
-
If the projection with the given name does not exist.
get_projections
FloodAdapt.get_projections()
Get all projections from the database.
Returns
get_road_impacts
str) FloodAdapt.get_road_impacts(name:
Return a geodataframe of the impacts at roads.
Parameters
name : str
-
The name of the scenario.
Returns
roads :
gpd
.GeoDataFrame-
The impacted roads for the scenario.
get_scenario
str) FloodAdapt.get_scenario(name:
Get a scenario from the database by name.
Parameters
name : str
-
The name of the scenario to retrieve.
Returns
scenario : Scenario
-
The scenario object with the given name.
Raises
: ValueError
-
If the scenario with the given name does not exist.
get_scenarios
FloodAdapt.get_scenarios()
Get all scenarios from the database.
Returns
get_slr_scn_names
FloodAdapt.get_slr_scn_names()
Get all sea level rise scenario names from the database.
Returns
get_static_map
str, Path]) FloodAdapt.get_static_map(path: Union[
Get a static map from the database.
Parameters
Returns
static_map : Union[
gpd
.GeoDataFrame, None]-
gpd.GeoDataFrame with the static map if available, None if not found
get_strategies
FloodAdapt.get_strategies()
Get all strategies from the database.
Returns
get_strategy
str) FloodAdapt.get_strategy(name:
Get a strategy from the database by name.
Parameters
name : str
-
The name of the strategy to retrieve.
Returns
strategy : Strategy
-
The strategy object with the given name.
Raises
: ValueError
-
If the strategy with the given name does not exist.
get_svi_map
FloodAdapt.get_svi_map()
Get the SVI map that are used in Fiat.
Returns
svi_map :
gpd
.GeoDataFrame-
gpd.GeoDataFrames with the SVI map, None if not available
get_topobathy_path
FloodAdapt.get_topobathy_path()
Return the path of the topobathy tiles in order to create flood maps with water level maps.
Returns
topo_path : str
-
The path to the topobathy file.
interp_slr
str, year: float) FloodAdapt.interp_slr(slr_scenario:
Interpolate sea level rise for a given scenario and year.
Parameters
Returns
interpolated : float
-
The interpolated sea level rise for the given scenario and year.
plot_event_forcing
FloodAdapt.plot_event_forcing(event: Event, forcing_type: ForcingType)
Plot forcing data for an event.
Parameters
event : Event
-
The event object
forcing_type : ForcingType
-
The type of forcing data to plot
plot_slr_scenarios
FloodAdapt.plot_slr_scenarios()
Plot sea level rise scenarios.
Returns
html_path : str
-
The path to the html plot of the sea level rise scenarios.
run_benefit
str, list[str]]) FloodAdapt.run_benefit(name: Union[
Run the benefit assessment.
Parameters
run_scenario
str, list[str]]) FloodAdapt.run_scenario(scenario_name: Union[
Run a scenario hazard and impacts.
Parameters
Raises
: RuntimeError
-
If an error occurs while running one of the scenarios
save_benefit
bool = False) FloodAdapt.save_benefit(benefit: Benefit, overwrite:
Save a benefit object to the database.
Parameters
Raises
: ValueError
-
If the benefit object is not valid.
save_event
bool = False) FloodAdapt.save_event(event: Event, overwrite:
Save an event object to the database.
Parameters
Raises
: ValueError
-
If the event object is not valid.
save_measure
bool = False) FloodAdapt.save_measure(measure: Measure, overwrite:
Save a measure object to the database.
Parameters
Raises
: ValueError
-
If the measure object is not valid.
save_projection
bool = False) FloodAdapt.save_projection(projection: Projection, overwrite:
Save a projection object to the database.
Parameters
projection : Projection
-
The projection object to save.
overwrite : bool = False
-
Whether to overwrite an existing projection with the same name (default is False).
Raises
: ValueError
-
If the projection object is not valid.
save_scenario
bool = False) FloodAdapt.save_scenario(scenario: Scenario, overwrite:
Save the scenario to the database.
Parameters
Returns
save_strategy
bool = False) FloodAdapt.save_strategy(strategy: Strategy, overwrite:
Save a strategy object to the database.
Parameters
Raises
: ValueError
-
If the strategy object is not valid. If the strategy object already exists.