bitsMaskAny#

geetools.ee_image.ImageAccessor.bitsMaskAny(bits_info, classes=None, band=0)#

Create a mask using the bits information.

Parameters:
  • bits_info (dict) – bits encodings information (client-side only).

  • classes (Optional[list]) – name of the classes to use for the mask. If None it will use all classes in bits_info.

  • band (str | int) – name of the bit band. Defaults to first band.

Returns:

an image with one band named ‘any_mask’, with 1s where ANY of the classes is present and 0s where not.

Return type:

ee.Image

Example

import ee, geetools

ee.Initialize()

ls = ee.Image("LANDSAT/LC09/C02/T1_L2/LC09_232090_20220508")
bits = {
    '7': 'Water',
    '8-9': {
        '1': 'Low',
        '2': 'Medium',
        '3': 'High'
    }
}
mask = ls.geetools.bitsMaskAny(bits, ['Water', 'High'], 'QA_PIXEL')