Skip to content

Commit

Permalink
Converting numpy.in1d to numpy.isin for numpy2 compatibility. RE:natc…
Browse files Browse the repository at this point in the history
  • Loading branch information
phargogh committed Oct 15, 2024
1 parent b49dea2 commit 206c8f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/natcap/invest/scenario_gen_proximity.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def _convert_landscape(

def _mask_base_op(lulc_array):
"""Create a mask of valid non-base pixels only."""
base_mask = numpy.in1d(
base_mask = numpy.isin(
lulc_array.flatten(), focal_landcover_codes).reshape(
lulc_array.shape)
if invert_mask:
Expand Down Expand Up @@ -535,7 +535,7 @@ def _combine_masks(base_distance_array, non_base_distance_array):
# turn inside and outside masks into a single mask
def _mask_to_convertible_codes(distance_from_base_edge, lulc):
"""Mask out the distance transform to a set of lucodes."""
convertible_mask = numpy.in1d(
convertible_mask = numpy.isin(
lulc.flatten(), convertible_type_list).reshape(lulc.shape)
return numpy.where(
convertible_mask, distance_from_base_edge,
Expand Down

0 comments on commit 206c8f0

Please sign in to comment.