flood-adapt 0.3.0__py3-none-any.whl → 0.3.2__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 (32) hide show
  1. flood_adapt/__init__.py +1 -1
  2. flood_adapt/config/fiat.py +7 -7
  3. flood_adapt/config/site.py +2 -2
  4. flood_adapt/database_builder/database_builder.py +14 -6
  5. flood_adapt/dbs_classes/database.py +24 -17
  6. flood_adapt/dbs_classes/dbs_event.py +0 -15
  7. flood_adapt/dbs_classes/dbs_measure.py +15 -7
  8. flood_adapt/dbs_classes/dbs_static.py +3 -5
  9. flood_adapt/dbs_classes/dbs_template.py +3 -4
  10. flood_adapt/flood_adapt.py +115 -260
  11. flood_adapt/objects/__init__.py +40 -17
  12. flood_adapt/objects/benefits/benefits.py +6 -6
  13. flood_adapt/objects/events/event_set.py +4 -4
  14. flood_adapt/objects/events/events.py +18 -5
  15. flood_adapt/objects/events/historical.py +11 -8
  16. flood_adapt/objects/events/hurricane.py +11 -8
  17. flood_adapt/objects/events/synthetic.py +9 -7
  18. flood_adapt/objects/forcing/forcing.py +9 -1
  19. flood_adapt/objects/forcing/plotting.py +1 -0
  20. flood_adapt/objects/forcing/tide_gauge.py +14 -14
  21. flood_adapt/objects/forcing/time_frame.py +13 -0
  22. flood_adapt/objects/forcing/timeseries.py +27 -15
  23. flood_adapt/objects/measures/measures.py +38 -15
  24. flood_adapt/objects/object_model.py +2 -2
  25. flood_adapt/objects/projections/projections.py +18 -18
  26. flood_adapt/objects/strategies/strategies.py +22 -1
  27. flood_adapt/workflows/benefit_runner.py +1 -1
  28. {flood_adapt-0.3.0.dist-info → flood_adapt-0.3.2.dist-info}/METADATA +1 -2
  29. {flood_adapt-0.3.0.dist-info → flood_adapt-0.3.2.dist-info}/RECORD +32 -32
  30. {flood_adapt-0.3.0.dist-info → flood_adapt-0.3.2.dist-info}/LICENSE +0 -0
  31. {flood_adapt-0.3.0.dist-info → flood_adapt-0.3.2.dist-info}/WHEEL +0 -0
  32. {flood_adapt-0.3.0.dist-info → flood_adapt-0.3.2.dist-info}/top_level.txt +0 -0
@@ -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 Event
5
- from .events.historical import HistoricalEvent
6
- from .events.hurricane import HurricaneEvent
7
- from .events.synthetic import SyntheticEvent
8
- from .forcing.forcing_factory import ForcingFactory
9
- from .measures.measure_factory import MeasureFactory
10
- from .measures.measures import (
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 Projection
23
- from .scenarios.scenarios import Scenario
24
- from .strategies.strategies import Strategy
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, default=""
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], default = None
48
- The implementation cost of the strategy.
49
- annual_maint_cost : Optional[float], default = None
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, default=""
37
- The description of the event.
38
- mode : Mode, default=Mode.risk
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, default=""
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
@@ -200,7 +213,7 @@ class Event(Object):
200
213
  f"Allowed sources are: {allowed_sources}"
201
214
  )
202
215
 
203
- if Settings().validate_allowed_forcings:
216
+ if Settings().validate_allowed_forcings and hasattr(self, "ALLOWED_FORCINGS"):
204
217
  # Validate forcings
205
218
  for _, concrete_forcings in self.forcings.items():
206
219
  for concrete_forcing in concrete_forcings:
@@ -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, default=""
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, default=Template.Historical
22
- The template of the event.
23
- mode : Mode, default=Mode.single_event
24
- The mode of the event.
25
- rainfall_multiplier : float, default=1.0
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 : str, default=""
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, default=Template.Hurricane
36
- The template of the event.
37
- mode : Mode, default=Mode.single_event
38
- The mode of the event.
39
- rainfall_multiplier : float, default=1.0
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, default=Template.Synthetic
19
- The template of the event.
20
- mode : Mode, default=Mode.single_event
21
- The mode of the event.
22
- rainfall_multiplier : float, default=1.0
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"
@@ -39,6 +39,7 @@ from flood_adapt.objects.forcing.wind import (
39
39
  WindSynthetic,
40
40
  )
41
41
 
42
+ # TODO remove from frontend
42
43
  UNPLOTTABLE_SOURCES = [ForcingSource.TRACK, ForcingSource.METEO, ForcingSource.MODEL]
43
44
  logger = FloodAdaptLogging.getLogger("Plotting")
44
45
 
@@ -27,24 +27,24 @@ class TideGauge(BaseModel):
27
27
 
28
28
  Attributes
29
29
  ----------
30
- name : Optional[int | str], default=None
31
- Name of the tide gauge.
32
- description : Optional[str], default=""
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], default=None
39
- ID of the tide gauge data.
40
- file : Optional[Path], default=None
41
- Only for file based tide gauges. Should be a path relative to the static folder.
42
- lat : Optional[float], default=None
43
- Latitude of the tide gauge data.
44
- lon : Optional[float], default=None
45
- Longitude of the tide gauge data.
46
- units : us.UnitTypesLength, default=us.UnitTypesLength.meters
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
 
