flood-adapt 0.3.1__py3-none-any.whl → 0.3.3__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/fiat_adapter.py +35 -1
- flood_adapt/config/config.py +58 -36
- flood_adapt/config/fiat.py +7 -7
- flood_adapt/config/gui.py +189 -82
- flood_adapt/config/site.py +2 -2
- flood_adapt/database_builder/database_builder.py +100 -65
- flood_adapt/dbs_classes/database.py +16 -53
- flood_adapt/dbs_classes/dbs_event.py +4 -1
- flood_adapt/dbs_classes/dbs_measure.py +7 -7
- flood_adapt/dbs_classes/dbs_projection.py +4 -1
- flood_adapt/dbs_classes/dbs_scenario.py +17 -8
- flood_adapt/dbs_classes/dbs_static.py +3 -5
- flood_adapt/dbs_classes/dbs_strategy.py +7 -5
- flood_adapt/dbs_classes/dbs_template.py +21 -22
- flood_adapt/dbs_classes/interface/database.py +0 -8
- flood_adapt/dbs_classes/interface/element.py +1 -1
- flood_adapt/flood_adapt.py +135 -273
- flood_adapt/objects/__init__.py +40 -17
- flood_adapt/objects/benefits/benefits.py +6 -6
- flood_adapt/objects/events/event_set.py +4 -4
- flood_adapt/objects/events/events.py +17 -4
- flood_adapt/objects/events/historical.py +11 -8
- flood_adapt/objects/events/hurricane.py +11 -8
- flood_adapt/objects/events/synthetic.py +9 -7
- flood_adapt/objects/forcing/forcing.py +9 -1
- flood_adapt/objects/forcing/plotting.py +1 -0
- flood_adapt/objects/forcing/tide_gauge.py +14 -14
- flood_adapt/objects/forcing/time_frame.py +13 -0
- flood_adapt/objects/measures/measures.py +38 -15
- flood_adapt/objects/object_model.py +2 -2
- flood_adapt/objects/projections/projections.py +18 -18
- flood_adapt/objects/strategies/strategies.py +22 -1
- flood_adapt/workflows/benefit_runner.py +5 -2
- flood_adapt/workflows/scenario_runner.py +8 -7
- flood_adapt-0.3.3.dist-info/LICENSE +674 -0
- flood_adapt-0.3.3.dist-info/METADATA +859 -0
- {flood_adapt-0.3.1.dist-info → flood_adapt-0.3.3.dist-info}/RECORD +41 -41
- flood_adapt-0.3.1.dist-info/LICENSE +0 -21
- flood_adapt-0.3.1.dist-info/METADATA +0 -183
- /flood_adapt/database_builder/templates/{mapbox_layers → output_layers}/bin_colors.toml +0 -0
- {flood_adapt-0.3.1.dist-info → flood_adapt-0.3.3.dist-info}/WHEEL +0 -0
- {flood_adapt-0.3.1.dist-info → flood_adapt-0.3.3.dist-info}/top_level.txt +0 -0
flood_adapt/objects/__init__.py
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
from .benefits.benefits import Benefit
|
|
2
|
-
from .events.event_factory import EventFactory
|
|
3
|
-
from .events.event_set import EventSet
|
|
4
|
-
from .events.events import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
from .
|
|
1
|
+
from flood_adapt.objects.benefits.benefits import Benefit, CurrentSituationModel
|
|
2
|
+
from flood_adapt.objects.events.event_factory import EventFactory
|
|
3
|
+
from flood_adapt.objects.events.event_set import EventSet, SubEventModel
|
|
4
|
+
from flood_adapt.objects.events.events import (
|
|
5
|
+
Event,
|
|
6
|
+
Mode,
|
|
7
|
+
Template,
|
|
8
|
+
TimeFrame,
|
|
9
|
+
)
|
|
10
|
+
from flood_adapt.objects.events.historical import HistoricalEvent
|
|
11
|
+
from flood_adapt.objects.events.hurricane import HurricaneEvent
|
|
12
|
+
from flood_adapt.objects.events.synthetic import SyntheticEvent
|
|
13
|
+
from flood_adapt.objects.forcing.forcing import (
|
|
14
|
+
ForcingSource,
|
|
15
|
+
ForcingType,
|
|
16
|
+
IForcing,
|
|
17
|
+
)
|
|
18
|
+
from flood_adapt.objects.forcing.forcing_factory import ForcingFactory
|
|
19
|
+
from flood_adapt.objects.measures.measure_factory import MeasureFactory
|
|
20
|
+
from flood_adapt.objects.measures.measures import (
|
|
11
21
|
Buyout,
|
|
12
22
|
Elevate,
|
|
13
23
|
FloodProof,
|
|
@@ -18,10 +28,14 @@ from .measures.measures import (
|
|
|
18
28
|
Pump,
|
|
19
29
|
SelectionType,
|
|
20
30
|
)
|
|
21
|
-
from .object_model import Object
|
|
22
|
-
from .projections.projections import
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
from flood_adapt.objects.object_model import Object
|
|
32
|
+
from flood_adapt.objects.projections.projections import (
|
|
33
|
+
PhysicalProjection,
|
|
34
|
+
Projection,
|
|
35
|
+
SocioEconomicChange,
|
|
36
|
+
)
|
|
37
|
+
from flood_adapt.objects.scenarios.scenarios import Scenario
|
|
38
|
+
from flood_adapt.objects.strategies.strategies import Strategy
|
|
25
39
|
|
|
26
40
|
__all__ = [
|
|
27
41
|
# Object
|
|
@@ -31,29 +45,38 @@ __all__ = [
|
|
|
31
45
|
"Measure",
|
|
32
46
|
"MeasureType",
|
|
33
47
|
"SelectionType",
|
|
34
|
-
"MeasureType",
|
|
35
48
|
"Buyout",
|
|
36
49
|
"Elevate",
|
|
37
50
|
"FloodProof",
|
|
38
51
|
"FloodWall",
|
|
39
52
|
"GreenInfrastructure",
|
|
40
|
-
"MeasureType",
|
|
41
53
|
"Pump",
|
|
42
54
|
# Events
|
|
43
55
|
"Event",
|
|
44
56
|
"EventFactory",
|
|
45
|
-
"EventSet",
|
|
46
57
|
"SyntheticEvent",
|
|
47
58
|
"HistoricalEvent",
|
|
48
59
|
"HurricaneEvent",
|
|
60
|
+
"TimeFrame",
|
|
61
|
+
"Mode",
|
|
62
|
+
"Template",
|
|
63
|
+
# EventSet
|
|
64
|
+
"EventSet",
|
|
65
|
+
"SubEventModel",
|
|
49
66
|
# Forcing
|
|
50
67
|
"ForcingFactory",
|
|
68
|
+
"IForcing",
|
|
69
|
+
"ForcingType",
|
|
70
|
+
"ForcingSource",
|
|
51
71
|
# Projections
|
|
52
72
|
"Projection",
|
|
73
|
+
"PhysicalProjection",
|
|
74
|
+
"SocioEconomicChange",
|
|
53
75
|
# Strategies
|
|
54
76
|
"Strategy",
|
|
55
77
|
# Scenarios
|
|
56
78
|
"Scenario",
|
|
57
79
|
# Benefits
|
|
58
80
|
"Benefit",
|
|
81
|
+
"CurrentSituationModel",
|
|
59
82
|
]
|
|
@@ -28,8 +28,8 @@ class Benefit(Object):
|
|
|
28
28
|
----------
|
|
29
29
|
name: str
|
|
30
30
|
The name of the benefit analysis.
|
|
31
|
-
description: str
|
|
32
|
-
The description of the benefit analysis.
|
|
31
|
+
description: str
|
|
32
|
+
The description of the benefit analysis. Defaults to "".
|
|
33
33
|
strategy : str
|
|
34
34
|
The name of the strategy. Should be a strategy saved in the database.
|
|
35
35
|
event_set : str
|
|
@@ -44,10 +44,10 @@ class Benefit(Object):
|
|
|
44
44
|
The name of the baseline strategy.
|
|
45
45
|
discount_rate : float
|
|
46
46
|
The discount rate for the analysis.
|
|
47
|
-
implementation_cost : Optional[float]
|
|
48
|
-
The implementation cost of the strategy.
|
|
49
|
-
annual_maint_cost : Optional[float]
|
|
50
|
-
The annual maintenance cost of the strategy.
|
|
47
|
+
implementation_cost : Optional[float]
|
|
48
|
+
The implementation cost of the strategy. Defaults to None.
|
|
49
|
+
annual_maint_cost : Optional[float]
|
|
50
|
+
The annual maintenance cost of the strategy. Defaults to None.
|
|
51
51
|
"""
|
|
52
52
|
|
|
53
53
|
strategy: str
|
|
@@ -33,10 +33,10 @@ class EventSet(Object):
|
|
|
33
33
|
----------
|
|
34
34
|
name : str
|
|
35
35
|
The name of the event.
|
|
36
|
-
description : str
|
|
37
|
-
The description of the event.
|
|
38
|
-
mode : Mode
|
|
39
|
-
The mode of the event.
|
|
36
|
+
description : str
|
|
37
|
+
The description of the event. Defaults to "".
|
|
38
|
+
mode : Mode
|
|
39
|
+
The mode of the event. Defaults to Mode.risk.
|
|
40
40
|
sub_events : List[SubEventModel]
|
|
41
41
|
The sub events of the event set.
|
|
42
42
|
"""
|
|
@@ -23,14 +23,27 @@ from flood_adapt.objects.object_model import Object
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class Mode(str, Enum):
|
|
26
|
-
"""Class describing the accepted input for the variable mode in Event.
|
|
26
|
+
"""Class describing the accepted input for the variable mode in Event.
|
|
27
|
+
|
|
28
|
+
Attributes
|
|
29
|
+
----------
|
|
30
|
+
single_event : The single event mode.
|
|
31
|
+
risk : The risk mode.
|
|
32
|
+
"""
|
|
27
33
|
|
|
28
34
|
single_event = "single_event"
|
|
29
35
|
risk = "risk"
|
|
30
36
|
|
|
31
37
|
|
|
32
38
|
class Template(str, Enum):
|
|
33
|
-
"""Class describing the accepted input for the variable template in Event.
|
|
39
|
+
"""Class describing the accepted input for the variable template in Event.
|
|
40
|
+
|
|
41
|
+
Attributes
|
|
42
|
+
----------
|
|
43
|
+
Synthetic : The synthetic template.
|
|
44
|
+
Hurricane : The hurricane template.
|
|
45
|
+
Historical : The historical template.
|
|
46
|
+
"""
|
|
34
47
|
|
|
35
48
|
Synthetic = "Synthetic"
|
|
36
49
|
Hurricane = "Hurricane"
|
|
@@ -66,8 +79,8 @@ class Event(Object):
|
|
|
66
79
|
----------
|
|
67
80
|
name : str
|
|
68
81
|
The name of the event.
|
|
69
|
-
description : str
|
|
70
|
-
The description of the event.
|
|
82
|
+
description : str
|
|
83
|
+
The description of the event. Defaults to "".
|
|
71
84
|
time : TimeFrame
|
|
72
85
|
The time frame of the event.
|
|
73
86
|
template : Template
|
|
@@ -5,6 +5,9 @@ from flood_adapt.objects.forcing.forcing import (
|
|
|
5
5
|
ForcingSource,
|
|
6
6
|
ForcingType,
|
|
7
7
|
)
|
|
8
|
+
from flood_adapt.objects.forcing.time_frame import TimeFrame
|
|
9
|
+
|
|
10
|
+
__all__ = ["HistoricalEvent", "TimeFrame"]
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
class HistoricalEvent(Event):
|
|
@@ -14,16 +17,16 @@ class HistoricalEvent(Event):
|
|
|
14
17
|
----------
|
|
15
18
|
name : str
|
|
16
19
|
The name of the event.
|
|
17
|
-
description : str
|
|
18
|
-
The description of the event.
|
|
20
|
+
description : str
|
|
21
|
+
The description of the event. Defaults to "".
|
|
19
22
|
time : TimeFrame
|
|
20
23
|
The time frame of the event.
|
|
21
|
-
template : Template
|
|
22
|
-
The template of the event.
|
|
23
|
-
mode : Mode
|
|
24
|
-
The mode of the event.
|
|
25
|
-
rainfall_multiplier : float
|
|
26
|
-
The rainfall multiplier of the event.
|
|
24
|
+
template : Template
|
|
25
|
+
The template of the event. Defaults to Template.Historical.
|
|
26
|
+
mode : Mode
|
|
27
|
+
The mode of the event. Defaults to Mode.single_event.
|
|
28
|
+
rainfall_multiplier : float
|
|
29
|
+
The rainfall multiplier of the event. Defaults to 1.0.
|
|
27
30
|
forcings : dict[ForcingType, list[IForcing]]
|
|
28
31
|
The forcings of the event.
|
|
29
32
|
"""
|
|
@@ -8,6 +8,9 @@ from flood_adapt.objects.forcing.forcing import (
|
|
|
8
8
|
ForcingSource,
|
|
9
9
|
ForcingType,
|
|
10
10
|
)
|
|
11
|
+
from flood_adapt.objects.forcing.time_frame import TimeFrame
|
|
12
|
+
|
|
13
|
+
__all__ = ["HurricaneEvent", "TranslationModel", "TimeFrame"]
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
class TranslationModel(BaseModel):
|
|
@@ -28,16 +31,16 @@ class HurricaneEvent(Event):
|
|
|
28
31
|
----------
|
|
29
32
|
name : str
|
|
30
33
|
The name of the event.
|
|
31
|
-
description :
|
|
32
|
-
The description of the event.
|
|
34
|
+
description :
|
|
35
|
+
The description of the event. Defaults to "".
|
|
33
36
|
time : TimeFrame
|
|
34
37
|
The time frame of the event.
|
|
35
|
-
template : Template
|
|
36
|
-
The template of the event.
|
|
37
|
-
mode : Mode
|
|
38
|
-
The mode of the event.
|
|
39
|
-
rainfall_multiplier : float
|
|
40
|
-
The rainfall multiplier of the event.
|
|
38
|
+
template : Template
|
|
39
|
+
The template of the event. Defaults to Template.Hurricane.
|
|
40
|
+
mode : Mode
|
|
41
|
+
The mode of the event. Defaults to Mode.single_event.
|
|
42
|
+
rainfall_multiplier : float
|
|
43
|
+
The rainfall multiplier of the event. Defaults to 1.0.
|
|
41
44
|
forcings : dict[ForcingType, list[IForcing]]
|
|
42
45
|
The forcings of the event.
|
|
43
46
|
track_name : str
|
|
@@ -2,9 +2,11 @@ from typing import ClassVar, List
|
|
|
2
2
|
|
|
3
3
|
from flood_adapt.objects.events.events import (
|
|
4
4
|
Event,
|
|
5
|
+
Template,
|
|
6
|
+
)
|
|
7
|
+
from flood_adapt.objects.forcing.forcing import (
|
|
5
8
|
ForcingSource,
|
|
6
9
|
ForcingType,
|
|
7
|
-
Template,
|
|
8
10
|
)
|
|
9
11
|
|
|
10
12
|
|
|
@@ -15,12 +17,12 @@ class SyntheticEvent(Event):
|
|
|
15
17
|
----------
|
|
16
18
|
time : TimeFrame
|
|
17
19
|
The time frame of the event.
|
|
18
|
-
template : Template
|
|
19
|
-
The template of the event.
|
|
20
|
-
mode : Mode
|
|
21
|
-
The mode of the event.
|
|
22
|
-
rainfall_multiplier : float
|
|
23
|
-
The rainfall multiplier of the event.
|
|
20
|
+
template : Template
|
|
21
|
+
The template of the event. Defaults to Template.Synthetic.
|
|
22
|
+
mode : Mode
|
|
23
|
+
The mode of the event. Defaults to Mode.single_event.
|
|
24
|
+
rainfall_multiplier : float
|
|
25
|
+
The rainfall multiplier of the event. Defaults to 1.0.
|
|
24
26
|
forcings : dict[ForcingType, list[IForcing]]
|
|
25
27
|
The forcings of the event.
|
|
26
28
|
"""
|
|
@@ -14,7 +14,15 @@ from flood_adapt.misc.log import FloodAdaptLogging
|
|
|
14
14
|
|
|
15
15
|
### ENUMS ###
|
|
16
16
|
class ForcingType(str, Enum):
|
|
17
|
-
"""Enum class for the different types of forcing parameters.
|
|
17
|
+
"""Enum class for the different types of forcing parameters.
|
|
18
|
+
|
|
19
|
+
Attributes
|
|
20
|
+
----------
|
|
21
|
+
RAINFALL : The type of forcing parameter for rainfall.
|
|
22
|
+
WIND : The type of forcing parameter for wind.
|
|
23
|
+
DISCHARGE : The type of forcing parameter for discharge.
|
|
24
|
+
WATERLEVEL : The type of forcing parameter for water level.
|
|
25
|
+
"""
|
|
18
26
|
|
|
19
27
|
WIND = "WIND"
|
|
20
28
|
RAINFALL = "RAINFALL"
|
|
@@ -27,24 +27,24 @@ class TideGauge(BaseModel):
|
|
|
27
27
|
|
|
28
28
|
Attributes
|
|
29
29
|
----------
|
|
30
|
-
name : Optional[int
|
|
31
|
-
Name of the tide gauge.
|
|
32
|
-
description : Optional[str]
|
|
33
|
-
Description of the tide gauge.
|
|
30
|
+
name : Optional[int, str]
|
|
31
|
+
Name of the tide gauge. Default is None.
|
|
32
|
+
description : Optional[str]
|
|
33
|
+
Description of the tide gauge. Default is "".
|
|
34
34
|
source : TideGaugeSource
|
|
35
35
|
Source of the tide gauge data.
|
|
36
36
|
reference : str
|
|
37
37
|
Reference of the tide gauge data. Should be defined in site.sfincs.water_level
|
|
38
|
-
ID : Optional[int]
|
|
39
|
-
ID of the tide gauge data.
|
|
40
|
-
file : Optional[Path]
|
|
41
|
-
Only for file based tide gauges. Should be a path relative to the static folder.
|
|
42
|
-
lat : Optional[float]
|
|
43
|
-
Latitude of the tide gauge data.
|
|
44
|
-
lon : Optional[float]
|
|
45
|
-
Longitude of the tide gauge data.
|
|
46
|
-
units : us.UnitTypesLength
|
|
47
|
-
Units of the water levels in the downloaded file.
|
|
38
|
+
ID : Optional[int]
|
|
39
|
+
ID of the tide gauge data. Default is None.
|
|
40
|
+
file : Optional[Path]
|
|
41
|
+
Only for file based tide gauges. Should be a path relative to the static folder. Default is None.
|
|
42
|
+
lat : Optional[float]
|
|
43
|
+
Latitude of the tide gauge data. Default is None.
|
|
44
|
+
lon : Optional[float]
|
|
45
|
+
Longitude of the tide gauge data. Default is None.
|
|
46
|
+
units : us.UnitTypesLength
|
|
47
|
+
Units of the water levels in the downloaded file. Default is us.UnitTypesLength.meters.
|
|
48
48
|
|
|
49
49
|
"""
|
|
50
50
|
|
|
@@ -12,6 +12,19 @@ REFERENCE_TIME = datetime(year=2021, month=1, day=1, hour=0, minute=0, second=0)
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class TimeFrame(BaseModel):
|
|
15
|
+
"""
|
|
16
|
+
Class representing a time frame for a simulation.
|
|
17
|
+
|
|
18
|
+
Attributes
|
|
19
|
+
----------
|
|
20
|
+
start_time : datetime
|
|
21
|
+
The start time of the simulation.
|
|
22
|
+
end_time : datetime
|
|
23
|
+
The end time of the simulation.
|
|
24
|
+
time_step : timedelta
|
|
25
|
+
The time step of the simulation. Default is calculated as 1/1000 of the duration.
|
|
26
|
+
"""
|
|
27
|
+
|
|
15
28
|
start_time: datetime = REFERENCE_TIME
|
|
16
29
|
end_time: datetime = REFERENCE_TIME + timedelta(days=1)
|
|
17
30
|
|
|
@@ -21,6 +21,25 @@ class MeasureCategory(str, Enum):
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class MeasureType(str, Enum):
|
|
24
|
+
"""Class describing the accepted input for the variable 'type' in Measure.
|
|
25
|
+
|
|
26
|
+
Each type of measure is associated with a category (hazard or impact) and can be used to determine the type of measure.
|
|
27
|
+
|
|
28
|
+
Attributes
|
|
29
|
+
----------
|
|
30
|
+
floodwall : A floodwall measure.
|
|
31
|
+
thin_dam : A thin dam measure.
|
|
32
|
+
levee : A levee measure.
|
|
33
|
+
pump : A pump measure.
|
|
34
|
+
culvert : A culvert measure.
|
|
35
|
+
water_square : A water square measure.
|
|
36
|
+
greening : A greening measure.
|
|
37
|
+
total_storage : A total storage measure.
|
|
38
|
+
elevate_properties : An elevate properties measure.
|
|
39
|
+
buyout_properties : A buyout properties measure.
|
|
40
|
+
floodproof_properties : A floodproof properties measure.
|
|
41
|
+
"""
|
|
42
|
+
|
|
24
43
|
# Hazard measures
|
|
25
44
|
floodwall = "floodwall"
|
|
26
45
|
thin_dam = "thin_dam" # For now, same functionality as floodwall TODO: Add thin dam functionality
|
|
@@ -70,7 +89,17 @@ class MeasureType(str, Enum):
|
|
|
70
89
|
|
|
71
90
|
|
|
72
91
|
class SelectionType(str, Enum):
|
|
73
|
-
"""Class describing the accepted input for the variable 'selection_type' in
|
|
92
|
+
"""Class describing the accepted input for the variable 'selection_type' in Measures.
|
|
93
|
+
|
|
94
|
+
It is used to determine where to apply the measure to a model.
|
|
95
|
+
|
|
96
|
+
Attributes
|
|
97
|
+
----------
|
|
98
|
+
aggregation_area : Use aggregation area as geometry for the measure.
|
|
99
|
+
polygon : Use polygon as geometry for the measure.
|
|
100
|
+
polyline : Use polyline as geometry for the measure.
|
|
101
|
+
all : Apply the measure to all geometries in the database.
|
|
102
|
+
"""
|
|
74
103
|
|
|
75
104
|
aggregation_area = "aggregation_area"
|
|
76
105
|
polygon = "polygon"
|
|
@@ -267,7 +296,7 @@ class Buyout(ImpactMeasure):
|
|
|
267
296
|
Name of the aggregation area.
|
|
268
297
|
property_type : str
|
|
269
298
|
Type of property. Should be "residential" or "commercial".
|
|
270
|
-
elevation : UnitfulLengthRefValue
|
|
299
|
+
elevation : us.UnitfulLengthRefValue
|
|
271
300
|
Elevation of the properties.
|
|
272
301
|
|
|
273
302
|
"""
|
|
@@ -297,9 +326,8 @@ class FloodProof(ImpactMeasure):
|
|
|
297
326
|
Name of the aggregation area.
|
|
298
327
|
property_type : str
|
|
299
328
|
Type of property. Should be "residential" or "commercial".
|
|
300
|
-
elevation : UnitfulLengthRefValue
|
|
329
|
+
elevation : us.UnitfulLengthRefValue
|
|
301
330
|
Elevation of the properties.
|
|
302
|
-
|
|
303
331
|
"""
|
|
304
332
|
|
|
305
333
|
type: MeasureType = MeasureType.floodproof_properties
|
|
@@ -316,11 +344,11 @@ class FloodWall(HazardMeasure):
|
|
|
316
344
|
Name of the measure.
|
|
317
345
|
description: str
|
|
318
346
|
Description of the measure.
|
|
319
|
-
type : MeasureType
|
|
320
|
-
Type of measure. Should be "floodwall"
|
|
347
|
+
type : MeasureType
|
|
348
|
+
Type of measure. Should be "MeasureType.floodwall"
|
|
321
349
|
selection_type : SelectionType
|
|
322
|
-
Type of selection. Should be "polygon" or "aggregation_area".
|
|
323
|
-
polygon_file : str
|
|
350
|
+
Type of selection. Should be "SelectionType.polygon" or "SelectionType.aggregation_area".
|
|
351
|
+
polygon_file : Optional[str]
|
|
324
352
|
Path to a polygon file, either absolute or relative to the measure path.
|
|
325
353
|
elevation : us.UnitfulLength
|
|
326
354
|
Height of the floodwall.
|
|
@@ -462,11 +490,6 @@ class GreenInfrastructure(HazardMeasure):
|
|
|
462
490
|
percent_area : float, optional
|
|
463
491
|
Percentage area covered by green infrastructure [%], by default 100.0
|
|
464
492
|
|
|
465
|
-
Returns
|
|
466
|
-
-------
|
|
467
|
-
float
|
|
468
|
-
|
|
469
|
-
|
|
470
493
|
Returns
|
|
471
494
|
-------
|
|
472
495
|
float
|
|
@@ -492,8 +515,8 @@ class GreenInfrastructure(HazardMeasure):
|
|
|
492
515
|
|
|
493
516
|
Returns
|
|
494
517
|
-------
|
|
495
|
-
|
|
496
|
-
Area
|
|
518
|
+
area : float
|
|
519
|
+
Area of the given polygon
|
|
497
520
|
"""
|
|
498
521
|
# Determine local CRS
|
|
499
522
|
crs = pyproj.CRS.from_string(site.sfincs.config.csname)
|
|
@@ -14,14 +14,14 @@ class PhysicalProjection(BaseModel):
|
|
|
14
14
|
|
|
15
15
|
Attributes
|
|
16
16
|
----------
|
|
17
|
-
sea_level_rise : us.UnitfulLength
|
|
18
|
-
The sea level rise in meters.
|
|
19
|
-
subsidence : us.UnitfulLength
|
|
20
|
-
The subsidence in meters.
|
|
21
|
-
rainfall_multiplier : float
|
|
22
|
-
The rainfall multiplier.
|
|
23
|
-
storm_frequency_increase : float
|
|
24
|
-
The storm frequency increase as a percentage.
|
|
17
|
+
sea_level_rise : us.UnitfulLength
|
|
18
|
+
The sea level rise in meters. Default=us.UnitfulLength(0.0, us.UnitTypesLength.meters).
|
|
19
|
+
subsidence : us.UnitfulLength
|
|
20
|
+
The subsidence in meters. Default=us.UnitfulLength(0.0, us.UnitTypesLength.meters).
|
|
21
|
+
rainfall_multiplier : float
|
|
22
|
+
The rainfall multiplier. Default = 1.0.
|
|
23
|
+
storm_frequency_increase : float
|
|
24
|
+
The storm frequency increase as a percentage. Default = 0.0.
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
sea_level_rise: us.UnitfulLength = us.UnitfulLength(
|
|
@@ -39,16 +39,16 @@ class SocioEconomicChange(BaseModel):
|
|
|
39
39
|
|
|
40
40
|
Attributes
|
|
41
41
|
----------
|
|
42
|
-
population_growth_existing : float
|
|
43
|
-
The existing population growth rate.
|
|
44
|
-
economic_growth : float
|
|
45
|
-
The economic growth rate.
|
|
46
|
-
population_growth_new : float
|
|
47
|
-
The population growth rate for new developments.
|
|
48
|
-
new_development_elevation : us.UnitfulLengthRefValue
|
|
49
|
-
The elevation of new developments.
|
|
50
|
-
new_development_shapefile : str
|
|
51
|
-
The path to the shapefile of new developments.
|
|
42
|
+
population_growth_existing : float
|
|
43
|
+
The existing population growth rate. default=0.0
|
|
44
|
+
economic_growth : float
|
|
45
|
+
The economic growth rate. default=0.0.
|
|
46
|
+
population_growth_new : float
|
|
47
|
+
The population growth rate for new developments. default=0.0.
|
|
48
|
+
new_development_elevation : Optional[us.UnitfulLengthRefValue]
|
|
49
|
+
The elevation of new developments. default=None.
|
|
50
|
+
new_development_shapefile : Optional[str]
|
|
51
|
+
The path to the shapefile of new developments. default=None.
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
54
|
population_growth_existing: Optional[float] = 0.0
|
|
@@ -24,10 +24,31 @@ class Strategy(Object):
|
|
|
24
24
|
_measure_objects: list[Measure] | None = None
|
|
25
25
|
|
|
26
26
|
def initialize_measure_objects(self, measures: list[Measure]) -> None:
|
|
27
|
+
"""Initialize the measure objects associated with this strategy.
|
|
28
|
+
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
measures : list[Measure]
|
|
32
|
+
A list of measure objects to be associated with this strategy. Should be a list of measure objects that are saved in the database.
|
|
33
|
+
"""
|
|
27
34
|
self._measure_objects = measures
|
|
28
35
|
|
|
29
36
|
def get_measures(self) -> list[Measure]:
|
|
30
|
-
"""Get the measures
|
|
37
|
+
"""Get the measures associated with this strategy.
|
|
38
|
+
|
|
39
|
+
Note that this method will return the measure objects, not just their names.
|
|
40
|
+
The measure objects are initialized using the `initialize_measure_objects` method.
|
|
41
|
+
|
|
42
|
+
Returns
|
|
43
|
+
-------
|
|
44
|
+
measures : list[Measure]
|
|
45
|
+
The list of measure objects associated with this strategy.
|
|
46
|
+
|
|
47
|
+
Raises
|
|
48
|
+
------
|
|
49
|
+
ValueError
|
|
50
|
+
If the measure objects have not been initialized.
|
|
51
|
+
"""
|
|
31
52
|
# Get measure paths using a database structure
|
|
32
53
|
if self._measure_objects is None:
|
|
33
54
|
raise ValueError(
|
|
@@ -69,7 +69,7 @@ class BenefitRunner:
|
|
|
69
69
|
|
|
70
70
|
Returns
|
|
71
71
|
-------
|
|
72
|
-
bool
|
|
72
|
+
has_run : bool
|
|
73
73
|
True if the analysis has already been run, else False
|
|
74
74
|
"""
|
|
75
75
|
# Output files to check
|
|
@@ -117,7 +117,10 @@ class BenefitRunner:
|
|
|
117
117
|
scenarios_calc[scenario]["strategy"] = self.benefit.strategy
|
|
118
118
|
|
|
119
119
|
# Get the available scenarios
|
|
120
|
-
scenarios_avail =
|
|
120
|
+
scenarios_avail = [
|
|
121
|
+
self.database.scenarios.get(scn)
|
|
122
|
+
for scn in self.database.scenarios.summarize_objects()["name"]
|
|
123
|
+
]
|
|
121
124
|
|
|
122
125
|
# Check if any of the needed scenarios are already there
|
|
123
126
|
for scenario in scenarios_calc.keys():
|
|
@@ -30,16 +30,17 @@ class ScenarioRunner:
|
|
|
30
30
|
scenario=self._scenario,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
def run(self
|
|
33
|
+
def run(self) -> None:
|
|
34
34
|
"""Run hazard and impact models for the scenario."""
|
|
35
|
-
self.
|
|
35
|
+
self._database.has_run_hazard(self._scenario.name)
|
|
36
|
+
self._load_objects(self._scenario)
|
|
36
37
|
self.results_path.mkdir(parents=True, exist_ok=True)
|
|
37
38
|
|
|
38
39
|
# Initiate the logger for all the integrator scripts.
|
|
39
|
-
log_file = self.results_path.joinpath(f"logfile_{
|
|
40
|
+
log_file = self.results_path.joinpath(f"logfile_{self._scenario.name}.log")
|
|
40
41
|
with FloodAdaptLogging.to_file(file_path=log_file):
|
|
41
42
|
self.logger.info(f"FloodAdapt version `{__version__}`")
|
|
42
|
-
self.logger.info(f"Started evaluation of `{
|
|
43
|
+
self.logger.info(f"Started evaluation of `{self._scenario.name}`")
|
|
43
44
|
|
|
44
45
|
hazard_models = [
|
|
45
46
|
self._database.static.get_overland_sfincs_model(),
|
|
@@ -49,17 +50,17 @@ class ScenarioRunner:
|
|
|
49
50
|
hazard.run(self._scenario)
|
|
50
51
|
else:
|
|
51
52
|
self.logger.info(
|
|
52
|
-
f"Hazard for scenario '{
|
|
53
|
+
f"Hazard for scenario '{self._scenario.name}' has already been run."
|
|
53
54
|
)
|
|
54
55
|
|
|
55
56
|
if not self.impacts.has_run:
|
|
56
57
|
self.impacts.run()
|
|
57
58
|
else:
|
|
58
59
|
self.logger.info(
|
|
59
|
-
f"Impacts for scenario `{
|
|
60
|
+
f"Impacts for scenario `{self._scenario.name}` has already been run."
|
|
60
61
|
)
|
|
61
62
|
|
|
62
|
-
self.logger.info(f"Finished evaluation of `{
|
|
63
|
+
self.logger.info(f"Finished evaluation of `{self._scenario.name}`")
|
|
63
64
|
|
|
64
65
|
# write finished file to indicate that the scenario has been run
|
|
65
66
|
write_finished_file(self.results_path)
|