FloodAdapt
self, database_path: Path) FloodAdapt(
Methods
Name | Description |
---|---|
calculate_polygon_area | Calculate the area of a polygon from a GeoDataFrame. |
calculate_volume | Calculate the volume of green infrastructure based on the given area, height, and percent area. |
check_benefit_scenarios | Return a dataframe with the scenarios needed for this benefit assessment run. |
check_higher_level_usage | Check if an event is used in a scenario. |
copy_event | Copy an event in the database. |
copy_measure | Copy an event in the database. |
copy_projection | Copy a projection 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 event 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. |
download_wl_data | Download water level data from a station or tide gauge. |
edit_benefit | Edit a benefit object in the database. |
edit_event | Edit an event object in the database. |
edit_measure | Edit an event object in the database. |
edit_projection | Edit a projection object in the database. |
edit_scenario | Edit a scenario object in the database. |
get_aggregation | 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_aggregation_benefits | Get the aggregation benefits for a benefit assessment. |
get_benefit | Get a benefit from the database by name. |
get_benefits | Get all benefits from the database. |
get_building_footprints | Return a geodataframe of the impacts at the footprint level. |
get_buildings | Get the buildings exposure that are used in Fiat. |
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_event_mode | Get the mode of an event from the database by name. |
get_event_templates | Get list of all implemented event templates. |
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_hazard_measure_types | Get list of all implemented hazard measure types. |
get_impact_measure_types | Get list of all implemented impact measure types. |
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 | 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_outputs | Get all completed scenarios from the database. |
get_projection | Get a projection from the database by name. |
get_projections | Get all projections from the database. |
get_property_types | Get the property types that are used in the exposure. |
get_roads | 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_forcing | Plot forcing data for an event. |
plot_slr_scenarios | Plot sea level rise scenarios. |
read_csv | Read a csv file into a pandas DataFrame. |
read_database | Given a path and a site name returns a IDatabase object. |
run_benefit | Run the benefit assessment. |
run_scenario | Run a scenario. |
save_benefit | Save a benefit object to the database. |
save_cyclone_track | Save cyclone track data to the event folder. |
save_event | Save an event object to the database. |
save_measure | Save an event 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. |
save_timeseries_csv | Save timeseries data to a csv file. |
calculate_polygon_area
FloodAdapt.calculate_polygon_area(gdf: gpd.GeoDataFrame, site: Site)
Calculate the area of a polygon from a GeoDataFrame.
Parameters
gdf :
gpd
.GeoDataFrame
-
A GeoDataFrame containing the polygon geometry.
site : Site
-
An instance of Site representing the site information.
Returns
: float: The area of the polygon in the specified units.
calculate_volume
FloodAdapt.calculate_volume(
area: us.UnitfulArea,= us.UnitfulHeight(value=0.0, units=us.UnitTypesLength.meters),
height: us.UnitfulHeight float = 100.0,
percent_area: )
Calculate the volume of green infrastructure based on the given area, height, and percent area.
Parameters
area :
float
-
The area of the green infrastructure in square units.
height :
float
= us.UnitfulHeight(value=0.0, units=us.UnitTypesLength.meters)-
The height of the green infrastructure in units. Defaults to 0.0.
percent_area :
float
= 100.0-
The percentage of the area to be considered. Defaults to 100.0.
Returns
: float: The calculated volume of the green infrastructure.
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
:
pd
.DataFrame
-
A dataframe with the scenarios needed for this benefit assessment run.
check_higher_level_usage
str) FloodAdapt.check_higher_level_usage(name:
Check if an event is used in a scenario.
Parameters
name :
str
-
name of the event to be checked
Returns
:
list
[str
]-
list of scenario names where the event is used
copy_event
str, new_name: str, new_description: str) FloodAdapt.copy_event(old_name:
Copy an event in the database.
Parameters
old_name :
str
-
The name of the event to copy.
new_name :
str
-
The name of the new event.
new_description :
str
-
The description of the new event
copy_measure
str, new_name: str, new_description: str) FloodAdapt.copy_measure(old_name:
Copy an event in the database.
Parameters
old_name :
str
-
The name of the event to copy.
new_name :
str
-
The name of the new event.
new_description :
str
-
The description of the new event
copy_projection
str, new_name: str, new_description: str) FloodAdapt.copy_projection(old_name:
Copy a projection in the database.
Parameters
old_name :
str
-
The name of the projection to copy.
new_name :
str
-
The name of the new projection.
new_description :
str
-
The description of the new projection
create_benefit
dict[str, Any]) FloodAdapt.create_benefit(attrs:
Create a new benefit object.
Parameters
attrs :
dict
[str
,Any
]-
The attributes of the benefit object to create. Should 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
attrs : Event[
str
,Any
]-
Dictionary of attributes
Returns
: 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
: 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
attrs :
dict
[str
,Any
]-
Dictionary of attributes for the measure.
type :
str
= None-
Type of measure to create.
Returns
: Measure
-
Measure object.
create_projection
dict[str, Any]) FloodAdapt.create_projection(attrs:
Create a new projection object.
Parameters
attrs :
dict
[str
,Any
]-
The attributes of the projection object to create. Should adhere to the Projection schema.
Returns
: 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
attrs :
dict
[str
,Any
]-
The attributes of the scenario object to create. Should adhere to the Scenario schema.
Returns
: 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
attrs :
dict
[str
,Any
]-
The attributes of the strategy object to create. Should adhere to the Strategy schema.
Returns
: 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 event from the database.
Parameters
name :
str
-
The name of the event to delete.
Raises
:
ValueError
-
If the event 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.
download_wl_data
FloodAdapt.download_wl_data(
tide_gauge: TideGauge,
time: TimeFrame,
units: us.UnitTypesLength,str,
out_path: )
Download water level data from a station or tide gauge.
Parameters
tide_gauge :
TideGauge
-
Tide gauge object to download data from
time :
TimeFrame
-
Time model object containing start and end time
units :
UnitTypesLength
-
Units that data the returned data will be converted to
out_path :
str
-
Path to save the data to
edit_benefit
FloodAdapt.edit_benefit(benefit: Benefit)
Edit a benefit object in the database.
Parameters
benefit : Benefit
-
The benefit object to edit.
Raises
:
ValueError
-
If the benefit object does not exist.
edit_event
FloodAdapt.edit_event(event: Event)
Edit an event object in the database.
Parameters
event : Event
-
The event object to edit.
Raises
:
ValueError
-
If the event object does not exist. If the event is used in a scenario.
edit_measure
FloodAdapt.edit_measure(measure: Measure)
Edit an event object in the database.
Parameters
measure : Measure
-
The measure object to edit.
Raises
:
ValueError
-
If the event object does not exist.
edit_projection
FloodAdapt.edit_projection(projection: Projection)
Edit a projection object in the database.
Parameters
projection : Projection
-
The projection object to edit.
Raises
:
ValueError
-
If the projection object does not exist.
edit_scenario
FloodAdapt.edit_scenario(scenario: Scenario)
Edit a scenario object in the database.
Parameters
scenario : Scenario
-
The scenario object to edit.
Raises
:
ValueError
-
If the scenario object does not exist.
get_aggregation
str) FloodAdapt.get_aggregation(name:
Return a dictionary with the aggregated impacts as geodataframes.
Parameters
name :
str
-
The name of the scenario.
Returns
:
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
:
dict
[str
,GeoDataFrame
]-
list of geodataframes with the polygons defining the aggregation areas
get_aggregation_benefits
str) FloodAdapt.get_aggregation_benefits(name:
Get the aggregation benefits for a benefit assessment.
Parameters
name :
str
-
The name of the benefit assessment.
Returns
:
gpd
.GeoDataFrame
-
The aggregation benefits for the benefit assessment.
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
:
dict
[str
,Any
]-
A dictionary containing all benefits. Includes keys: ‘name’, ‘description’, ‘path’, ‘last_modification_date’, ‘objects’ Each value is a list of the corresponding attribute for each benefit.
get_building_footprints
str) FloodAdapt.get_building_footprints(name:
Return a geodataframe of the impacts at the footprint level.
Parameters
name :
str
-
The name of the scenario.
Returns
:
gpd
.GeoDataFrame
-
The impact footprints for the scenario.
get_buildings
FloodAdapt.get_buildings()
Get the buildings exposure that are used in Fiat.
Returns
:
gpd
.GeoDataFrame
-
gpd.GeoDataFrames with the buildings from FIAT exposure
get_depth_conversion
FloodAdapt.get_depth_conversion()
Return the flood depth conversion that is need in the gui to plot the flood map.
Returns
:
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_event_mode
str) FloodAdapt.get_event_mode(name:
Get the mode of an event from the database by name.
Parameters
name :
str
Returns
:
Mode
-
The mode of the event with the given name, either
risk
orsingle_event
.
get_event_templates
FloodAdapt.get_event_templates()
Get list of all implemented event templates.
get_events
FloodAdapt.get_events()
Get all events from the database.
Returns
:
dict
[str
,Any
]-
A dictionary containing all events. Includes keys: ‘name’, ‘description’, ‘path’, ‘last_modification_date’, ‘objects’ Each value is a list of the corresponding attribute for each benefit.
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
:
pd
.DataFrame
-
A table with different types of green infrastructure measures and their infiltration depths.
get_hazard_measure_types
FloodAdapt.get_hazard_measure_types()
Get list of all implemented hazard measure types.
get_impact_measure_types
FloodAdapt.get_impact_measure_types()
Get list of all implemented impact measure types.
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
:
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
:
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
:
pd
.DataFrame
Raises
:
FileNotFoundError
-
If the metrics file does not exist.
get_max_water_level
str, rp: int = None) FloodAdapt.get_max_water_level(name:
Return the maximum water level for the given scenario.
Parameters
name :
str
-
The name of the scenario.
rp :
int
= None-
The return period of the water level, by default None
Returns
:
np
.ndarray
-
2D gridded map with the maximum waterlevels for each cell.
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
-
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
:
dict
[str
,Any
]-
A dictionary containing all measures. Includes keys: ‘name’, ‘description’, ‘path’, ‘last_modification_date’, ‘objects’ Each value is a list of the corresponding attribute for each measure.
get_model_boundary
FloodAdapt.get_model_boundary()
Get the model boundary that is used in SFINCS.
Returns
:
GeoDataFrame
-
GeoDataFrame with the model boundary
get_model_grid
FloodAdapt.get_model_grid()
Get the model grid that is used in SFINCS.
Returns
:
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
:
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
:
gpd
.GeoDataFrame
-
gpd.GeoDataFrame with observation points from the site.toml.
get_outputs
FloodAdapt.get_outputs()
Get all completed scenarios from the database.
Returns
:
dict
[str
,Any
]-
A dictionary containing all scenarios. Includes keys: ‘name’, ‘description’, ‘path’, ‘last_modification_date’, ‘objects’ Each value is a list of the corresponding attribute for each output.
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
-
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
:
dict
[str
,Any
]-
A dictionary containing all projections. Includes keys: ‘name’, ‘description’, ‘path’, ‘last_modification_date’, ‘objects’ Each value is a list of the corresponding attribute for each projection.
get_property_types
FloodAdapt.get_property_types()
Get the property types that are used in the exposure.
Returns
:
list
-
list of property types
get_roads
str) FloodAdapt.get_roads(name:
Return a geodataframe of the impacts at roads.
Parameters
name :
str
-
The name of the scenario.
Returns
:
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
-
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
:
dict
[str
,Any
]-
A dictionary containing all scenarios. Includes keys: ‘name’, ‘description’, ‘path’, ‘last_modification_date’, ‘objects’. Each value is a list of the corresponding attribute for each scenario.
get_slr_scn_names
FloodAdapt.get_slr_scn_names()
Get all sea level rise scenario names from the database.
Returns
:
list
-
List of scenario names
get_static_map
str, Path]) FloodAdapt.get_static_map(path: Union[
Get a static map from the database.
Parameters
path :
Union
[str
,Path
]-
path to the static map
Returns
:
gpd
.gpd
.GeoDataFrame
-
gpd.GeoDataFrame with the static map
get_strategies
FloodAdapt.get_strategies()
Get all strategies from the database.
Returns
:
dict
[str
,Any
]-
A dictionary containing all strategies. Includes keys: ‘name’, ‘description’, ‘path’, ‘last_modification_date’, ‘objects’ Each value is a list of the corresponding attribute for each strategy.
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
-
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
:
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
:
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
slr_scenario :
str
-
The name of the sea level rise scenario.
year :
float
-
The year to interpolate sea level rise for.
Returns
:
float
-
The interpolated sea level rise for the given scenario and year.
plot_forcing
FloodAdapt.plot_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
:
str
-
The path to the html plot of the sea level rise scenarios.
read_csv
str, os.PathLike]) FloodAdapt.read_csv(csvpath: Union[
Read a csv file into a pandas DataFrame.
Parameters
csvpath :
Union
[str
,os
.PathLike
]-
Path to the csv file
Returns
:
pd
.DataFrame
-
DataFrame containing the data from the csv file
read_database
str, os.PathLike], site_name: str) FloodAdapt.read_database(database_path: Union[
Given a path and a site name returns a IDatabase object.
Parameters
database_path :
Union
[str
,os
.PathLike
]-
path to database
site_name :
str
-
name of the site
Returns
:
IDatabase
run_benefit
str, list[str]]) FloodAdapt.run_benefit(name: Union[
Run the benefit assessment.
Parameters
name :
Union
[str
,list
[str
]]-
The name of the benefit object to run.
run_scenario
str, list[str]]) FloodAdapt.run_scenario(name: Union[
Run a scenario.
Parameters
name :
Union
[str
,list
[str
]]-
The name(s) of the scenario to run.
Raises
:
ValueError
-
If the scenario does not exist.
save_benefit
FloodAdapt.save_benefit(benefit: Benefit)
Save a benefit object to the database.
Parameters
benefit : Benefit
-
The benefit object to save.
Raises
:
ValueError
-
If the benefit object is not valid.
save_cyclone_track
FloodAdapt.save_cyclone_track(event: Event, track: TropicalCyclone)
Save cyclone track data to the event folder.
Parameters
event : Event
-
The event object
track :
TropicalCyclone
-
The cyclone track data
save_event
FloodAdapt.save_event(event: Event)
Save an event object to the database.
Parameters
event : Event
-
The event object to save.
Raises
:
ValueError
-
If the event object is not valid.
save_measure
bool = False) FloodAdapt.save_measure(measure: Measure, overwrite:
Save an event object to the database.
Parameters
measure : Measure
-
The measure object to save.
Raises
:
ValueError
-
If the event object is not valid.
save_projection
FloodAdapt.save_projection(projection: Projection)
Save a projection object to the database.
Parameters
projection : Projection
-
The projection object to save.
Raises
:
ValueError
-
If the projection object is not valid.
save_scenario
FloodAdapt.save_scenario(scenario: Scenario)
Save the scenario to the database.
Parameters
scenario : Scenario
-
The scenario to save.
Returns
:
bool
-
Whether the scenario was saved successfully.
:
str
-
The error message if the scenario was not saved successfully.
save_strategy
FloodAdapt.save_strategy(strategy: Strategy)
Save a strategy object to the database.
Parameters
strategy : Strategy
-
The strategy object to save.
Raises
:
ValueError
-
If the strategy object is not valid. If the strategy object already exists.
save_timeseries_csv
str, event: Event, df: pd.DataFrame) FloodAdapt.save_timeseries_csv(name:
Save timeseries data to a csv file.
Parameters
name :
str
-
Name of the event
event : Event
-
Event object
df :
pd
.DataFrame
-
Dataframe of timeseries data