Skip to content

Commit

Permalink
chore/remove deprecated attributes for losses analysis config (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasHauthDeltares authored Nov 29, 2024
1 parent 1b9f0f5 commit cf373ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 31 deletions.
10 changes: 1 addition & 9 deletions ra2ce/analysis/analysis_config_data/analysis_config_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
)
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 (
RiskCalculationModeEnum,
)
Expand Down Expand Up @@ -90,17 +89,13 @@ class AnalysisSectionLosses(AnalysisSectionBase):
)
# general
weighing: WeighingEnum = field(default_factory=lambda: WeighingEnum.NONE)
loss_per_distance: str = ""
loss_type: LossTypeEnum = field(default_factory=lambda: LossTypeEnum.NONE)
disruption_per_category: str = ""

# losses
traffic_cols: list[str] = field(default_factory=list)
production_loss_per_capita_per_hour: float = math.nan
traffic_period: TrafficPeriodEnum = field(
default_factory=lambda: TrafficPeriodEnum.DAY
)
hours_per_traffic_period: int = 0
performance: str = "diff_time" # "diff_time" or "diff_length" relates to the used criticality metric
trip_purposes: list[TripPurposeEnum] = field(
default_factory=lambda: [TripPurposeEnum.NONE]
)
Expand All @@ -111,12 +106,9 @@ class AnalysisSectionLosses(AnalysisSectionBase):
# accessibility analyses
threshold: float = 0.0
threshold_destinations: float = math.nan
uniform_duration: float = math.nan
gdp_percapita: float = math.nan
equity_weight: str = ""
calculate_route_without_disruption: bool = False
buffer_meters: float = math.nan
threshold_locations: float = math.nan
category_field_name: str = ""
save_traffic: bool = False

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
)
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 (
RiskCalculationModeEnum,
)
Expand Down Expand Up @@ -128,9 +127,7 @@ def _get_analysis_section_losses(self, section_name: str) -> AnalysisSectionLoss
_section.weighing = WeighingEnum.LENGTH
else:
_section.weighing = WeighingEnum.get_enum(_weighing)
_section.loss_type = LossTypeEnum.get_enum(
self._parser.get(section_name, "loss_type", fallback=None)
)

# losses
_section.event_type = EventTypeEnum.get_enum(
self._parser.get(section_name, "event_type", fallback=None)
Expand All @@ -143,9 +140,6 @@ def _get_analysis_section_losses(self, section_name: str) -> AnalysisSectionLoss
"risk_calculation_year",
fallback=_section.risk_calculation_year,
)
_section.traffic_cols = self._parser.getlist(
section_name, "traffic_cols", fallback=_section.traffic_cols
)
_section.traffic_period = TrafficPeriodEnum.get_enum(
self._parser.get(section_name, "traffic_period", fallback=None)
)
Expand Down Expand Up @@ -177,16 +171,6 @@ def _get_analysis_section_losses(self, section_name: str) -> AnalysisSectionLoss
"threshold_destinations",
fallback=_section.threshold_destinations,
)
_section.uniform_duration = self._parser.getfloat(
section_name,
"uniform_duration",
fallback=_section.uniform_duration,
)
_section.gdp_percapita = self._parser.getfloat(
section_name,
"gdp_percapita",
fallback=_section.gdp_percapita,
)
_section.calculate_route_without_disruption = self._parser.getboolean(
section_name,
"calculate_route_without_disruption",
Expand All @@ -197,11 +181,6 @@ def _get_analysis_section_losses(self, section_name: str) -> AnalysisSectionLoss
"buffer_meters",
fallback=_section.buffer_meters,
)
_section.threshold_locations = self._parser.getfloat(
section_name,
"threshold_locations",
fallback=_section.threshold_locations,
)
_section.save_traffic = self._parser.getboolean(
section_name, "save_traffic", fallback=_section.save_traffic
)
Expand Down

0 comments on commit cf373ad

Please sign in to comment.