Skip to content

Commit

Permalink
Merge pull request #379 from Deltares/376-fix-damage_curve-field-init…
Browse files Browse the repository at this point in the history
…ialization

376 fix damage curve field initialization
  • Loading branch information
Carsopre authored Mar 21, 2024
2 parents b3ae03b + 16c882a commit 1a52850
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 9 additions & 5 deletions ra2ce/analysis/analysis_config_data/analysis_config_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
from pathlib import Path
from typing import Optional

from ra2ce.analysis.analysis_config_data.enums import damage_curve_enum
from ra2ce.analysis.analysis_config_data.enums.analysis_direct_enum import (
AnalysisDirectEnum,
)
from ra2ce.analysis.analysis_config_data.enums.analysis_indirect_enum import (
AnalysisIndirectEnum,
)
from ra2ce.analysis.analysis_config_data.enums.damage_curve_enum import DamageCurveEnum
from ra2ce.analysis.analysis_config_data.enums.event_type_enum import EventTypeEnum
from ra2ce.analysis.analysis_config_data.enums.loss_type_enum import LossTypeEnum
from ra2ce.analysis.analysis_config_data.enums.risk_calculation_mode_enum import (
Expand Down Expand Up @@ -91,14 +91,18 @@ class AnalysisSectionIndirect(AnalysisSectionBase):
disruption_per_category: str = ""
traffic_cols: list[str] = field(default_factory=list)
# losses
duration_event: float = math.nan # TODO remove the deprecated attribute that have been replaced by csv
duration_event: float = (
math.nan
) # TODO remove the deprecated attribute that have been replaced by csv
duration_disruption: float = math.nan
fraction_detour: float = math.nan
fraction_drivethrough: float = 0.0
rest_capacity: float = math.nan
maximum_jam: float = math.nan
part_of_day: PartOfDayEnum = field(default_factory=lambda: PartOfDayEnum.DAY)
performance: str = "diff_time" # "diff_time" or "diff_length" relates to the used criticality metric
performance: str = (
"diff_time" # "diff_time" or "diff_length" relates to the used criticality metric
)
resilience_curve_file: Optional[Path] = None
traffic_intensities_file: Optional[Path] = None
values_of_time_file: Optional[Path] = None
Expand Down Expand Up @@ -134,8 +138,8 @@ class AnalysisSectionDirect(AnalysisSectionBase):
climate_period: float = math.nan
# road damage
event_type: EventTypeEnum = field(default_factory=lambda: EventTypeEnum.INVALID)
damage_curve: damage_curve_enum.DamageCurveEnum = field(
default_factory=lambda: EventTypeEnum.INVALID
damage_curve: DamageCurveEnum = field(
default_factory=lambda: DamageCurveEnum.INVALID
)
risk_calculation_mode: RiskCalculationModeEnum = field(
default_factory=lambda: RiskCalculationModeEnum.NONE
Expand Down
1 change: 0 additions & 1 deletion ra2ce/analysis/analysis_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
)
from ra2ce.analysis.indirect.single_link_losses import SingleLinkLosses
from ra2ce.analysis.indirect.single_link_redundancy import SingleLinkRedundancy
from ra2ce.network.hazard.hazard_names import HazardNames


class AnalysisFactory:
Expand Down

0 comments on commit 1a52850

Please sign in to comment.