def extract_kernel(self, ds, band, x, y, transform): #no need to mask the kernel full_rectangle = lthacks.extract_kernel(ds, x, y, self.width, self.height, band, transform) return full_rectangle, full_rectangle
def extractMaskedKernel(data, width, height, ds, band, x, y, transform): # extract full rectangle kernel full_rectangle = lthacks.extract_kernel(ds, x, y, width, height, band, transform) if np.any(full_rectangle == -9999) or full_rectangle is None: return None, None else: # define a masked array so that stats can be computed mask = data[:, :, 0] mx = np.ma.masked_array(full_rectangle, mask=mask) return mx, mx.data[~mx.mask]
def extractMaskedKernel(data, width, height, ds, band, x, y, transform): # extract full rectangle kernel full_rectangle = lthacks.extract_kernel( ds, x, y, width, height, band, transform) if np.any(full_rectangle == -9999) or full_rectangle is None: return None, None else: # define a masked array so that stats can be computed mask = data[:,:,0] mx = np.ma.masked_array(full_rectangle, mask=mask) return mx, mx.data[~mx.mask]