Skip to content

Commit

Permalink
Merge pull request #126 from bhjolly/stats-nan-fix
Browse files Browse the repository at this point in the history
fix for issue where np.nan was not ignored for stats. #125
  • Loading branch information
neilflood authored Jan 22, 2025
2 parents 49cd367 + c1ab717 commit ced01d6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rios/calcstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,8 @@ def doStatsAccum(self, arr):
"""
if self.nullval is None:
values = arr.flatten()
elif numpy.isnan(self.nullval):
values = arr[~numpy.isnan(arr)]
else:
values = arr[arr != self.nullval]
if len(values) > 0:
Expand Down

0 comments on commit ced01d6

Please sign in to comment.