Skip to content

Commit

Permalink
fix check for correctly interpolated surge impacts
Browse files Browse the repository at this point in the history
  • Loading branch information
bolliger32 committed Jan 6, 2025
1 parent c2d31e7 commit 54433e0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pyCIAM/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def calc_costs(
.reset_coords(drop=True)
.frac_losses.rename(lslr_by_seg="lslr", rh_diff_by_seg="rh_diff")
)
lslr_too_low = lslr.sel(seg=seg) < this_surge_lookup.lslr.min()
if this_surge_lookup.sum() == 0:
continue
this_surge_noadapt = (
Expand All @@ -353,9 +354,7 @@ def calc_costs(
)

# ensure nans are only at the beginning
assert this_surge_noadapt.isnull().sum(
"lslr"
) == this_surge_noadapt.notnull().argmax("lslr")
assert (this_surge_noadapt.notnull() | lslr_too_low).all()

surge_noadapt.append(this_surge_noadapt.fillna(0))

Expand All @@ -374,9 +373,7 @@ def calc_costs(
)

# ensure nans are only at the beginning
assert this_surge_adapt.isnull().sum(
"lslr"
) == this_surge_adapt.notnull().argmax("lslr")
assert (this_surge_adapt.notnull() | lslr_too_low).all()

surge_adapt.append(this_surge_adapt.fillna(0))
surge.append(
Expand Down Expand Up @@ -1078,7 +1075,6 @@ def execute_pyciam(
# determine whether to check for finished jobs
if output_path is None:
check = False
tmp_output_path = None
else:
check = True

Expand Down

0 comments on commit 54433e0

Please sign in to comment.