flood-adapt 0.3.9__py3-none-any.whl → 0.3.11__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 +1853 -1848
- flood_adapt/adapter/sfincs_offshore.py +187 -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 +533 -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 +1229 -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 +236 -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 +551 -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.11.dist-info}/LICENSE +674 -674
- {flood_adapt-0.3.9.dist-info → flood_adapt-0.3.11.dist-info}/METADATA +867 -865
- flood_adapt-0.3.11.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.11.dist-info}/WHEEL +0 -0
- {flood_adapt-0.3.9.dist-info → flood_adapt-0.3.11.dist-info}/top_level.txt +0 -0
|
@@ -1,193 +1,187 @@
|
|
|
1
|
-
import shutil
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
import pandas as pd
|
|
5
|
-
|
|
6
|
-
from flood_adapt.adapter.interface.offshore import IOffshoreSfincsHandler
|
|
7
|
-
from flood_adapt.adapter.sfincs_adapter import SfincsAdapter
|
|
8
|
-
from flood_adapt.misc.database_user import DatabaseUser
|
|
9
|
-
from flood_adapt.misc.log import FloodAdaptLogging
|
|
10
|
-
from flood_adapt.misc.path_builder import (
|
|
11
|
-
ObjectDir,
|
|
12
|
-
TopLevelDir,
|
|
13
|
-
db_path,
|
|
14
|
-
)
|
|
15
|
-
from flood_adapt.objects.events.event_set import EventSet
|
|
16
|
-
from flood_adapt.objects.events.events import Event, Mode
|
|
17
|
-
from flood_adapt.objects.events.historical import HistoricalEvent
|
|
18
|
-
from flood_adapt.objects.forcing.forcing import (
|
|
19
|
-
ForcingSource,
|
|
20
|
-
IWind,
|
|
21
|
-
)
|
|
22
|
-
from flood_adapt.objects.forcing.meteo_handler import MeteoHandler
|
|
23
|
-
from flood_adapt.objects.forcing.wind import WindMeteo
|
|
24
|
-
from flood_adapt.objects.scenarios.scenarios import Scenario
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class OffshoreSfincsHandler(IOffshoreSfincsHandler, DatabaseUser):
|
|
28
|
-
logger = FloodAdaptLogging.getLogger("OffshoreSfincsAdapter")
|
|
29
|
-
template_path: Path
|
|
30
|
-
|
|
31
|
-
def __init__(self, scenario: Scenario, event: Event) -> None:
|
|
32
|
-
self.template_path = (
|
|
33
|
-
self.database.static.get_offshore_sfincs_model().get_model_root()
|
|
34
|
-
)
|
|
35
|
-
self.scenario = scenario
|
|
36
|
-
if isinstance(event, EventSet):
|
|
37
|
-
raise ValueError(
|
|
38
|
-
"OffshoreSfincsHandler does not support EventSets. Provide the sub events directly "
|
|
39
|
-
)
|
|
40
|
-
self.event = event
|
|
41
|
-
|
|
42
|
-
def get_resulting_waterlevels(self) -> pd.DataFrame:
|
|
43
|
-
"""Get the water levels from the offshore model.
|
|
44
|
-
|
|
45
|
-
Note that the returned water levels are relative to the reference datum of the offshore model.
|
|
46
|
-
To convert to a different datum, add the offshore reference datum height and subtract the desired reference datum height.
|
|
47
|
-
|
|
48
|
-
Returns
|
|
49
|
-
-------
|
|
50
|
-
pd.DataFrame
|
|
51
|
-
A DataFrame with the water levels for each boundary condition point. Relative to the reference datum of the offshore model.
|
|
52
|
-
|
|
53
|
-
"""
|
|
54
|
-
path = self._get_simulation_path()
|
|
55
|
-
if not self.requires_offshore_run(self.event):
|
|
56
|
-
raise ValueError("Offshore model is not required for this event")
|
|
57
|
-
|
|
58
|
-
self.run_offshore()
|
|
59
|
-
|
|
60
|
-
with SfincsAdapter(model_root=path) as offshore_model:
|
|
61
|
-
waterlevels = offshore_model.get_wl_df_from_offshore_his_results()
|
|
62
|
-
|
|
63
|
-
return waterlevels
|
|
64
|
-
|
|
65
|
-
@staticmethod
|
|
66
|
-
def requires_offshore_run(event: Event) -> bool:
|
|
67
|
-
return any(
|
|
68
|
-
forcing.source in [ForcingSource.MODEL, ForcingSource.TRACK]
|
|
69
|
-
for forcing in event.get_forcings()
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
def run_offshore(self):
|
|
73
|
-
"""Prepare the forcings of the historical event.
|
|
74
|
-
|
|
75
|
-
If the forcings require it, this function will:
|
|
76
|
-
- preprocess and run offshore model: prepare and run the offshore model to obtain water levels for the boundary condition of the nearshore model.
|
|
77
|
-
|
|
78
|
-
"""
|
|
79
|
-
sim_path = self._get_simulation_path()
|
|
80
|
-
|
|
81
|
-
sim_path.mkdir(parents=True, exist_ok=True)
|
|
82
|
-
self._preprocess_sfincs_offshore()
|
|
83
|
-
self._execute_sfincs_offshore(sim_path)
|
|
84
|
-
|
|
85
|
-
def _preprocess_sfincs_offshore(self):
|
|
86
|
-
"""Preprocess offshore model to obtain water levels for boundary condition of the nearshore model.
|
|
87
|
-
|
|
88
|
-
This function is reused for ForcingSources: MODEL & TRACK.
|
|
89
|
-
|
|
90
|
-
Args:
|
|
91
|
-
sim_path path to the root of the offshore model
|
|
92
|
-
"""
|
|
93
|
-
self.logger.info(
|
|
94
|
-
f"Preparing offshore model to generate waterlevels for `{self.scenario.name}`"
|
|
95
|
-
)
|
|
96
|
-
sim_path = self._get_simulation_path()
|
|
97
|
-
# SfincsAdapter.write() doesnt write the bca file apparently so we need to copy the template
|
|
98
|
-
if sim_path.exists():
|
|
99
|
-
shutil.rmtree(sim_path)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
_offshore_model._event
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
_offshore_model.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
wind_forcings
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
_offshore_model.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
obj_name=self.scenario.name,
|
|
189
|
-
)
|
|
190
|
-
/ "Flooding"
|
|
191
|
-
/ "simulations"
|
|
192
|
-
/ self.template_path.name
|
|
193
|
-
)
|
|
1
|
+
import shutil
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
import pandas as pd
|
|
5
|
+
|
|
6
|
+
from flood_adapt.adapter.interface.offshore import IOffshoreSfincsHandler
|
|
7
|
+
from flood_adapt.adapter.sfincs_adapter import SfincsAdapter
|
|
8
|
+
from flood_adapt.misc.database_user import DatabaseUser
|
|
9
|
+
from flood_adapt.misc.log import FloodAdaptLogging
|
|
10
|
+
from flood_adapt.misc.path_builder import (
|
|
11
|
+
ObjectDir,
|
|
12
|
+
TopLevelDir,
|
|
13
|
+
db_path,
|
|
14
|
+
)
|
|
15
|
+
from flood_adapt.objects.events.event_set import EventSet
|
|
16
|
+
from flood_adapt.objects.events.events import Event, Mode
|
|
17
|
+
from flood_adapt.objects.events.historical import HistoricalEvent
|
|
18
|
+
from flood_adapt.objects.forcing.forcing import (
|
|
19
|
+
ForcingSource,
|
|
20
|
+
IWind,
|
|
21
|
+
)
|
|
22
|
+
from flood_adapt.objects.forcing.meteo_handler import MeteoHandler
|
|
23
|
+
from flood_adapt.objects.forcing.wind import WindMeteo
|
|
24
|
+
from flood_adapt.objects.scenarios.scenarios import Scenario
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class OffshoreSfincsHandler(IOffshoreSfincsHandler, DatabaseUser):
|
|
28
|
+
logger = FloodAdaptLogging.getLogger("OffshoreSfincsAdapter")
|
|
29
|
+
template_path: Path
|
|
30
|
+
|
|
31
|
+
def __init__(self, scenario: Scenario, event: Event) -> None:
|
|
32
|
+
self.template_path = (
|
|
33
|
+
self.database.static.get_offshore_sfincs_model().get_model_root()
|
|
34
|
+
)
|
|
35
|
+
self.scenario = scenario
|
|
36
|
+
if isinstance(event, EventSet):
|
|
37
|
+
raise ValueError(
|
|
38
|
+
"OffshoreSfincsHandler does not support EventSets. Provide the sub events directly "
|
|
39
|
+
)
|
|
40
|
+
self.event = event
|
|
41
|
+
|
|
42
|
+
def get_resulting_waterlevels(self) -> pd.DataFrame:
|
|
43
|
+
"""Get the water levels from the offshore model.
|
|
44
|
+
|
|
45
|
+
Note that the returned water levels are relative to the reference datum of the offshore model.
|
|
46
|
+
To convert to a different datum, add the offshore reference datum height and subtract the desired reference datum height.
|
|
47
|
+
|
|
48
|
+
Returns
|
|
49
|
+
-------
|
|
50
|
+
pd.DataFrame
|
|
51
|
+
A DataFrame with the water levels for each boundary condition point. Relative to the reference datum of the offshore model.
|
|
52
|
+
|
|
53
|
+
"""
|
|
54
|
+
path = self._get_simulation_path()
|
|
55
|
+
if not self.requires_offshore_run(self.event):
|
|
56
|
+
raise ValueError("Offshore model is not required for this event")
|
|
57
|
+
|
|
58
|
+
self.run_offshore()
|
|
59
|
+
|
|
60
|
+
with SfincsAdapter(model_root=path) as offshore_model:
|
|
61
|
+
waterlevels = offshore_model.get_wl_df_from_offshore_his_results()
|
|
62
|
+
|
|
63
|
+
return waterlevels
|
|
64
|
+
|
|
65
|
+
@staticmethod
|
|
66
|
+
def requires_offshore_run(event: Event) -> bool:
|
|
67
|
+
return any(
|
|
68
|
+
forcing.source in [ForcingSource.MODEL, ForcingSource.TRACK]
|
|
69
|
+
for forcing in event.get_forcings()
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
def run_offshore(self):
|
|
73
|
+
"""Prepare the forcings of the historical event.
|
|
74
|
+
|
|
75
|
+
If the forcings require it, this function will:
|
|
76
|
+
- preprocess and run offshore model: prepare and run the offshore model to obtain water levels for the boundary condition of the nearshore model.
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
sim_path = self._get_simulation_path()
|
|
80
|
+
|
|
81
|
+
sim_path.mkdir(parents=True, exist_ok=True)
|
|
82
|
+
self._preprocess_sfincs_offshore()
|
|
83
|
+
self._execute_sfincs_offshore(sim_path)
|
|
84
|
+
|
|
85
|
+
def _preprocess_sfincs_offshore(self):
|
|
86
|
+
"""Preprocess offshore model to obtain water levels for boundary condition of the nearshore model.
|
|
87
|
+
|
|
88
|
+
This function is reused for ForcingSources: MODEL & TRACK.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
sim_path path to the root of the offshore model
|
|
92
|
+
"""
|
|
93
|
+
self.logger.info(
|
|
94
|
+
f"Preparing offshore model to generate waterlevels for `{self.scenario.name}`"
|
|
95
|
+
)
|
|
96
|
+
sim_path = self._get_simulation_path()
|
|
97
|
+
# SfincsAdapter.write() doesnt write the bca file apparently so we need to copy the template
|
|
98
|
+
if sim_path.exists():
|
|
99
|
+
shutil.rmtree(sim_path)
|
|
100
|
+
|
|
101
|
+
with SfincsAdapter(model_root=self.template_path) as _offshore_model:
|
|
102
|
+
# Load objects, set root & write template model
|
|
103
|
+
_offshore_model._load_scenario_objects(self.scenario, self.event)
|
|
104
|
+
_offshore_model.write(path_out=sim_path)
|
|
105
|
+
_offshore_model.set_timing(self.event.time)
|
|
106
|
+
|
|
107
|
+
# Add water levels
|
|
108
|
+
_offshore_model._add_bzs_from_bca(
|
|
109
|
+
_offshore_model._event, _offshore_model._projection.physical_projection
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# Add spw if applicable
|
|
113
|
+
track_forcings = [
|
|
114
|
+
f
|
|
115
|
+
for f in _offshore_model._event.get_forcings()
|
|
116
|
+
if f.source == ForcingSource.TRACK
|
|
117
|
+
]
|
|
118
|
+
if track_forcings:
|
|
119
|
+
for forcing in track_forcings:
|
|
120
|
+
_offshore_model.add_forcing(forcing)
|
|
121
|
+
|
|
122
|
+
# Add wind and if applicable pressure forcing from meteo data
|
|
123
|
+
elif isinstance(_offshore_model._event, HistoricalEvent):
|
|
124
|
+
wind_forcings = [
|
|
125
|
+
f
|
|
126
|
+
for f in _offshore_model._event.get_forcings()
|
|
127
|
+
if isinstance(f, IWind)
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
if wind_forcings:
|
|
131
|
+
if len(wind_forcings) > 1:
|
|
132
|
+
raise ValueError("Only one wind forcing is allowed")
|
|
133
|
+
wind_forcing = wind_forcings[0]
|
|
134
|
+
|
|
135
|
+
# Add wind forcing
|
|
136
|
+
if wind_forcing not in track_forcings:
|
|
137
|
+
_offshore_model.add_forcing(wind_forcing)
|
|
138
|
+
|
|
139
|
+
# Add pressure forcing for the offshore model (this doesnt happen normally in _add_forcing_wind() for overland models)
|
|
140
|
+
if isinstance(wind_forcing, WindMeteo):
|
|
141
|
+
ds = MeteoHandler().read(_offshore_model._event.time)
|
|
142
|
+
_offshore_model._add_pressure_forcing_from_grid(ds=ds)
|
|
143
|
+
|
|
144
|
+
# write sfincs model in output destination
|
|
145
|
+
_offshore_model.write(path_out=sim_path)
|
|
146
|
+
|
|
147
|
+
def _execute_sfincs_offshore(self, sim_path: Path):
|
|
148
|
+
self.logger.info(f"Running offshore model in {sim_path}")
|
|
149
|
+
sim_path = self._get_simulation_path()
|
|
150
|
+
with SfincsAdapter(model_root=sim_path) as _offshore_model:
|
|
151
|
+
if _offshore_model.sfincs_completed(sim_path):
|
|
152
|
+
self.logger.info(
|
|
153
|
+
"Skip running offshore model as it has already been run."
|
|
154
|
+
)
|
|
155
|
+
return
|
|
156
|
+
try:
|
|
157
|
+
_offshore_model.execute(path=sim_path)
|
|
158
|
+
except RuntimeError as e:
|
|
159
|
+
raise RuntimeError(
|
|
160
|
+
f"Failed to run offshore model for {self.scenario.name}"
|
|
161
|
+
) from e
|
|
162
|
+
|
|
163
|
+
def _get_simulation_path(self) -> Path:
|
|
164
|
+
main_event = self.database.events.get(self.scenario.event)
|
|
165
|
+
if main_event.mode == Mode.risk:
|
|
166
|
+
return (
|
|
167
|
+
db_path(
|
|
168
|
+
TopLevelDir.output,
|
|
169
|
+
object_dir=ObjectDir.scenario,
|
|
170
|
+
obj_name=self.scenario.name,
|
|
171
|
+
)
|
|
172
|
+
/ "Flooding"
|
|
173
|
+
/ "simulations"
|
|
174
|
+
/ self.event.name
|
|
175
|
+
/ self.template_path.name
|
|
176
|
+
)
|
|
177
|
+
else:
|
|
178
|
+
return (
|
|
179
|
+
db_path(
|
|
180
|
+
TopLevelDir.output,
|
|
181
|
+
object_dir=ObjectDir.scenario,
|
|
182
|
+
obj_name=self.scenario.name,
|
|
183
|
+
)
|
|
184
|
+
/ "Flooding"
|
|
185
|
+
/ "simulations"
|
|
186
|
+
/ self.template_path.name
|
|
187
|
+
)
|