dbs_classes.database.Database
dbs_classes.database.Database(self, database_path=None, database_name=None)
Implementation of IDatabase class that holds the site information and has methods to get static data info, and all the input information.
Additionally it can manipulate (add, edit, copy and delete) any of the objects in the input.
Methods
check_benefit_scenarios |
Return a dataframe with the scenarios needed for this benefit assessment run. |
cleanup |
Remove corrupted scenario output. |
create_benefit_scenarios |
Create any scenarios that are needed for the (cost-)benefit assessment and are not there already. |
get_aggregation |
Return a dictionary with the aggregated impacts as geodataframes. |
get_aggregation_benefits |
Get a dictionary with the aggregated benefits as geodataframes. |
get_depth_conversion |
Return the flood depth conversion that is need in the gui to plot the flood map. |
get_fiat_footprints |
Return a geodataframe of the impacts at the footprint level. |
get_index_path |
Return the path of the index tiles which are used to connect each water level cell with the topobathy tiles. |
get_max_water_level |
Return an array with the maximum water levels during an event. |
get_object_list |
Get a dictionary with all the toml paths and last modification dates that exist in the database that correspond to object_type. |
get_outputs |
Return a dictionary with info on the outputs that currently exist in the database. |
get_roads |
Return a geodataframe of the impacts at roads. |
get_topobathy_path |
Return the path of the topobathy tiles in order to create flood maps with water level maps. |
has_run_hazard |
Check if there is already a simulation that has the exact same hazard component. |
interp_slr |
Interpolate SLR value and reference it to the SLR reference year from the site toml. |
run_benefit |
Run a (cost-)benefit analysis. |
run_scenario |
Run a scenario hazard and impacts. |
shutdown |
Explicitly shut down the database controller singleton and clear all data stored in its memory. |
check_benefit_scenarios
dbs_classes.database.Database.check_benefit_scenarios(benefit)
Return a dataframe with the scenarios needed for this benefit assessment run.
Parameters
benefit |
IBenefit |
|
required |
cleanup
dbs_classes.database.Database.cleanup()
Remove corrupted scenario output.
This method removes any scenario output that: - is corrupted due to unfinished runs - does not have a corresponding input
create_benefit_scenarios
dbs_classes.database.Database.create_benefit_scenarios(benefit)
Create any scenarios that are needed for the (cost-)benefit assessment and are not there already.
Parameters
benefit |
IBenefit |
|
required |
get_aggregation
dbs_classes.database.Database.get_aggregation(scenario_name)
Return a dictionary with the aggregated impacts as geodataframes.
Parameters
scenario_name |
str |
name of the scenario |
required |
Returns
|
dict[GeoDataFrame] |
dictionary with aggregated damages per aggregation type |
get_aggregation_benefits
dbs_classes.database.Database.get_aggregation_benefits(benefit_name)
Get a dictionary with the aggregated benefits as geodataframes.
Parameters
benefit_name |
str |
name of the benefit analysis |
required |
Returns
|
dict[GeoDataFrame] |
dictionary with aggregated benefits per aggregation type |
get_depth_conversion
dbs_classes.database.Database.get_depth_conversion()
Return the flood depth conversion that is need in the gui to plot the flood map.
get_index_path
dbs_classes.database.Database.get_index_path()
Return the path of the index tiles which are used to connect each water level cell with the topobathy tiles.
get_max_water_level
dbs_classes.database.Database.get_max_water_level(
scenario_name,
return_period=None,
)
Return an array with the maximum water levels during an event.
Parameters
scenario_name |
str |
name of scenario |
required |
return_period |
int |
return period in years, by default None |
None |
Returns
|
np.array |
2D map of maximum water levels |
get_object_list
dbs_classes.database.Database.get_object_list(object_type)
Get a dictionary with all the toml paths and last modification dates that exist in the database that correspond to object_type.
Parameters
object_type |
str |
Can be ‘projections’, ‘events’, ‘measures’, ‘strategies’ or ‘scenarios’ |
required |
Returns
|
dict[str, Any] |
Includes ‘path’ and ‘last_modification_date’ info |
get_outputs
dbs_classes.database.Database.get_outputs()
Return a dictionary with info on the outputs that currently exist in the database.
Returns
|
dict[str, Any] |
Includes ‘name’, ‘path’, ‘last_modification_date’ and “finished” info |
get_roads
dbs_classes.database.Database.get_roads(scenario_name)
Return a geodataframe of the impacts at roads.
Parameters
scenario_name |
str |
name of scenario |
required |
Returns
|
GeoDataFrame |
Impacts at roads |
get_topobathy_path
dbs_classes.database.Database.get_topobathy_path()
Return the path of the topobathy tiles in order to create flood maps with water level maps.
Returns
|
str |
path to topobathy tiles |
has_run_hazard
dbs_classes.database.Database.has_run_hazard(scenario_name)
Check if there is already a simulation that has the exact same hazard component.
If yes that is copied to avoid running the hazard model twice.
Parameters
scenario_name |
str |
name of the scenario to check if needs to be rerun for hazard |
required |
interp_slr
dbs_classes.database.Database.interp_slr(slr_scenario, year)
Interpolate SLR value and reference it to the SLR reference year from the site toml.
Parameters
slr_scenario |
str |
SLR scenario name from the coulmn names in static.csv |
required |
year |
float |
year to evaluate |
required |
Raises
|
ValueError |
if the reference year is outside of the time range in the slr.csv file |
|
ValueError |
if the year to evaluate is outside of the time range in the slr.csv file |
run_benefit
dbs_classes.database.Database.run_benefit(benefit_name)
Run a (cost-)benefit analysis.
Parameters
benefit_name |
Union[str, list[str]] |
name(s) of the benefits to run. |
required |
run_scenario
dbs_classes.database.Database.run_scenario(scenario_name)
Run a scenario hazard and impacts.
Parameters
scenario_name |
Union[str, list[str]] |
name(s) of the scenarios to run. |
required |
Raises
|
RuntimeError |
If an error occurs while running one of the scenarios |
shutdown
dbs_classes.database.Database.shutdown()
Explicitly shut down the database controller singleton and clear all data stored in its memory.
Back to top