修复NumPy兼容性:np.percentile参数interpolation改为method(Kutser/Hedley/SUGAR)
This commit is contained in:
@ -36,9 +36,9 @@ class Hedley:
|
|||||||
# 如果存在水域掩膜,只在掩膜内计算R_min
|
# 如果存在水域掩膜,只在掩膜内计算R_min
|
||||||
if self.water_mask is not None:
|
if self.water_mask is not None:
|
||||||
nir_band_masked = self.im_aligned[:,:,self.NIR_band][self.water_mask.astype(bool)]
|
nir_band_masked = self.im_aligned[:,:,self.NIR_band][self.water_mask.astype(bool)]
|
||||||
self.R_min = np.percentile(nir_band_masked, 5, interpolation='nearest') if nir_band_masked.size > 0 else 0
|
self.R_min = np.percentile(nir_band_masked, 5, method='nearest') if nir_band_masked.size > 0 else 0
|
||||||
else:
|
else:
|
||||||
self.R_min = np.percentile(self.im_aligned[:,:,self.NIR_band].ravel(), 5, interpolation='nearest')
|
self.R_min = np.percentile(self.im_aligned[:,:,self.NIR_band].ravel(), 5, method='nearest')
|
||||||
|
|
||||||
def _read_shp_to_bbox(self, shp_path):
|
def _read_shp_to_bbox(self, shp_path):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -42,9 +42,9 @@ class Kutser:
|
|||||||
# 如果存在水域掩膜,只在掩膜内计算R_min
|
# 如果存在水域掩膜,只在掩膜内计算R_min
|
||||||
if self.water_mask is not None:
|
if self.water_mask is not None:
|
||||||
nir_band_masked = self.im_aligned[:,:,self.NIR_band][self.water_mask.astype(bool)]
|
nir_band_masked = self.im_aligned[:,:,self.NIR_band][self.water_mask.astype(bool)]
|
||||||
self.R_min = np.percentile(nir_band_masked, 5, interpolation='nearest') if nir_band_masked.size > 0 else 0
|
self.R_min = np.percentile(nir_band_masked, 5, method='nearest') if nir_band_masked.size > 0 else 0
|
||||||
else:
|
else:
|
||||||
self.R_min = np.percentile(self.im_aligned[:,:,self.NIR_band].ravel(), 5, interpolation='nearest')
|
self.R_min = np.percentile(self.im_aligned[:,:,self.NIR_band].ravel(), 5, method='nearest')
|
||||||
|
|
||||||
def _read_shp_to_bbox(self, shp_path):
|
def _read_shp_to_bbox(self, shp_path):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -318,7 +318,7 @@ class SUGAR:
|
|||||||
est_background = self.get_est_background(self.im_aligned[:,:,i])
|
est_background = self.get_est_background(self.im_aligned[:,:,i])
|
||||||
est_background_list.append(est_background)
|
est_background_list.append(est_background)
|
||||||
else:
|
else:
|
||||||
est_background = np.percentile(self.im_aligned[:,:,i], 5, interpolation='nearest')
|
est_background = np.percentile(self.im_aligned[:,:,i], 5, method='nearest')
|
||||||
est_background_list.append(est_background)
|
est_background_list.append(est_background)
|
||||||
bounds = self.bounds[i]
|
bounds = self.bounds[i]
|
||||||
b = self.optimise_correction_by_band(self.im_aligned[:,:,i],glint_mask,est_background,bounds)
|
b = self.optimise_correction_by_band(self.im_aligned[:,:,i],glint_mask,est_background,bounds)
|
||||||
|
|||||||
Reference in New Issue
Block a user