Skip to content

Commit 54433e0

Browse files
committed
fix check for correctly interpolated surge impacts
1 parent c2d31e7 commit 54433e0

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

pyCIAM/run.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ def calc_costs(
339339
.reset_coords(drop=True)
340340
.frac_losses.rename(lslr_by_seg="lslr", rh_diff_by_seg="rh_diff")
341341
)
342+
lslr_too_low = lslr.sel(seg=seg) < this_surge_lookup.lslr.min()
342343
if this_surge_lookup.sum() == 0:
343344
continue
344345
this_surge_noadapt = (
@@ -353,9 +354,7 @@ def calc_costs(
353354
)
354355

355356
# ensure nans are only at the beginning
356-
assert this_surge_noadapt.isnull().sum(
357-
"lslr"
358-
) == this_surge_noadapt.notnull().argmax("lslr")
357+
assert (this_surge_noadapt.notnull() | lslr_too_low).all()
359358

360359
surge_noadapt.append(this_surge_noadapt.fillna(0))
361360

@@ -374,9 +373,7 @@ def calc_costs(
374373
)
375374

376375
# ensure nans are only at the beginning
377-
assert this_surge_adapt.isnull().sum(
378-
"lslr"
379-
) == this_surge_adapt.notnull().argmax("lslr")
376+
assert (this_surge_adapt.notnull() | lslr_too_low).all()
380377

381378
surge_adapt.append(this_surge_adapt.fillna(0))
382379
surge.append(
@@ -1078,7 +1075,6 @@ def execute_pyciam(
10781075
# determine whether to check for finished jobs
10791076
if output_path is None:
10801077
check = False
1081-
tmp_output_path = None
10821078
else:
10831079
check = True
10841080

0 commit comments

Comments
 (0)