Skip to content

Commit

Permalink
Fixes type casting when data are None
Browse files Browse the repository at this point in the history
  • Loading branch information
MoseleyS committed Sep 11, 2023
1 parent b2b211d commit d5096ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions improver/nbhood/nbhood.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,12 @@ def _calculate_neighbourhood(
data[data_mask] = 0

if self.sum_only:
area_sum = None
max_extreme_data = None
else:
area_sum = self._do_nbhood_sum(valid_data_mask)
max_extreme_data = area_sum.astype(loc_data_dtype)
# Where data are all ones in nbhood, result will be same as area_sum
data = self._do_nbhood_sum(data, max_extreme=area_sum.astype(loc_data_dtype))
data = self._do_nbhood_sum(data, max_extreme=max_extreme_data)

if not self.sum_only:
with np.errstate(divide="ignore", invalid="ignore"):
Expand Down

0 comments on commit d5096ed

Please sign in to comment.