Skip to content

Commit caa73c3

Browse files
authored
Merge pull request #86 from ioannis-vm/2024-12_update_warning_v2
Turn warning into an error.
2 parents 21a0858 + c5dff23 commit caa73c3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

pelicun/model/damage_model.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,9 @@ def _create_dmg_RVs( # noqa: N802, C901
11801180
ValueError
11811181
Raises an error if the scaling specification is invalid or
11821182
if the input DataFrame does not meet the expected format.
1183+
ValueError
1184+
If a capacity scaling operation is associated with an
1185+
unsupported distribution.
11831186
TypeError
11841187
If there are any issues with the types of the data in the
11851188
input DataFrame.
@@ -1390,18 +1393,18 @@ def map_ds(values: np.ndarray, offset: int) -> np.ndarray:
13901393
]
13911394

13921395
if capacity_adjustment_operation:
1393-
if family in {'normal', 'lognormal', 'deterministic'}:
1394-
theta[0] = self._handle_operation(
1395-
theta[0],
1396-
capacity_adjustment_operation[0],
1397-
float(capacity_adjustment_operation[1]),
1398-
)
1399-
else:
1400-
self.log.warning(
1396+
if family not in {'normal', 'lognormal', 'deterministic'}:
1397+
msg = (
14011398
f'Capacity adjustment is only supported '
14021399
f'for `normal` or `lognormal` distributions. '
14031400
f'Ignoring: `{cmp_loc_dir}`, which is `{family}`'
14041401
)
1402+
raise ValueError(msg)
1403+
theta[0] = self._handle_operation(
1404+
theta[0],
1405+
capacity_adjustment_operation[0],
1406+
float(capacity_adjustment_operation[1]),
1407+
)
14051408

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

0 commit comments

Comments
 (0)