Skip to content

Commit

Permalink
Turn warning into an error.
Browse files Browse the repository at this point in the history
Also reorders the branches of the if statement to avoid excessive
indentation.
  • Loading branch information
ioannis-vm committed Dec 6, 2024
1 parent 21a0858 commit c5dff23
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pelicun/model/damage_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,9 @@ def _create_dmg_RVs( # noqa: N802, C901
ValueError
Raises an error if the scaling specification is invalid or
if the input DataFrame does not meet the expected format.
ValueError
If a capacity scaling operation is associated with an
unsupported distribution.
TypeError
If there are any issues with the types of the data in the
input DataFrame.
Expand Down Expand Up @@ -1390,18 +1393,18 @@ def map_ds(values: np.ndarray, offset: int) -> np.ndarray:
]

if capacity_adjustment_operation:
if family in {'normal', 'lognormal', 'deterministic'}:
theta[0] = self._handle_operation(
theta[0],
capacity_adjustment_operation[0],
float(capacity_adjustment_operation[1]),
)
else:
self.log.warning(
if family not in {'normal', 'lognormal', 'deterministic'}:
msg = (
f'Capacity adjustment is only supported '
f'for `normal` or `lognormal` distributions. '
f'Ignoring: `{cmp_loc_dir}`, which is `{family}`'
)
raise ValueError(msg)
theta[0] = self._handle_operation(
theta[0],
capacity_adjustment_operation[0],
float(capacity_adjustment_operation[1]),
)

tr_lims = [
frg_params_ls.get(f'Truncate{side}', np.nan)
Expand Down

0 comments on commit c5dff23

Please sign in to comment.