Skip to content

Commit

Permalink
Fixed numba error handling masked arrays in hysteresis.
Browse files Browse the repository at this point in the history
  • Loading branch information
djgagne committed Jan 9, 2024
1 parent e70b9e0 commit fc4ef9d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hagelslag/processing/Hysteresis.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ def label(self, input_grid):
"""
high_labels, num_labels = label(input_grid > self.max_intensity)
region_ranking = np.argsort(maximum(input_grid, high_labels, index=np.arange(1, num_labels + 1)))[::-1]
output_grid = grow_objects(input_grid, high_labels, region_ranking, self.min_intensity)
if np.ma.isMA(input_grid):
input_grid_unmasked = np.where(input_grid.mask, 0, input_grid)
else:
input_grid_unmasked = input_grid
output_grid = grow_objects(input_grid_unmasked, high_labels, region_ranking, self.min_intensity)
return output_grid

@staticmethod
Expand Down

0 comments on commit fc4ef9d

Please sign in to comment.