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.
Files changed (100) hide show
  1. flood_adapt/__init__.py +26 -22
  2. flood_adapt/adapter/__init__.py +9 -9
  3. flood_adapt/adapter/fiat_adapter.py +1541 -1541
  4. flood_adapt/adapter/interface/hazard_adapter.py +70 -70
  5. flood_adapt/adapter/interface/impact_adapter.py +36 -36
  6. flood_adapt/adapter/interface/model_adapter.py +89 -89
  7. flood_adapt/adapter/interface/offshore.py +19 -19
  8. flood_adapt/adapter/sfincs_adapter.py +1848 -1848
  9. flood_adapt/adapter/sfincs_offshore.py +193 -193
  10. flood_adapt/config/config.py +248 -248
  11. flood_adapt/config/fiat.py +219 -219
  12. flood_adapt/config/gui.py +331 -331
  13. flood_adapt/config/sfincs.py +481 -336
  14. flood_adapt/config/site.py +129 -129
  15. flood_adapt/database_builder/database_builder.py +2210 -2210
  16. flood_adapt/database_builder/templates/default_units/imperial.toml +9 -9
  17. flood_adapt/database_builder/templates/default_units/metric.toml +9 -9
  18. flood_adapt/database_builder/templates/green_infra_table/green_infra_lookup_table.csv +10 -10
  19. flood_adapt/database_builder/templates/infographics/OSM/config_charts.toml +90 -90
  20. flood_adapt/database_builder/templates/infographics/OSM/config_people.toml +57 -57
  21. flood_adapt/database_builder/templates/infographics/OSM/config_risk_charts.toml +121 -121
  22. flood_adapt/database_builder/templates/infographics/OSM/config_roads.toml +65 -65
  23. flood_adapt/database_builder/templates/infographics/OSM/styles.css +45 -45
  24. flood_adapt/database_builder/templates/infographics/US_NSI/config_charts.toml +126 -126
  25. flood_adapt/database_builder/templates/infographics/US_NSI/config_people.toml +60 -60
  26. flood_adapt/database_builder/templates/infographics/US_NSI/config_risk_charts.toml +121 -121
  27. flood_adapt/database_builder/templates/infographics/US_NSI/config_roads.toml +65 -65
  28. flood_adapt/database_builder/templates/infographics/US_NSI/styles.css +45 -45
  29. flood_adapt/database_builder/templates/infometrics/OSM/metrics_additional_risk_configs.toml +4 -4
  30. flood_adapt/database_builder/templates/infometrics/OSM/with_SVI/infographic_metrics_config.toml +143 -143
  31. flood_adapt/database_builder/templates/infometrics/OSM/with_SVI/infographic_metrics_config_risk.toml +153 -153
  32. flood_adapt/database_builder/templates/infometrics/OSM/without_SVI/infographic_metrics_config.toml +127 -127
  33. flood_adapt/database_builder/templates/infometrics/OSM/without_SVI/infographic_metrics_config_risk.toml +57 -57
  34. flood_adapt/database_builder/templates/infometrics/US_NSI/metrics_additional_risk_configs.toml +4 -4
  35. flood_adapt/database_builder/templates/infometrics/US_NSI/with_SVI/infographic_metrics_config.toml +191 -191
  36. flood_adapt/database_builder/templates/infometrics/US_NSI/with_SVI/infographic_metrics_config_risk.toml +153 -153
  37. flood_adapt/database_builder/templates/infometrics/US_NSI/without_SVI/infographic_metrics_config.toml +178 -178
  38. flood_adapt/database_builder/templates/infometrics/US_NSI/without_SVI/infographic_metrics_config_risk.toml +57 -57
  39. flood_adapt/database_builder/templates/infometrics/mandatory_metrics_config.toml +9 -9
  40. flood_adapt/database_builder/templates/infometrics/mandatory_metrics_config_risk.toml +65 -65
  41. flood_adapt/database_builder/templates/output_layers/bin_colors.toml +5 -5
  42. flood_adapt/database_builder.py +16 -16
  43. flood_adapt/dbs_classes/__init__.py +21 -21
  44. flood_adapt/dbs_classes/database.py +495 -684
  45. flood_adapt/dbs_classes/dbs_benefit.py +77 -76
  46. flood_adapt/dbs_classes/dbs_event.py +61 -59
  47. flood_adapt/dbs_classes/dbs_measure.py +112 -111
  48. flood_adapt/dbs_classes/dbs_projection.py +34 -34
  49. flood_adapt/dbs_classes/dbs_scenario.py +137 -137
  50. flood_adapt/dbs_classes/dbs_static.py +274 -273
  51. flood_adapt/dbs_classes/dbs_strategy.py +130 -129
  52. flood_adapt/dbs_classes/dbs_template.py +279 -278
  53. flood_adapt/dbs_classes/interface/database.py +107 -139
  54. flood_adapt/dbs_classes/interface/element.py +121 -121
  55. flood_adapt/dbs_classes/interface/static.py +47 -47
  56. flood_adapt/flood_adapt.py +1207 -1178
  57. flood_adapt/misc/database_user.py +16 -16
  58. flood_adapt/misc/exceptions.py +22 -0
  59. flood_adapt/misc/log.py +183 -183
  60. flood_adapt/misc/path_builder.py +54 -54
  61. flood_adapt/misc/utils.py +185 -185
  62. flood_adapt/objects/__init__.py +82 -82
  63. flood_adapt/objects/benefits/benefits.py +61 -61
  64. flood_adapt/objects/events/event_factory.py +135 -135
  65. flood_adapt/objects/events/event_set.py +88 -84
  66. flood_adapt/objects/events/events.py +234 -234
  67. flood_adapt/objects/events/historical.py +58 -58
  68. flood_adapt/objects/events/hurricane.py +68 -67
  69. flood_adapt/objects/events/synthetic.py +46 -50
  70. flood_adapt/objects/forcing/__init__.py +92 -92
  71. flood_adapt/objects/forcing/csv.py +68 -68
  72. flood_adapt/objects/forcing/discharge.py +66 -66
  73. flood_adapt/objects/forcing/forcing.py +150 -150
  74. flood_adapt/objects/forcing/forcing_factory.py +182 -182
  75. flood_adapt/objects/forcing/meteo_handler.py +93 -93
  76. flood_adapt/objects/forcing/netcdf.py +40 -40
  77. flood_adapt/objects/forcing/plotting.py +453 -429
  78. flood_adapt/objects/forcing/rainfall.py +98 -98
  79. flood_adapt/objects/forcing/tide_gauge.py +191 -191
  80. flood_adapt/objects/forcing/time_frame.py +90 -90
  81. flood_adapt/objects/forcing/timeseries.py +564 -564
  82. flood_adapt/objects/forcing/unit_system.py +580 -580
  83. flood_adapt/objects/forcing/waterlevels.py +108 -108
  84. flood_adapt/objects/forcing/wind.py +124 -124
  85. flood_adapt/objects/measures/measure_factory.py +92 -92
  86. flood_adapt/objects/measures/measures.py +529 -529
  87. flood_adapt/objects/object_model.py +74 -68
  88. flood_adapt/objects/projections/projections.py +103 -103
  89. flood_adapt/objects/scenarios/scenarios.py +22 -22
  90. flood_adapt/objects/strategies/strategies.py +89 -89
  91. flood_adapt/workflows/benefit_runner.py +579 -554
  92. flood_adapt/workflows/floodmap.py +85 -85
  93. flood_adapt/workflows/impacts_integrator.py +85 -85
  94. flood_adapt/workflows/scenario_runner.py +70 -70
  95. {flood_adapt-0.3.9.dist-info → flood_adapt-0.3.10.dist-info}/LICENSE +674 -674
  96. {flood_adapt-0.3.9.dist-info → flood_adapt-0.3.10.dist-info}/METADATA +866 -865
  97. flood_adapt-0.3.10.dist-info/RECORD +140 -0
  98. flood_adapt-0.3.9.dist-info/RECORD +0 -139
  99. {flood_adapt-0.3.9.dist-info → flood_adapt-0.3.10.dist-info}/WHEEL +0 -0
  100. {flood_adapt-0.3.9.dist-info → flood_adapt-0.3.10.dist-info}/top_level.txt +0 -0
@@ -1,219 +1,219 @@
1
- from enum import Enum
2
- from pathlib import Path
3
- from typing import Optional
4
-
5
- from pydantic import BaseModel
6
- from tomli import load as load_toml
7
-
8
- from flood_adapt.config.sfincs import FloodmapType
9
-
10
-
11
- class BenefitsModel(BaseModel):
12
- """The accepted input for the variable benefits in Site.
13
-
14
- Attributes
15
- ----------
16
- current_year : int
17
- The current year used in benefits calculations.
18
- current_projection : str
19
- The current projection used in benefits calculations.
20
- baseline_strategy : str
21
- The baseline strategy used in benefits calculations.
22
- event_set : str
23
- The event set used in benefits calculations.
24
- """
25
-
26
- current_year: int
27
- current_projection: str
28
- baseline_strategy: str
29
- event_set: str
30
-
31
-
32
- class EquityModel(BaseModel):
33
- """
34
- The accepted input for the variable equity in Site.
35
-
36
- Attributes
37
- ----------
38
- census_data : str
39
- TODO
40
- percapitaincome_label : Optional[str], default="PerCapitaIncome"
41
- TODO
42
- totalpopulation_label : Optional[str], default="TotalPopulation"
43
- TODO
44
- """
45
-
46
- census_data: str
47
- percapitaincome_label: Optional[str] = "PerCapitaIncome"
48
- totalpopulation_label: Optional[str] = "TotalPopulation"
49
-
50
-
51
- class AggregationModel(BaseModel):
52
- """The accepted input for the variable aggregation in Site.
53
-
54
- Attributes
55
- ----------
56
- name : str
57
- TODO
58
- file : str
59
- TODO
60
- field_name : str
61
- TODO
62
- equity : Optional[EquityModel], default=None
63
- TODO
64
- """
65
-
66
- name: str
67
- file: str
68
- field_name: str
69
- equity: Optional[EquityModel] = None
70
-
71
-
72
- class BFEModel(BaseModel):
73
- """The accepted input for the variable bfe in Site.
74
-
75
- Attributes
76
- ----------
77
- geom : str
78
- TODO
79
- table : Optional[str], default=None
80
- TODO
81
- field_name : str
82
- TODO
83
- """
84
-
85
- geom: str
86
- table: Optional[str] = None
87
- field_name: str
88
-
89
-
90
- class SVIModel(BaseModel):
91
- """The accepted input for the variable svi in Site.
92
-
93
- Attributes
94
- ----------
95
- geom : str
96
- TODO
97
- field_name : str
98
- TODO
99
- """
100
-
101
- geom: str
102
- field_name: str
103
-
104
-
105
- class NoFootprintsModel(BaseModel):
106
- """
107
- The configuration on the how to show objects with no footprints.
108
-
109
- Attributes
110
- ----------
111
- shape : Optional[str], default="triangle"
112
- The shape of the object with no footprints.
113
- diameter_meters : Optional[float], default=10
114
- The diameter of the object with no footprints in meters.
115
- """
116
-
117
- shape: Optional[str] = "triangle"
118
- diameter_meters: Optional[float] = 10
119
-
120
-
121
- class RiskModel(BaseModel):
122
- """The accepted input for the variable risk in Site.
123
-
124
- Attributes
125
- ----------
126
- return_periods : list[int]
127
- The return periods for the risk model.
128
- """
129
-
130
- return_periods: list = [1, 2, 5, 10, 25, 50, 100]
131
-
132
-
133
- class DamageType(str, Enum):
134
- """The accepted input for the variable footprints_dmg_type."""
135
-
136
- absolute = "absolute"
137
- relative = "relative"
138
-
139
-
140
- class FiatConfigModel(BaseModel):
141
- """Configuration settings for the FIAT model.
142
-
143
- Attributes
144
- ----------
145
- exposure_crs : str
146
- The coordinate reference system of the exposure data.
147
- bfe : Optional[BFEModel], default=None
148
- The base flood elevation model.
149
- aggregation : list[AggregationModel]
150
- Configuration for the aggregation model.
151
- floodmap_type : FloodmapType
152
- The type of flood map to be used.
153
- non_building_names : Optional[list[str]], default=None
154
- List of non-building names to be used in the model.
155
- damage_unit : str, default="$"
156
- The unit of damage used in the model.
157
- building_footprints : Optional[str], default=None
158
- Path to the building footprints data.
159
- roads_file_name : Optional[str], default=None
160
- Path to the roads data.
161
- new_development_file_name : Optional[str], default="new_development_area.gpkg"
162
- Path to the new development area data.
163
- save_simulation : Optional[bool], default=False
164
- Whether to keep or delete the simulation files after the simulation is finished and all output files are created.
165
- If True, the simulation files are kept. If False, the simulation files are deleted.
166
- svi : Optional[SVIModel], default=None
167
- The social vulnerability index model.
168
- infographics : Optional[bool], default=False
169
- Whether to create infographics or not.
170
- no_footprints : Optional[NoFootprintsModel], default=NoFootprintsModel()
171
- Configuration for objects with no footprints.
172
- """
173
-
174
- exposure_crs: str
175
- bfe: Optional[BFEModel] = None
176
- aggregation: list[AggregationModel]
177
- floodmap_type: FloodmapType
178
- non_building_names: Optional[list[str]]
179
- damage_unit: str = "$"
180
- building_footprints: Optional[str] = None
181
- roads_file_name: Optional[str] = None
182
- new_development_file_name: Optional[str] = "new_development_area.gpkg"
183
- save_simulation: Optional[bool] = False
184
- svi: Optional[SVIModel] = None
185
- infographics: Optional[bool] = False
186
- no_footprints: Optional[NoFootprintsModel] = NoFootprintsModel()
187
-
188
- @staticmethod
189
- def read_toml(path: Path) -> "FiatConfigModel":
190
- with open(path, mode="rb") as fp:
191
- toml_contents = load_toml(fp)
192
-
193
- return FiatConfigModel(**toml_contents)
194
-
195
-
196
- class FiatModel(BaseModel):
197
- """The expected variables and data types of attributes of the Fiat class.
198
-
199
- Attributes
200
- ----------
201
- risk : Optional[RiskModel]
202
- Configuration of probabilistic risk runs. default=None
203
- config : FiatConfigModel
204
- Configuration for the FIAT model.
205
- benefits : Optional[BenefitsModel]
206
- Configuration for running benefit calculations. default=None
207
- """
208
-
209
- config: FiatConfigModel
210
-
211
- benefits: Optional[BenefitsModel] = None
212
- risk: Optional[RiskModel] = RiskModel()
213
-
214
- @staticmethod
215
- def read_toml(path: Path) -> "FiatModel":
216
- with open(path, mode="rb") as fp:
217
- toml_contents = load_toml(fp)
218
-
219
- return FiatModel(**toml_contents)
1
+ from enum import Enum
2
+ from pathlib import Path
3
+ from typing import Optional
4
+
5
+ from pydantic import BaseModel
6
+ from tomli import load as load_toml
7
+
8
+ from flood_adapt.config.sfincs import FloodmapType
9
+
10
+
11
+ class BenefitsModel(BaseModel):
12
+ """The accepted input for the variable benefits in Site.
13
+
14
+ Attributes
15
+ ----------
16
+ current_year : int
17
+ The current year used in benefits calculations.
18
+ current_projection : str
19
+ The current projection used in benefits calculations.
20
+ baseline_strategy : str
21
+ The baseline strategy used in benefits calculations.
22
+ event_set : str
23
+ The event set used in benefits calculations.
24
+ """
25
+
26
+ current_year: int
27
+ current_projection: str
28
+ baseline_strategy: str
29
+ event_set: str
30
+
31
+
32
+ class EquityModel(BaseModel):
33
+ """
34
+ The accepted input for the variable equity in Site.
35
+
36
+ Attributes
37
+ ----------
38
+ census_data : str
39
+ TODO
40
+ percapitaincome_label : Optional[str], default="PerCapitaIncome"
41
+ TODO
42
+ totalpopulation_label : Optional[str], default="TotalPopulation"
43
+ TODO
44
+ """
45
+
46
+ census_data: str
47
+ percapitaincome_label: Optional[str] = "PerCapitaIncome"
48
+ totalpopulation_label: Optional[str] = "TotalPopulation"
49
+
50
+
51
+ class AggregationModel(BaseModel):
52
+ """The accepted input for the variable aggregation in Site.
53
+
54
+ Attributes
55
+ ----------
56
+ name : str
57
+ TODO
58
+ file : str
59
+ TODO
60
+ field_name : str
61
+ TODO
62
+ equity : Optional[EquityModel], default=None
63
+ TODO
64
+ """
65
+
66
+ name: str
67
+ file: str
68
+ field_name: str
69
+ equity: Optional[EquityModel] = None
70
+
71
+
72
+ class BFEModel(BaseModel):
73
+ """The accepted input for the variable bfe in Site.
74
+
75
+ Attributes
76
+ ----------
77
+ geom : str
78
+ TODO
79
+ table : Optional[str], default=None
80
+ TODO
81
+ field_name : str
82
+ TODO
83
+ """
84
+
85
+ geom: str
86
+ table: Optional[str] = None
87
+ field_name: str
88
+
89
+
90
+ class SVIModel(BaseModel):
91
+ """The accepted input for the variable svi in Site.
92
+
93
+ Attributes
94
+ ----------
95
+ geom : str
96
+ TODO
97
+ field_name : str
98
+ TODO
99
+ """
100
+
101
+ geom: str
102
+ field_name: str
103
+
104
+
105
+ class NoFootprintsModel(BaseModel):
106
+ """
107
+ The configuration on the how to show objects with no footprints.
108
+
109
+ Attributes
110
+ ----------
111
+ shape : Optional[str], default="triangle"
112
+ The shape of the object with no footprints.
113
+ diameter_meters : Optional[float], default=10
114
+ The diameter of the object with no footprints in meters.
115
+ """
116
+
117
+ shape: Optional[str] = "triangle"
118
+ diameter_meters: Optional[float] = 10
119
+
120
+
121
+ class RiskModel(BaseModel):
122
+ """The accepted input for the variable risk in Site.
123
+
124
+ Attributes
125
+ ----------
126
+ return_periods : list[int]
127
+ The return periods for the risk model.
128
+ """
129
+
130
+ return_periods: list = [1, 2, 5, 10, 25, 50, 100]
131
+
132
+
133
+ class DamageType(str, Enum):
134
+ """The accepted input for the variable footprints_dmg_type."""
135
+
136
+ absolute = "absolute"
137
+ relative = "relative"
138
+
139
+
140
+ class FiatConfigModel(BaseModel):
141
+ """Configuration settings for the FIAT model.
142
+
143
+ Attributes
144
+ ----------
145
+ exposure_crs : str
146
+ The coordinate reference system of the exposure data.
147
+ bfe : Optional[BFEModel], default=None
148
+ The base flood elevation model.
149
+ aggregation : list[AggregationModel]
150
+ Configuration for the aggregation model.
151
+ floodmap_type : FloodmapType
152
+ The type of flood map to be used.
153
+ non_building_names : Optional[list[str]], default=None
154
+ List of non-building names to be used in the model.
155
+ damage_unit : str, default="$"
156
+ The unit of damage used in the model.
157
+ building_footprints : Optional[str], default=None
158
+ Path to the building footprints data.
159
+ roads_file_name : Optional[str], default=None
160
+ Path to the roads data.
161
+ new_development_file_name : Optional[str], default="new_development_area.gpkg"
162
+ Path to the new development area data.
163
+ save_simulation : Optional[bool], default=False
164
+ Whether to keep or delete the simulation files after the simulation is finished and all output files are created.
165
+ If True, the simulation files are kept. If False, the simulation files are deleted.
166
+ svi : Optional[SVIModel], default=None
167
+ The social vulnerability index model.
168
+ infographics : Optional[bool], default=False
169
+ Whether to create infographics or not.
170
+ no_footprints : Optional[NoFootprintsModel], default=NoFootprintsModel()
171
+ Configuration for objects with no footprints.
172
+ """
173
+
174
+ exposure_crs: str
175
+ bfe: Optional[BFEModel] = None
176
+ aggregation: list[AggregationModel]
177
+ floodmap_type: FloodmapType
178
+ non_building_names: Optional[list[str]]
179
+ damage_unit: str = "$"
180
+ building_footprints: Optional[str] = None
181
+ roads_file_name: Optional[str] = None
182
+ new_development_file_name: Optional[str] = "new_development_area.gpkg"
183
+ save_simulation: Optional[bool] = False
184
+ svi: Optional[SVIModel] = None
185
+ infographics: Optional[bool] = False
186
+ no_footprints: Optional[NoFootprintsModel] = NoFootprintsModel()
187
+
188
+ @staticmethod
189
+ def read_toml(path: Path) -> "FiatConfigModel":
190
+ with open(path, mode="rb") as fp:
191
+ toml_contents = load_toml(fp)
192
+
193
+ return FiatConfigModel(**toml_contents)
194
+
195
+
196
+ class FiatModel(BaseModel):
197
+ """The expected variables and data types of attributes of the Fiat class.
198
+
199
+ Attributes
200
+ ----------
201
+ risk : Optional[RiskModel]
202
+ Configuration of probabilistic risk runs. default=None
203
+ config : FiatConfigModel
204
+ Configuration for the FIAT model.
205
+ benefits : Optional[BenefitsModel]
206
+ Configuration for running benefit calculations. default=None
207
+ """
208
+
209
+ config: FiatConfigModel
210
+
211
+ benefits: Optional[BenefitsModel] = None
212
+ risk: Optional[RiskModel] = RiskModel()
213
+
214
+ @staticmethod
215
+ def read_toml(path: Path) -> "FiatModel":
216
+ with open(path, mode="rb") as fp:
217
+ toml_contents = load_toml(fp)
218
+
219
+ return FiatModel(**toml_contents)