Skip to content

Commit

Permalink
if the weighted sum of scores is 0, they are more likely all nans and…
Browse files Browse the repository at this point in the history
… we shouldn't report an overall score. h/t @mcguirepatr
  • Loading branch information
nocollier committed Aug 28, 2024
1 parent 84ae1bf commit 26774d9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ILAMB/Confrontation.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,8 @@ def _computeOverallScore(scalars):
weight = self.weight[score]
overall_score += weight * scalars.variables[v][...]
sum_of_weights += weight
if np.abs(overall_score) < 1e-12:
overall_score = np.nan
overall_score /= max(sum_of_weights, 1e-12)
scores["Overall Score %s" % region] = overall_score
return scores
Expand Down

1 comment on commit 26774d9

@mcguirepatr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Nathan!

Please sign in to comment.