Commit ff68bcb1 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Changed behaviour of calc_mask_nodata() recognizing pixels as nodata that...

Changed behaviour of calc_mask_nodata() recognizing pixels as nodata that contain the nodata value in any band. Now they need to contain it in ALL bands.
parent 25b32e9f
Pipeline #3174 passed with stages
in 1 minute and 27 seconds
......@@ -633,6 +633,9 @@ class GeoArray(object):
def calc_mask_nodata(self, fromBand=None, overwrite=False):
"""Calculates a no data mask with (values: 0=nodata; 1=data)
NOTE: Only pixel containing the nodata values in ALL bands are recognized as nodata pixel. If they contain a
pixel value different from the nodata value in any band they are good data pixels.
:param fromBand: <int> index of the band to be used (if None, all bands are used)
:param overwrite: <bool> whether to overwrite existing nodata mask that has already been calculated
......@@ -651,11 +654,11 @@ class GeoArray(object):
elif np.isnan(self.nodata):
self.mask_nodata = \
np.invert(np.isnan(arr)) if arr.ndim == 2 else \
np.all(np.invert(np.isnan(arr)), axis=2)
np.any(np.invert(np.isnan(arr)), axis=2)
self.mask_nodata = \, self.nodata).mask if arr.ndim == 2 else \
np.all(, self.nodata).mask, axis=2)
np.any(, self.nodata).mask, axis=2)
def find_noDataVal(self, bandIdx=0, sz=3):
"""Tries to derive no data value from homogenious corner pixels within 3x3 windows (by default).
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment