flood-adapt 0.3.6__py3-none-any.whl → 0.3.7__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 +1 -1
- flood_adapt/adapter/sfincs_adapter.py +7 -11
- flood_adapt/config/site.py +5 -0
- flood_adapt/dbs_classes/database.py +9 -3
- flood_adapt/dbs_classes/dbs_event.py +0 -20
- flood_adapt/dbs_classes/dbs_projection.py +0 -21
- flood_adapt/dbs_classes/dbs_static.py +13 -0
- flood_adapt/dbs_classes/dbs_strategy.py +0 -20
- flood_adapt/dbs_classes/dbs_template.py +7 -5
- flood_adapt/flood_adapt.py +7 -0
- {flood_adapt-0.3.6.dist-info → flood_adapt-0.3.7.dist-info}/METADATA +1 -1
- {flood_adapt-0.3.6.dist-info → flood_adapt-0.3.7.dist-info}/RECORD +15 -15
- {flood_adapt-0.3.6.dist-info → flood_adapt-0.3.7.dist-info}/LICENSE +0 -0
- {flood_adapt-0.3.6.dist-info → flood_adapt-0.3.7.dist-info}/WHEEL +0 -0
- {flood_adapt-0.3.6.dist-info → flood_adapt-0.3.7.dist-info}/top_level.txt +0 -0
flood_adapt/__init__.py
CHANGED
|
@@ -1309,15 +1309,11 @@ class SfincsAdapter(IHazardAdapter):
|
|
|
1309
1309
|
# Make sure no multipolygons are there
|
|
1310
1310
|
gdf_green_infra = gdf_green_infra.explode()
|
|
1311
1311
|
|
|
1312
|
-
# Volume is always already calculated and is converted to m3 for SFINCS
|
|
1313
|
-
height = None
|
|
1314
|
-
volume = green_infrastructure.volume.convert(
|
|
1315
|
-
us.UnitTypesVolume(us.UnitTypesVolume.m3)
|
|
1316
|
-
)
|
|
1317
|
-
|
|
1318
1312
|
# HydroMT function: create storage volume
|
|
1319
1313
|
self._model.setup_storage_volume(
|
|
1320
|
-
storage_locs=gdf_green_infra,
|
|
1314
|
+
storage_locs=gdf_green_infra,
|
|
1315
|
+
volume=green_infrastructure.volume.convert(us.UnitTypesVolume.m3),
|
|
1316
|
+
merge=True,
|
|
1321
1317
|
)
|
|
1322
1318
|
|
|
1323
1319
|
def _add_measure_pump(self, pump: Pump):
|
|
@@ -1681,10 +1677,6 @@ class SfincsAdapter(IHazardAdapter):
|
|
|
1681
1677
|
else:
|
|
1682
1678
|
return spw_file
|
|
1683
1679
|
|
|
1684
|
-
self.logger.info(
|
|
1685
|
-
f"Creating spiderweb file for hurricane event `{name}`. This may take a while."
|
|
1686
|
-
)
|
|
1687
|
-
|
|
1688
1680
|
# Initialize the tropical cyclone
|
|
1689
1681
|
tc = TropicalCyclone()
|
|
1690
1682
|
tc.read_track(filename=str(track_forcing.path), fmt="ddb_cyc")
|
|
@@ -1699,6 +1691,10 @@ class SfincsAdapter(IHazardAdapter):
|
|
|
1699
1691
|
self.logger.info(f"{start} rainfall in the spiderweb file")
|
|
1700
1692
|
tc.include_rainfall = include_rainfall
|
|
1701
1693
|
|
|
1694
|
+
self.logger.info(
|
|
1695
|
+
f"Creating spiderweb file for hurricane event `{name}`. This may take a while."
|
|
1696
|
+
)
|
|
1697
|
+
|
|
1702
1698
|
# Create spiderweb file from the track
|
|
1703
1699
|
tc.to_spiderweb(spw_file)
|
|
1704
1700
|
|
flood_adapt/config/site.py
CHANGED
|
@@ -66,6 +66,11 @@ class Site(BaseModel):
|
|
|
66
66
|
"description": self.description,
|
|
67
67
|
"lat": self.lat,
|
|
68
68
|
"lon": self.lon,
|
|
69
|
+
"standard_objects": {
|
|
70
|
+
"events": self.standard_objects.events,
|
|
71
|
+
"projections": self.standard_objects.projections,
|
|
72
|
+
"strategies": self.standard_objects.strategies,
|
|
73
|
+
},
|
|
69
74
|
"components": {},
|
|
70
75
|
}
|
|
71
76
|
|
|
@@ -123,11 +123,17 @@ class Database(IDatabase):
|
|
|
123
123
|
|
|
124
124
|
# Initialize the different database objects
|
|
125
125
|
self._static = DbsStatic(self)
|
|
126
|
-
self._events = DbsEvent(
|
|
126
|
+
self._events = DbsEvent(
|
|
127
|
+
self, standard_objects=self.site.standard_objects.events
|
|
128
|
+
)
|
|
127
129
|
self._scenarios = DbsScenario(self)
|
|
128
|
-
self._strategies = DbsStrategy(
|
|
130
|
+
self._strategies = DbsStrategy(
|
|
131
|
+
self, standard_objects=self.site.standard_objects.strategies
|
|
132
|
+
)
|
|
129
133
|
self._measures = DbsMeasure(self)
|
|
130
|
-
self._projections = DbsProjection(
|
|
134
|
+
self._projections = DbsProjection(
|
|
135
|
+
self, standard_objects=self.site.standard_objects.projections
|
|
136
|
+
)
|
|
131
137
|
self._benefits = DbsBenefit(self)
|
|
132
138
|
|
|
133
139
|
# Delete any unfinished/crashed scenario output
|
|
@@ -33,26 +33,6 @@ class DbsEvent(DbsTemplate[Event]):
|
|
|
33
33
|
# Load event
|
|
34
34
|
return EventFactory.load_file(event_path)
|
|
35
35
|
|
|
36
|
-
def _check_standard_objects(self, name: str) -> bool:
|
|
37
|
-
"""Check if an event is a standard event.
|
|
38
|
-
|
|
39
|
-
Parameters
|
|
40
|
-
----------
|
|
41
|
-
name : str
|
|
42
|
-
name of the event to be checked
|
|
43
|
-
|
|
44
|
-
Returns
|
|
45
|
-
-------
|
|
46
|
-
bool
|
|
47
|
-
True if the event is a standard event, False otherwise
|
|
48
|
-
"""
|
|
49
|
-
# Check if event is a standard event
|
|
50
|
-
if self._database.site.standard_objects:
|
|
51
|
-
if self._database.site.standard_objects.events:
|
|
52
|
-
if name in self._database.site.standard_objects.events:
|
|
53
|
-
return True
|
|
54
|
-
return False
|
|
55
|
-
|
|
56
36
|
def check_higher_level_usage(self, name: str) -> list[str]:
|
|
57
37
|
"""Check if an event is used in a scenario.
|
|
58
38
|
|
|
@@ -7,27 +7,6 @@ class DbsProjection(DbsTemplate[Projection]):
|
|
|
7
7
|
display_name = "Projection"
|
|
8
8
|
_object_class = Projection
|
|
9
9
|
|
|
10
|
-
def _check_standard_objects(self, name: str) -> bool:
|
|
11
|
-
"""Check if a projection is a standard projection.
|
|
12
|
-
|
|
13
|
-
Parameters
|
|
14
|
-
----------
|
|
15
|
-
name : str
|
|
16
|
-
name of the projection to be checked
|
|
17
|
-
|
|
18
|
-
Raises
|
|
19
|
-
------
|
|
20
|
-
ValueError
|
|
21
|
-
Raise error if projection is a standard projection.
|
|
22
|
-
"""
|
|
23
|
-
# Check if projection is a standard projection
|
|
24
|
-
if self._database.site.standard_objects:
|
|
25
|
-
if self._database.site.standard_objects.projections:
|
|
26
|
-
if name in self._database.site.standard_objects.projections:
|
|
27
|
-
return True
|
|
28
|
-
|
|
29
|
-
return False
|
|
30
|
-
|
|
31
10
|
def check_higher_level_usage(self, name: str) -> list[str]:
|
|
32
11
|
"""Check if a projection is used in a scenario.
|
|
33
12
|
|
|
@@ -39,6 +39,19 @@ class DbsStatic(IDbsStatic):
|
|
|
39
39
|
"""Initialize any necessary attributes."""
|
|
40
40
|
self._database = database
|
|
41
41
|
|
|
42
|
+
def load_static_data(self):
|
|
43
|
+
"""Read data into the cache.
|
|
44
|
+
|
|
45
|
+
This is used to read data from the database and store it in the cache.
|
|
46
|
+
"""
|
|
47
|
+
self.get_aggregation_areas()
|
|
48
|
+
self.get_model_boundary()
|
|
49
|
+
self.get_model_grid()
|
|
50
|
+
self.get_obs_points()
|
|
51
|
+
self.get_slr_scn_names()
|
|
52
|
+
self.get_buildings()
|
|
53
|
+
self.get_property_types()
|
|
54
|
+
|
|
42
55
|
@cache_method_wrapper
|
|
43
56
|
def get_aggregation_areas(self) -> dict[str, gpd.GeoDataFrame]:
|
|
44
57
|
"""Get a list of the aggregation areas that are provided in the site configuration.
|
|
@@ -104,26 +104,6 @@ class DbsStrategy(DbsTemplate[Strategy]):
|
|
|
104
104
|
counter += 1
|
|
105
105
|
raise ValueError(msg)
|
|
106
106
|
|
|
107
|
-
def _check_standard_objects(self, name: str) -> bool:
|
|
108
|
-
"""Check if a strategy is a standard strategy.
|
|
109
|
-
|
|
110
|
-
Parameters
|
|
111
|
-
----------
|
|
112
|
-
name : str
|
|
113
|
-
name of the strategy to be checked
|
|
114
|
-
|
|
115
|
-
Raises
|
|
116
|
-
------
|
|
117
|
-
ValueError
|
|
118
|
-
Raise error if strategy is a standard strategy.
|
|
119
|
-
"""
|
|
120
|
-
# Check if strategy is a standard strategy
|
|
121
|
-
if self._database.site.standard_objects:
|
|
122
|
-
if self._database.site.standard_objects.strategies:
|
|
123
|
-
if name in self._database.site.standard_objects.strategies:
|
|
124
|
-
return True
|
|
125
|
-
return False
|
|
126
|
-
|
|
127
107
|
def check_higher_level_usage(self, name: str) -> list[str]:
|
|
128
108
|
"""Check if a strategy is used in a scenario.
|
|
129
109
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import shutil
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from typing import Any, TypeVar
|
|
4
|
+
from typing import Any, Optional, TypeVar
|
|
5
5
|
|
|
6
6
|
import tomli
|
|
7
7
|
import tomli_w
|
|
@@ -18,12 +18,14 @@ class DbsTemplate(AbstractDatabaseElement[T_OBJECTMODEL]):
|
|
|
18
18
|
dir_name: str
|
|
19
19
|
_object_class: type[T_OBJECTMODEL]
|
|
20
20
|
|
|
21
|
-
def __init__(
|
|
21
|
+
def __init__(
|
|
22
|
+
self, database: IDatabase, standard_objects: Optional[list[str]] = None
|
|
23
|
+
):
|
|
22
24
|
"""Initialize any necessary attributes."""
|
|
23
25
|
self._database = database
|
|
24
26
|
self.input_path = database.input_path / self.dir_name
|
|
25
27
|
self.output_path = database.output_path / self.dir_name
|
|
26
|
-
self.standard_objects =
|
|
28
|
+
self.standard_objects = standard_objects
|
|
27
29
|
|
|
28
30
|
def get(self, name: str) -> T_OBJECTMODEL:
|
|
29
31
|
"""Return an object of the type of the database with the given name.
|
|
@@ -188,8 +190,8 @@ class DbsTemplate(AbstractDatabaseElement[T_OBJECTMODEL]):
|
|
|
188
190
|
bool
|
|
189
191
|
True if the object is a standard object, False otherwise
|
|
190
192
|
"""
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
if self.standard_objects:
|
|
194
|
+
return name in self.standard_objects
|
|
193
195
|
return False
|
|
194
196
|
|
|
195
197
|
def check_higher_level_usage(self, name: str) -> list[str]:
|
flood_adapt/flood_adapt.py
CHANGED
|
@@ -923,6 +923,13 @@ class FloodAdapt:
|
|
|
923
923
|
)
|
|
924
924
|
|
|
925
925
|
# Static
|
|
926
|
+
def load_static_data(self):
|
|
927
|
+
"""Read the static data into the cache.
|
|
928
|
+
|
|
929
|
+
This is used to speed up the loading of the static data.
|
|
930
|
+
"""
|
|
931
|
+
self.database.static.load_static_data()
|
|
932
|
+
|
|
926
933
|
def get_aggregation_areas(
|
|
927
934
|
self,
|
|
928
935
|
) -> dict[str, gpd.GeoDataFrame]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: flood-adapt
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.7
|
|
4
4
|
Summary: A software package support system which can be used to assess the benefits and costs of flood resilience measures
|
|
5
5
|
Author-email: Gundula Winter <Gundula.Winter@deltares.nl>, Panos Athanasiou <Panos.Athanasiou@deltares.nl>, Frederique de Groen <Frederique.deGroen@deltares.nl>, Tim de Wilde <Tim.deWilde@deltares.nl>, Julian Hofer <Julian.Hofer@deltares.nl>, Daley Adrichem <Daley.Adrichem@deltares.nl>, Luuk Blom <Luuk.Blom@deltares.nl>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
flood_adapt/__init__.py,sha256=
|
|
1
|
+
flood_adapt/__init__.py,sha256=3yTRhIjKIPsLp4mwacrItlPRgNQWOePbrEkV31CWB8E,596
|
|
2
2
|
flood_adapt/database_builder.py,sha256=eq_LAqaGpV-KJkLNBVvXjyjFRDQaBFA5ubANiuVsZWU,420
|
|
3
|
-
flood_adapt/flood_adapt.py,sha256=
|
|
3
|
+
flood_adapt/flood_adapt.py,sha256=7xjieOrFQigw7MvLJ9zNXTMKXF70D6zd2mZb6trWYDk,35344
|
|
4
4
|
flood_adapt/adapter/__init__.py,sha256=C6XBZK8x4MHe3beeKa9rPbXn0-gBHPEPnTKn14C-5gI,249
|
|
5
5
|
flood_adapt/adapter/fiat_adapter.py,sha256=2SYHzmW6z5L66S1qD4AlEeCW9deLfLi_h9K7HPFCYRY,57105
|
|
6
|
-
flood_adapt/adapter/sfincs_adapter.py,sha256=
|
|
6
|
+
flood_adapt/adapter/sfincs_adapter.py,sha256=ya7IjcLDe-sy9NSWl39bwp5Twy_PppWbkPkvGBXXH-M,72897
|
|
7
7
|
flood_adapt/adapter/sfincs_offshore.py,sha256=BBdeCYKKDweFla05aE1Q9Fr-eXY1VzxQEfE_74lR7B8,7600
|
|
8
8
|
flood_adapt/adapter/interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
flood_adapt/adapter/interface/hazard_adapter.py,sha256=1yZUNTrT3dtrD_PTJfczVkjNVB9JcQr64Y4xYRtR-sc,2758
|
|
@@ -15,7 +15,7 @@ flood_adapt/config/config.py,sha256=fFCPCSgalQEEZXRP2Ua4oHvMdR8MzBPs5Ohs1mBIQsM,
|
|
|
15
15
|
flood_adapt/config/fiat.py,sha256=dgqmjuA7a6A9_QeQlObzxCG7u_h3Vcb94QOxPGygaLo,6036
|
|
16
16
|
flood_adapt/config/gui.py,sha256=Ji6X9j1gC18evsHfeW3MwtWpOsod9fW0XMfd-GSx3DY,10157
|
|
17
17
|
flood_adapt/config/sfincs.py,sha256=WHPPPtT9vxStsulElB_I8Hbtk3WNJs3Zqy-bfcy68fA,11279
|
|
18
|
-
flood_adapt/config/site.py,sha256=
|
|
18
|
+
flood_adapt/config/site.py,sha256=zKuXCCecwfP6Ri2euhC6KHoANGXTm3NUKgEsxa6rGOg,4199
|
|
19
19
|
flood_adapt/database_builder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
flood_adapt/database_builder/database_builder.py,sha256=mQ1Gy2pKBn8GtvTipQVlTjVGburfq45AG75UGGmF6ac,87541
|
|
21
21
|
flood_adapt/database_builder/templates/default_units/imperial.toml,sha256=EYR0i4T_1fuoDe8R509pTd5fMKWCIaMo-pa6XdqANkA,286
|
|
@@ -75,15 +75,15 @@ flood_adapt/database_builder/templates/infometrics/US_NSI/without_SVI/infographi
|
|
|
75
75
|
flood_adapt/database_builder/templates/infometrics/US_NSI/without_SVI/infographic_metrics_config_risk.toml,sha256=ayNiJHEMdRk82nhfV1srRNavUtxpQEWX71fJf9nsxu4,1988
|
|
76
76
|
flood_adapt/database_builder/templates/output_layers/bin_colors.toml,sha256=OXlAdFfu3S99qrxFqn_Xu6ZIZMvk-0_LQhdsj5q_rZk,412
|
|
77
77
|
flood_adapt/dbs_classes/__init__.py,sha256=_8DX6dK62U1RjRKz0zOgM0yR-kiBlBxz2dLkCWylmXc,710
|
|
78
|
-
flood_adapt/dbs_classes/database.py,sha256=
|
|
78
|
+
flood_adapt/dbs_classes/database.py,sha256=S9C-NOAZNelvFhJ20L_tYVO7lsdad9ZAy5DwYZhz084,24650
|
|
79
79
|
flood_adapt/dbs_classes/dbs_benefit.py,sha256=WgLXG37mrkIUq2cp8Y2ov2FYqxoGXHKe9h-7GnQd4Sw,2502
|
|
80
|
-
flood_adapt/dbs_classes/dbs_event.py,sha256=
|
|
80
|
+
flood_adapt/dbs_classes/dbs_event.py,sha256=UBJ3eYN1Nicx1MBWWBohgUiDXgINotQNDBc8lontsJ4,1618
|
|
81
81
|
flood_adapt/dbs_classes/dbs_measure.py,sha256=wfVo6hUHdgqffGxvvm5zdwZ5Jed6oCJGvFqdilYlEX0,3875
|
|
82
|
-
flood_adapt/dbs_classes/dbs_projection.py,sha256=
|
|
82
|
+
flood_adapt/dbs_classes/dbs_projection.py,sha256=_HOEsEQ43h2HnG6lFh_cFERGPWbEzZRg01tYIIjx_2I,1007
|
|
83
83
|
flood_adapt/dbs_classes/dbs_scenario.py,sha256=NHjiRdV5dxYUtXR6FRGZ9c9Vng2-w-F1-Nn50lNbxXM,4665
|
|
84
|
-
flood_adapt/dbs_classes/dbs_static.py,sha256=
|
|
85
|
-
flood_adapt/dbs_classes/dbs_strategy.py,sha256=
|
|
86
|
-
flood_adapt/dbs_classes/dbs_template.py,sha256=
|
|
84
|
+
flood_adapt/dbs_classes/dbs_static.py,sha256=c5IluANnEVptTBGyTq1UVRAL4lLJ7KETbpujtcaRllY,9440
|
|
85
|
+
flood_adapt/dbs_classes/dbs_strategy.py,sha256=1p7zBu-SbIEXG_qaMTOZ363e7VTWWrzYDsjwhVQiGaI,4695
|
|
86
|
+
flood_adapt/dbs_classes/dbs_template.py,sha256=0VdwrOgANk7ohZdp_HYW1D1_qXFVErq87AVvuMeNEk8,9955
|
|
87
87
|
flood_adapt/dbs_classes/interface/database.py,sha256=StWp_f6iGyQosAI066CmZB6O55_UWmQ2JGJPUlw49j0,3338
|
|
88
88
|
flood_adapt/dbs_classes/interface/element.py,sha256=Zwi2dNhWBdZT7LAJxlxG_YdR9tj_Hu1t_t_E0jrt9-I,3407
|
|
89
89
|
flood_adapt/dbs_classes/interface/static.py,sha256=3kLaWabSWKe7h8-SiBTJlr09sO8Ykbk4NIE5mrMoCp0,1225
|
|
@@ -132,8 +132,8 @@ flood_adapt/workflows/benefit_runner.py,sha256=hvCCJOzqe57kWJ1wQ-8dqBNP88sah0d1L
|
|
|
132
132
|
flood_adapt/workflows/floodmap.py,sha256=6XatakhiZDkIi82VpRDb5dWtWAs-aSho8_iaCGph1_c,2932
|
|
133
133
|
flood_adapt/workflows/impacts_integrator.py,sha256=Iq8namwu90SP_BTazUsDqROqOrJk7rGEyR6nA1Q7Vho,2330
|
|
134
134
|
flood_adapt/workflows/scenario_runner.py,sha256=mjiOr1_0oxJGXhwhPOstZo-pmCm1PBcKNz57bmw2htc,2914
|
|
135
|
-
flood_adapt-0.3.
|
|
136
|
-
flood_adapt-0.3.
|
|
137
|
-
flood_adapt-0.3.
|
|
138
|
-
flood_adapt-0.3.
|
|
139
|
-
flood_adapt-0.3.
|
|
135
|
+
flood_adapt-0.3.7.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
136
|
+
flood_adapt-0.3.7.dist-info/METADATA,sha256=FfRWOM1OyVjEQT5kRDxjua5Tpia4wcHNUkPqenhN2_k,51435
|
|
137
|
+
flood_adapt-0.3.7.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
138
|
+
flood_adapt-0.3.7.dist-info/top_level.txt,sha256=JvzMi6cTcQPEThCfpgMEeVny3ghI1urSH0CCgVIqSzw,12
|
|
139
|
+
flood_adapt-0.3.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|