From 206c8f06cb82c0c8e0375792ce852c2efd78ebf8 Mon Sep 17 00:00:00 2001 From: James Douglass Date: Tue, 15 Oct 2024 16:48:06 -0700 Subject: [PATCH] Converting numpy.in1d to numpy.isin for numpy2 compatibility. RE:#1641 --- src/natcap/invest/scenario_gen_proximity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/natcap/invest/scenario_gen_proximity.py b/src/natcap/invest/scenario_gen_proximity.py index bb62ce8fae..5f23f95269 100644 --- a/src/natcap/invest/scenario_gen_proximity.py +++ b/src/natcap/invest/scenario_gen_proximity.py @@ -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: @@ -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,