flood-adapt 0.3.9__py3-none-any.whl → 0.3.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flood_adapt/__init__.py +26 -22
- flood_adapt/adapter/__init__.py +9 -9
- flood_adapt/adapter/fiat_adapter.py +1541 -1541
- flood_adapt/adapter/interface/hazard_adapter.py +70 -70
- flood_adapt/adapter/interface/impact_adapter.py +36 -36
- flood_adapt/adapter/interface/model_adapter.py +89 -89
- flood_adapt/adapter/interface/offshore.py +19 -19
- flood_adapt/adapter/sfincs_adapter.py +1848 -1848
- flood_adapt/adapter/sfincs_offshore.py +193 -193
- flood_adapt/config/config.py +248 -248
- flood_adapt/config/fiat.py +219 -219
- flood_adapt/config/gui.py +331 -331
- flood_adapt/config/sfincs.py +481 -336
- flood_adapt/config/site.py +129 -129
- flood_adapt/database_builder/database_builder.py +2210 -2210
- flood_adapt/database_builder/templates/default_units/imperial.toml +9 -9
- flood_adapt/database_builder/templates/default_units/metric.toml +9 -9
- flood_adapt/database_builder/templates/green_infra_table/green_infra_lookup_table.csv +10 -10
- flood_adapt/database_builder/templates/infographics/OSM/config_charts.toml +90 -90
- flood_adapt/database_builder/templates/infographics/OSM/config_people.toml +57 -57
- flood_adapt/database_builder/templates/infographics/OSM/config_risk_charts.toml +121 -121
- flood_adapt/database_builder/templates/infographics/OSM/config_roads.toml +65 -65
- flood_adapt/database_builder/templates/infographics/OSM/styles.css +45 -45
- flood_adapt/database_builder/templates/infographics/US_NSI/config_charts.toml +126 -126
- flood_adapt/database_builder/templates/infographics/US_NSI/config_people.toml +60 -60
- flood_adapt/database_builder/templates/infographics/US_NSI/config_risk_charts.toml +121 -121
- flood_adapt/database_builder/templates/infographics/US_NSI/config_roads.toml +65 -65
- flood_adapt/database_builder/templates/infographics/US_NSI/styles.css +45 -45
- flood_adapt/database_builder/templates/infometrics/OSM/metrics_additional_risk_configs.toml +4 -4
- flood_adapt/database_builder/templates/infometrics/OSM/with_SVI/infographic_metrics_config.toml +143 -143
- flood_adapt/database_builder/templates/infometrics/OSM/with_SVI/infographic_metrics_config_risk.toml +153 -153
- flood_adapt/database_builder/templates/infometrics/OSM/without_SVI/infographic_metrics_config.toml +127 -127
- flood_adapt/database_builder/templates/infometrics/OSM/without_SVI/infographic_metrics_config_risk.toml +57 -57
- flood_adapt/database_builder/templates/infometrics/US_NSI/metrics_additional_risk_configs.toml +4 -4
- flood_adapt/database_builder/templates/infometrics/US_NSI/with_SVI/infographic_metrics_config.toml +191 -191
- flood_adapt/database_builder/templates/infometrics/US_NSI/with_SVI/infographic_metrics_config_risk.toml +153 -153
- flood_adapt/database_builder/templates/infometrics/US_NSI/without_SVI/infographic_metrics_config.toml +178 -178
- flood_adapt/database_builder/templates/infometrics/US_NSI/without_SVI/infographic_metrics_config_risk.toml +57 -57
- flood_adapt/database_builder/templates/infometrics/mandatory_metrics_config.toml +9 -9
- flood_adapt/database_builder/templates/infometrics/mandatory_metrics_config_risk.toml +65 -65
- flood_adapt/database_builder/templates/output_layers/bin_colors.toml +5 -5
- flood_adapt/database_builder.py +16 -16
- flood_adapt/dbs_classes/__init__.py +21 -21
- flood_adapt/dbs_classes/database.py +495 -684
- flood_adapt/dbs_classes/dbs_benefit.py +77 -76
- flood_adapt/dbs_classes/dbs_event.py +61 -59
- flood_adapt/dbs_classes/dbs_measure.py +112 -111
- flood_adapt/dbs_classes/dbs_projection.py +34 -34
- flood_adapt/dbs_classes/dbs_scenario.py +137 -137
- flood_adapt/dbs_classes/dbs_static.py +274 -273
- flood_adapt/dbs_classes/dbs_strategy.py +130 -129
- flood_adapt/dbs_classes/dbs_template.py +279 -278
- flood_adapt/dbs_classes/interface/database.py +107 -139
- flood_adapt/dbs_classes/interface/element.py +121 -121
- flood_adapt/dbs_classes/interface/static.py +47 -47
- flood_adapt/flood_adapt.py +1207 -1178
- flood_adapt/misc/database_user.py +16 -16
- flood_adapt/misc/exceptions.py +22 -0
- flood_adapt/misc/log.py +183 -183
- flood_adapt/misc/path_builder.py +54 -54
- flood_adapt/misc/utils.py +185 -185
- flood_adapt/objects/__init__.py +82 -82
- flood_adapt/objects/benefits/benefits.py +61 -61
- flood_adapt/objects/events/event_factory.py +135 -135
- flood_adapt/objects/events/event_set.py +88 -84
- flood_adapt/objects/events/events.py +234 -234
- flood_adapt/objects/events/historical.py +58 -58
- flood_adapt/objects/events/hurricane.py +68 -67
- flood_adapt/objects/events/synthetic.py +46 -50
- flood_adapt/objects/forcing/__init__.py +92 -92
- flood_adapt/objects/forcing/csv.py +68 -68
- flood_adapt/objects/forcing/discharge.py +66 -66
- flood_adapt/objects/forcing/forcing.py +150 -150
- flood_adapt/objects/forcing/forcing_factory.py +182 -182
- flood_adapt/objects/forcing/meteo_handler.py +93 -93
- flood_adapt/objects/forcing/netcdf.py +40 -40
- flood_adapt/objects/forcing/plotting.py +453 -429
- flood_adapt/objects/forcing/rainfall.py +98 -98
- flood_adapt/objects/forcing/tide_gauge.py +191 -191
- flood_adapt/objects/forcing/time_frame.py +90 -90
- flood_adapt/objects/forcing/timeseries.py +564 -564
- flood_adapt/objects/forcing/unit_system.py +580 -580
- flood_adapt/objects/forcing/waterlevels.py +108 -108
- flood_adapt/objects/forcing/wind.py +124 -124
- flood_adapt/objects/measures/measure_factory.py +92 -92
- flood_adapt/objects/measures/measures.py +529 -529
- flood_adapt/objects/object_model.py +74 -68
- flood_adapt/objects/projections/projections.py +103 -103
- flood_adapt/objects/scenarios/scenarios.py +22 -22
- flood_adapt/objects/strategies/strategies.py +89 -89
- flood_adapt/workflows/benefit_runner.py +579 -554
- flood_adapt/workflows/floodmap.py +85 -85
- flood_adapt/workflows/impacts_integrator.py +85 -85
- flood_adapt/workflows/scenario_runner.py +70 -70
- {flood_adapt-0.3.9.dist-info → flood_adapt-0.3.10.dist-info}/LICENSE +674 -674
- {flood_adapt-0.3.9.dist-info → flood_adapt-0.3.10.dist-info}/METADATA +866 -865
- flood_adapt-0.3.10.dist-info/RECORD +140 -0
- flood_adapt-0.3.9.dist-info/RECORD +0 -139
- {flood_adapt-0.3.9.dist-info → flood_adapt-0.3.10.dist-info}/WHEEL +0 -0
- {flood_adapt-0.3.9.dist-info → flood_adapt-0.3.10.dist-info}/top_level.txt +0 -0
|
@@ -1,139 +1,107 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from abc import ABC, abstractmethod
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from typing import Any, Optional, Union
|
|
5
|
-
|
|
6
|
-
import geopandas as gpd
|
|
7
|
-
import numpy as np
|
|
8
|
-
|
|
9
|
-
from
|
|
10
|
-
|
|
11
|
-
from flood_adapt.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@property
|
|
25
|
-
@abstractmethod
|
|
26
|
-
def
|
|
27
|
-
|
|
28
|
-
@property
|
|
29
|
-
@abstractmethod
|
|
30
|
-
def
|
|
31
|
-
|
|
32
|
-
@property
|
|
33
|
-
@abstractmethod
|
|
34
|
-
def
|
|
35
|
-
|
|
36
|
-
@property
|
|
37
|
-
@abstractmethod
|
|
38
|
-
def
|
|
39
|
-
|
|
40
|
-
@property
|
|
41
|
-
@abstractmethod
|
|
42
|
-
def
|
|
43
|
-
|
|
44
|
-
@property
|
|
45
|
-
@abstractmethod
|
|
46
|
-
def
|
|
47
|
-
|
|
48
|
-
@property
|
|
49
|
-
@abstractmethod
|
|
50
|
-
def
|
|
51
|
-
|
|
52
|
-
@
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
@abstractmethod
|
|
62
|
-
def
|
|
63
|
-
pass
|
|
64
|
-
|
|
65
|
-
@abstractmethod
|
|
66
|
-
def
|
|
67
|
-
pass
|
|
68
|
-
|
|
69
|
-
@abstractmethod
|
|
70
|
-
def
|
|
71
|
-
pass
|
|
72
|
-
|
|
73
|
-
@abstractmethod
|
|
74
|
-
def
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
pass
|
|
96
|
-
|
|
97
|
-
@abstractmethod
|
|
98
|
-
def
|
|
99
|
-
pass
|
|
100
|
-
|
|
101
|
-
@abstractmethod
|
|
102
|
-
def
|
|
103
|
-
pass
|
|
104
|
-
|
|
105
|
-
@abstractmethod
|
|
106
|
-
def
|
|
107
|
-
|
|
108
|
-
) -> np.ndarray:
|
|
109
|
-
pass
|
|
110
|
-
|
|
111
|
-
@abstractmethod
|
|
112
|
-
def get_building_footprints(self, scenario_name: str) -> gpd.GeoDataFrame:
|
|
113
|
-
pass
|
|
114
|
-
|
|
115
|
-
@abstractmethod
|
|
116
|
-
def get_roads(self, scenario_name: str) -> gpd.GeoDataFrame:
|
|
117
|
-
pass
|
|
118
|
-
|
|
119
|
-
@abstractmethod
|
|
120
|
-
def get_aggregation(self, scenario_name: str) -> dict[str, gpd.GeoDataFrame]:
|
|
121
|
-
pass
|
|
122
|
-
|
|
123
|
-
@abstractmethod
|
|
124
|
-
def get_aggregation_benefits(
|
|
125
|
-
self, benefit_name: str
|
|
126
|
-
) -> dict[str, gpd.GeoDataFrame]:
|
|
127
|
-
pass
|
|
128
|
-
|
|
129
|
-
@abstractmethod
|
|
130
|
-
def get_object_list(self, object_type: str) -> dict[str, Any]:
|
|
131
|
-
pass
|
|
132
|
-
|
|
133
|
-
@abstractmethod
|
|
134
|
-
def has_run_hazard(self, scenario_name: str) -> None:
|
|
135
|
-
pass
|
|
136
|
-
|
|
137
|
-
@abstractmethod
|
|
138
|
-
def cleanup(self) -> None:
|
|
139
|
-
pass
|
|
1
|
+
import os
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any, Optional, Union
|
|
5
|
+
|
|
6
|
+
import geopandas as gpd
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
from flood_adapt.config.site import Site
|
|
10
|
+
from flood_adapt.dbs_classes.interface.element import AbstractDatabaseElement
|
|
11
|
+
from flood_adapt.dbs_classes.interface.static import IDbsStatic
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class IDatabase(ABC):
|
|
15
|
+
base_path: Path
|
|
16
|
+
input_path: Path
|
|
17
|
+
output_path: Path
|
|
18
|
+
static_path: Path
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
@abstractmethod
|
|
22
|
+
def site(self) -> Site: ...
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
@abstractmethod
|
|
26
|
+
def static(self) -> IDbsStatic: ...
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
@abstractmethod
|
|
30
|
+
def events(self) -> AbstractDatabaseElement: ...
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
@abstractmethod
|
|
34
|
+
def scenarios(self) -> AbstractDatabaseElement: ...
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
@abstractmethod
|
|
38
|
+
def strategies(self) -> AbstractDatabaseElement: ...
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
@abstractmethod
|
|
42
|
+
def measures(self) -> AbstractDatabaseElement: ...
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
@abstractmethod
|
|
46
|
+
def projections(self) -> AbstractDatabaseElement: ...
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
@abstractmethod
|
|
50
|
+
def benefits(self) -> AbstractDatabaseElement: ...
|
|
51
|
+
|
|
52
|
+
@abstractmethod
|
|
53
|
+
def __init__(
|
|
54
|
+
self, database_path: Union[str, os.PathLike], site_name: str
|
|
55
|
+
) -> None: ...
|
|
56
|
+
|
|
57
|
+
@abstractmethod
|
|
58
|
+
def get_outputs(self) -> dict[str, Any]:
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
@abstractmethod
|
|
62
|
+
def get_topobathy_path(self) -> str:
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
@abstractmethod
|
|
66
|
+
def get_index_path(self) -> str:
|
|
67
|
+
pass
|
|
68
|
+
|
|
69
|
+
@abstractmethod
|
|
70
|
+
def get_depth_conversion(self) -> float:
|
|
71
|
+
pass
|
|
72
|
+
|
|
73
|
+
@abstractmethod
|
|
74
|
+
def get_max_water_level(
|
|
75
|
+
self, scenario_name: str, return_period: Optional[int] = None
|
|
76
|
+
) -> np.ndarray:
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
@abstractmethod
|
|
80
|
+
def get_building_footprints(self, scenario_name: str) -> gpd.GeoDataFrame:
|
|
81
|
+
pass
|
|
82
|
+
|
|
83
|
+
@abstractmethod
|
|
84
|
+
def get_roads(self, scenario_name: str) -> gpd.GeoDataFrame:
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
@abstractmethod
|
|
88
|
+
def get_aggregation(self, scenario_name: str) -> dict[str, gpd.GeoDataFrame]:
|
|
89
|
+
pass
|
|
90
|
+
|
|
91
|
+
@abstractmethod
|
|
92
|
+
def get_aggregation_benefits(
|
|
93
|
+
self, benefit_name: str
|
|
94
|
+
) -> dict[str, gpd.GeoDataFrame]:
|
|
95
|
+
pass
|
|
96
|
+
|
|
97
|
+
@abstractmethod
|
|
98
|
+
def get_object_list(self, object_type: str) -> dict[str, Any]:
|
|
99
|
+
pass
|
|
100
|
+
|
|
101
|
+
@abstractmethod
|
|
102
|
+
def has_run_hazard(self, scenario_name: str) -> None:
|
|
103
|
+
pass
|
|
104
|
+
|
|
105
|
+
@abstractmethod
|
|
106
|
+
def cleanup(self) -> None:
|
|
107
|
+
pass
|
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
from abc import ABC, abstractmethod
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from typing import Any, Generic, TypeVar
|
|
4
|
-
|
|
5
|
-
from flood_adapt.objects.object_model import Object
|
|
6
|
-
|
|
7
|
-
T_OBJECT_MODEL = TypeVar("T_OBJECT_MODEL", bound=Object)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class AbstractDatabaseElement(ABC, Generic[T_OBJECT_MODEL]):
|
|
11
|
-
input_path: Path
|
|
12
|
-
output_path: Path
|
|
13
|
-
|
|
14
|
-
@abstractmethod
|
|
15
|
-
def __init__(self):
|
|
16
|
-
"""Abstract class for database elements."""
|
|
17
|
-
pass
|
|
18
|
-
|
|
19
|
-
@abstractmethod
|
|
20
|
-
def get(self, name: str) -> T_OBJECT_MODEL:
|
|
21
|
-
"""Return the object of the type of the database with the given name.
|
|
22
|
-
|
|
23
|
-
Parameters
|
|
24
|
-
----------
|
|
25
|
-
name : str
|
|
26
|
-
name of the object to be returned
|
|
27
|
-
|
|
28
|
-
Returns
|
|
29
|
-
-------
|
|
30
|
-
IObject
|
|
31
|
-
object of the type of the specified object model
|
|
32
|
-
"""
|
|
33
|
-
pass
|
|
34
|
-
|
|
35
|
-
@abstractmethod
|
|
36
|
-
def summarize_objects(self) -> dict[str, list[Any]]:
|
|
37
|
-
"""Return a dictionary with info on the objects that currently exist in the database.
|
|
38
|
-
|
|
39
|
-
Returns
|
|
40
|
-
-------
|
|
41
|
-
dict[str, Any]
|
|
42
|
-
Includes 'name', 'description', 'path' and 'last_modification_date' info, as well as the objects themselves
|
|
43
|
-
"""
|
|
44
|
-
pass
|
|
45
|
-
|
|
46
|
-
@abstractmethod
|
|
47
|
-
def copy(self, old_name: str, new_name: str, new_description: str):
|
|
48
|
-
"""Copy (duplicate) an existing object, and give it a new name.
|
|
49
|
-
|
|
50
|
-
Parameters
|
|
51
|
-
----------
|
|
52
|
-
old_name : str
|
|
53
|
-
name of the existing measure
|
|
54
|
-
new_name : str
|
|
55
|
-
name of the new measure
|
|
56
|
-
new_description : str
|
|
57
|
-
description of the new measure
|
|
58
|
-
"""
|
|
59
|
-
pass
|
|
60
|
-
|
|
61
|
-
@abstractmethod
|
|
62
|
-
def save(
|
|
63
|
-
self,
|
|
64
|
-
object_model: T_OBJECT_MODEL,
|
|
65
|
-
overwrite: bool = False,
|
|
66
|
-
):
|
|
67
|
-
"""Save an object in the database.
|
|
68
|
-
|
|
69
|
-
This only saves the toml file. If the object also contains a geojson file, this should be saved separately.
|
|
70
|
-
|
|
71
|
-
Parameters
|
|
72
|
-
----------
|
|
73
|
-
object_model : Object
|
|
74
|
-
object to be saved in the database
|
|
75
|
-
overwrite : bool, optional
|
|
76
|
-
whether to overwrite the object if it already exists in the
|
|
77
|
-
database, by default False
|
|
78
|
-
toml_only : bool, optional
|
|
79
|
-
whether to only save the toml file or all associated data. By default, save everything
|
|
80
|
-
|
|
81
|
-
Raises
|
|
82
|
-
------
|
|
83
|
-
ValueError
|
|
84
|
-
Raise error if name is already in use.
|
|
85
|
-
"""
|
|
86
|
-
pass
|
|
87
|
-
|
|
88
|
-
@abstractmethod
|
|
89
|
-
def delete(self, name: str, toml_only: bool = False):
|
|
90
|
-
"""Delete an already existing object in the database.
|
|
91
|
-
|
|
92
|
-
Parameters
|
|
93
|
-
----------
|
|
94
|
-
name : str
|
|
95
|
-
name of the object to be deleted
|
|
96
|
-
toml_only : bool, optional
|
|
97
|
-
whether to only delete the toml file or the entire folder. If the folder is empty after deleting the toml,
|
|
98
|
-
it will always be deleted. By default False
|
|
99
|
-
|
|
100
|
-
Raises
|
|
101
|
-
------
|
|
102
|
-
ValueError
|
|
103
|
-
Raise error if object to be deleted is already in use.
|
|
104
|
-
"""
|
|
105
|
-
pass
|
|
106
|
-
|
|
107
|
-
@abstractmethod
|
|
108
|
-
def check_higher_level_usage(self, name: str) -> list[str]:
|
|
109
|
-
"""Check if an object is used in a higher level object.
|
|
110
|
-
|
|
111
|
-
Parameters
|
|
112
|
-
----------
|
|
113
|
-
name : str
|
|
114
|
-
name of the object to be checked
|
|
115
|
-
|
|
116
|
-
Returns
|
|
117
|
-
-------
|
|
118
|
-
list[str]
|
|
119
|
-
list of higher level objects that use the object
|
|
120
|
-
"""
|
|
121
|
-
pass
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Any, Generic, TypeVar
|
|
4
|
+
|
|
5
|
+
from flood_adapt.objects.object_model import Object
|
|
6
|
+
|
|
7
|
+
T_OBJECT_MODEL = TypeVar("T_OBJECT_MODEL", bound=Object)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class AbstractDatabaseElement(ABC, Generic[T_OBJECT_MODEL]):
|
|
11
|
+
input_path: Path
|
|
12
|
+
output_path: Path
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def __init__(self):
|
|
16
|
+
"""Abstract class for database elements."""
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def get(self, name: str) -> T_OBJECT_MODEL:
|
|
21
|
+
"""Return the object of the type of the database with the given name.
|
|
22
|
+
|
|
23
|
+
Parameters
|
|
24
|
+
----------
|
|
25
|
+
name : str
|
|
26
|
+
name of the object to be returned
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
IObject
|
|
31
|
+
object of the type of the specified object model
|
|
32
|
+
"""
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
@abstractmethod
|
|
36
|
+
def summarize_objects(self) -> dict[str, list[Any]]:
|
|
37
|
+
"""Return a dictionary with info on the objects that currently exist in the database.
|
|
38
|
+
|
|
39
|
+
Returns
|
|
40
|
+
-------
|
|
41
|
+
dict[str, Any]
|
|
42
|
+
Includes 'name', 'description', 'path' and 'last_modification_date' info, as well as the objects themselves
|
|
43
|
+
"""
|
|
44
|
+
pass
|
|
45
|
+
|
|
46
|
+
@abstractmethod
|
|
47
|
+
def copy(self, old_name: str, new_name: str, new_description: str):
|
|
48
|
+
"""Copy (duplicate) an existing object, and give it a new name.
|
|
49
|
+
|
|
50
|
+
Parameters
|
|
51
|
+
----------
|
|
52
|
+
old_name : str
|
|
53
|
+
name of the existing measure
|
|
54
|
+
new_name : str
|
|
55
|
+
name of the new measure
|
|
56
|
+
new_description : str
|
|
57
|
+
description of the new measure
|
|
58
|
+
"""
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
@abstractmethod
|
|
62
|
+
def save(
|
|
63
|
+
self,
|
|
64
|
+
object_model: T_OBJECT_MODEL,
|
|
65
|
+
overwrite: bool = False,
|
|
66
|
+
):
|
|
67
|
+
"""Save an object in the database.
|
|
68
|
+
|
|
69
|
+
This only saves the toml file. If the object also contains a geojson file, this should be saved separately.
|
|
70
|
+
|
|
71
|
+
Parameters
|
|
72
|
+
----------
|
|
73
|
+
object_model : Object
|
|
74
|
+
object to be saved in the database
|
|
75
|
+
overwrite : bool, optional
|
|
76
|
+
whether to overwrite the object if it already exists in the
|
|
77
|
+
database, by default False
|
|
78
|
+
toml_only : bool, optional
|
|
79
|
+
whether to only save the toml file or all associated data. By default, save everything
|
|
80
|
+
|
|
81
|
+
Raises
|
|
82
|
+
------
|
|
83
|
+
ValueError
|
|
84
|
+
Raise error if name is already in use.
|
|
85
|
+
"""
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
@abstractmethod
|
|
89
|
+
def delete(self, name: str, toml_only: bool = False):
|
|
90
|
+
"""Delete an already existing object in the database.
|
|
91
|
+
|
|
92
|
+
Parameters
|
|
93
|
+
----------
|
|
94
|
+
name : str
|
|
95
|
+
name of the object to be deleted
|
|
96
|
+
toml_only : bool, optional
|
|
97
|
+
whether to only delete the toml file or the entire folder. If the folder is empty after deleting the toml,
|
|
98
|
+
it will always be deleted. By default False
|
|
99
|
+
|
|
100
|
+
Raises
|
|
101
|
+
------
|
|
102
|
+
ValueError
|
|
103
|
+
Raise error if object to be deleted is already in use.
|
|
104
|
+
"""
|
|
105
|
+
pass
|
|
106
|
+
|
|
107
|
+
@abstractmethod
|
|
108
|
+
def check_higher_level_usage(self, name: str) -> list[str]:
|
|
109
|
+
"""Check if an object is used in a higher level object.
|
|
110
|
+
|
|
111
|
+
Parameters
|
|
112
|
+
----------
|
|
113
|
+
name : str
|
|
114
|
+
name of the object to be checked
|
|
115
|
+
|
|
116
|
+
Returns
|
|
117
|
+
-------
|
|
118
|
+
list[str]
|
|
119
|
+
list of higher level objects that use the object
|
|
120
|
+
"""
|
|
121
|
+
pass
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
from abc import ABC, abstractmethod
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from typing import Union
|
|
4
|
-
|
|
5
|
-
import geopandas as gpd
|
|
6
|
-
import pandas as pd
|
|
7
|
-
from cht_cyclones.cyclone_track_database import CycloneTrackDatabase
|
|
8
|
-
|
|
9
|
-
from flood_adapt.adapter.sfincs_adapter import SfincsAdapter
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class IDbsStatic(ABC):
|
|
13
|
-
@abstractmethod
|
|
14
|
-
def get_aggregation_areas(self) -> dict: ...
|
|
15
|
-
|
|
16
|
-
@abstractmethod
|
|
17
|
-
def get_model_boundary(self) -> gpd.GeoDataFrame: ...
|
|
18
|
-
|
|
19
|
-
@abstractmethod
|
|
20
|
-
def get_model_grid(self): ...
|
|
21
|
-
|
|
22
|
-
@abstractmethod
|
|
23
|
-
def get_obs_points(self) -> gpd.GeoDataFrame: ...
|
|
24
|
-
|
|
25
|
-
@abstractmethod
|
|
26
|
-
def get_static_map(self, path: Union[str, Path]) -> gpd.GeoDataFrame: ...
|
|
27
|
-
|
|
28
|
-
@abstractmethod
|
|
29
|
-
def get_slr_scn_names(self) -> list: ...
|
|
30
|
-
|
|
31
|
-
@abstractmethod
|
|
32
|
-
def get_green_infra_table(self, measure_type: str) -> pd.DataFrame: ...
|
|
33
|
-
|
|
34
|
-
@abstractmethod
|
|
35
|
-
def get_buildings(self) -> gpd.GeoDataFrame: ...
|
|
36
|
-
|
|
37
|
-
@abstractmethod
|
|
38
|
-
def get_property_types(self) -> list: ...
|
|
39
|
-
|
|
40
|
-
@abstractmethod
|
|
41
|
-
def get_overland_sfincs_model(self) -> SfincsAdapter: ...
|
|
42
|
-
|
|
43
|
-
@abstractmethod
|
|
44
|
-
def get_offshore_sfincs_model(self) -> SfincsAdapter: ...
|
|
45
|
-
|
|
46
|
-
@abstractmethod
|
|
47
|
-
def get_cyclone_track_database(self) -> CycloneTrackDatabase: ...
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Union
|
|
4
|
+
|
|
5
|
+
import geopandas as gpd
|
|
6
|
+
import pandas as pd
|
|
7
|
+
from cht_cyclones.cyclone_track_database import CycloneTrackDatabase
|
|
8
|
+
|
|
9
|
+
from flood_adapt.adapter.sfincs_adapter import SfincsAdapter
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IDbsStatic(ABC):
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def get_aggregation_areas(self) -> dict: ...
|
|
15
|
+
|
|
16
|
+
@abstractmethod
|
|
17
|
+
def get_model_boundary(self) -> gpd.GeoDataFrame: ...
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def get_model_grid(self): ...
|
|
21
|
+
|
|
22
|
+
@abstractmethod
|
|
23
|
+
def get_obs_points(self) -> gpd.GeoDataFrame: ...
|
|
24
|
+
|
|
25
|
+
@abstractmethod
|
|
26
|
+
def get_static_map(self, path: Union[str, Path]) -> gpd.GeoDataFrame: ...
|
|
27
|
+
|
|
28
|
+
@abstractmethod
|
|
29
|
+
def get_slr_scn_names(self) -> list: ...
|
|
30
|
+
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def get_green_infra_table(self, measure_type: str) -> pd.DataFrame: ...
|
|
33
|
+
|
|
34
|
+
@abstractmethod
|
|
35
|
+
def get_buildings(self) -> gpd.GeoDataFrame: ...
|
|
36
|
+
|
|
37
|
+
@abstractmethod
|
|
38
|
+
def get_property_types(self) -> list: ...
|
|
39
|
+
|
|
40
|
+
@abstractmethod
|
|
41
|
+
def get_overland_sfincs_model(self) -> SfincsAdapter: ...
|
|
42
|
+
|
|
43
|
+
@abstractmethod
|
|
44
|
+
def get_offshore_sfincs_model(self) -> SfincsAdapter: ...
|
|
45
|
+
|
|
46
|
+
@abstractmethod
|
|
47
|
+
def get_cyclone_track_database(self) -> CycloneTrackDatabase: ...
|