@@ -331,15 +331,21 @@ class BlockTimeseries(SyntheticTimeseries):
331
331
  end=(REFERENCE_TIME + self.end_time.to_timedelta()),
332
332
  freq=time_step,
333
333
  )
334
- ts = np.zeros((len(tt),)) + self.peak_value.value
334
+ if self.peak_value:
335
+ height_value = self.peak_value.value
336
+ elif self.cumulative:
337
+ area = self.cumulative.value
338
+ base = self.duration.convert(
339
+ us.UnitTypesTime.hours
340
+ ) # always expect duration in hours
341
+ height_value = area / base
342
+
343
+ ts = np.zeros((len(tt),)) + height_value
335
344
  return ts
336
345
 
337
346
  @model_validator(mode="after")
338
347
  def validate_attrs(self):
339
- if not self.peak_value:
340
- raise ValueError(
341
- f"{self.__class__.__name__} must have `peak_value` specified. {self.peak_value}"
342
- )
348
+ # either peak_value or cumulative must be set, which is already checked in the parent class: `either_value_or_cumulative`
343
349
  return self
344
350
 
345
351
 
@@ -355,17 +361,26 @@ class TriangleTimeseries(SyntheticTimeseries):
355
361
  freq=time_step,
356
362
  )
357
363
  tt_seconds = (tt - REFERENCE_TIME).total_seconds()
364
+ peak_time = self.peak_time.to_timedelta().total_seconds()
365
+ start_time = self.start_time.to_timedelta().total_seconds()
366
+
367
+ if self.peak_value:
368
+ height_value = self.peak_value.value
369
+ elif self.cumulative:
370
+ area = self.cumulative.value
371
+ base = self.duration.convert(
372
+ us.UnitTypesTime.hours
373
+ ) # always expect duration in hours
374
+ height_value = (2 * area) / base
358
375
 
359
376
  ascending_slope = (
360
- self.peak_value.value
377
+ height_value
361
378
  / (self.peak_time - self.start_time).to_timedelta().total_seconds()
362
379
  )
363
380
  descending_slope = (
364
- -self.peak_value.value
381
+ -height_value
365
382
  / (self.end_time - self.peak_time).to_timedelta().total_seconds()
366
383
  )
367
- peak_time = self.peak_time.to_timedelta().total_seconds()
368
- start_time = self.start_time.to_timedelta().total_seconds()
369
384
 
370
385
  ts = np.piecewise(
371
386
  tt_seconds,
@@ -373,7 +388,7 @@ class TriangleTimeseries(SyntheticTimeseries):
373
388
  [
374
389
  lambda x: np.maximum(ascending_slope * (x - start_time), 0),
375
390
  lambda x: np.maximum(
376
- descending_slope * (x - peak_time) + self.peak_value.value, 0
391
+ descending_slope * (x - peak_time) + height_value, 0
377
392
  ),
378
393
  0,
379
394
  ],
@@ -382,10 +397,7 @@ class TriangleTimeseries(SyntheticTimeseries):
382
397
 
383
398
  @model_validator(mode="after")
384
399
  def validate_attrs(self):
385
- if not self.peak_value:
386
- raise ValueError(
387
- f"{self.__class__.__name__} must have `peak_value` specified. {self.peak_value}"
388
- )
400
+ # either peak_value or cumulative must be set, which is already checked in the parent class: `either_value_or_cumulative`
389
401
  return self
390
402
 
391
403
 
@@ -549,4 +561,4 @@ class TimeseriesFactory:
549
561
 
550
562
  @staticmethod
551
563
  def from_object(obj: SyntheticTimeseries) -> SyntheticTimeseries:
552
- return TimeseriesFactory.from_args(**obj.model_dump())
564
+ return TimeseriesFactory.from_args(**obj.model_dump(exclude_none=True))
@@ -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 ImpactMeasure."""
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, default MeasureType.floodwall
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, Optional
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
- floatd
496
- Area [m2]
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)
@@ -13,8 +13,8 @@ class Object(BaseModel):
13
13
  ----------
14
14
  name : str
15
15
  Name of the object.
16
- description : str (optional)
17
- Description of the object.
16
+ description : str
17
+ Description of the object. defaults to "".
18
18
  """
19
19
 
20
20
  name: str = Field(
@@ -14,14 +14,14 @@ class PhysicalProjection(BaseModel):
14
14
 
15
15
  Attributes
16
16
  ----------
17
- sea_level_rise : us.UnitfulLength, default = us.UnitfulLength(0.0, us.UnitTypesLength.meters).
18
- The sea level rise in meters.
19
- subsidence : us.UnitfulLength, default = us.UnitfulLength(0.0, us.UnitTypesLength.meters).
20
- The subsidence in meters.
21
- rainfall_multiplier : float, default = 1.0.
22
- The rainfall multiplier.
23
- storm_frequency_increase : float, default = 0.0.
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, default = 0.0.
43
- The existing population growth rate.
44
- economic_growth : float, default = 0.0.
45
- The economic growth rate.
46
- population_growth_new : float, default = 0.0.
47
- The population growth rate for new developments.
48
- new_development_elevation : us.UnitfulLengthRefValue, default = None.
49
- The elevation of new developments.
50
- new_development_shapefile : str, default = None.
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 paths and types."""
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