From c9a32a04d72ab32eae54936ab2822d9a38242510 Mon Sep 17 00:00:00 2001 From: lukas Date: Fri, 1 Dec 2023 13:01:16 +0100 Subject: [PATCH] changed signs in offset calculation to be consistent with QGIS --- eodal/core/band.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eodal/core/band.py b/eodal/core/band.py index ab81e11..4fc06bc 100644 --- a/eodal/core/band.py +++ b/eodal/core/band.py @@ -2230,24 +2230,24 @@ def scale_data( scale, offset = self.scale, self.offset if self.is_masked_array: if pixel_values_to_ignore is None: - scaled_array = scale * self.values.data - offset + scaled_array = scale * self.values.data + offset else: scaled_array = self.values.data.copy().astype(float) scaled_array[~np.isin(scaled_array, pixel_values_to_ignore)] = scale * \ scaled_array[~np.isin(scaled_array, pixel_values_to_ignore)] \ - - offset + + offset # reuse fill value fill_value = self.values.fill_value scaled_array = np.ma.MaskedArray( data=scaled_array, mask=self.values.mask, fill_value=fill_value) elif self.is_ndarray: if pixel_values_to_ignore is None: - scaled_array = scale * self.values - offset + scaled_array = scale * self.values + offset else: scaled_array = self.values.copy().astype(float) scaled_array[~np.isin(scaled_array, pixel_values_to_ignore)] = scale * \ scaled_array[~np.isin(scaled_array, pixel_values_to_ignore)] \ - - offset + + offset elif self.is_zarr: raise NotImplementedError()