classMask#
- geetools.ImageAccessor.classMask(class_info, classes=None, band=0)#
Create a mask using the class information.
In this case there is no option for “all” or “any” because class bands cannot contain 2 classes in the same pixel value.
- Parameters:
Example
import ee, geetools from geetools.utils import initialize_documentation initialize_documentation() class_info = { '2': 'dark', '3': 'shadow', '7': 'clouds_low', '8': 'clouds_mid', '9': 'clouds_high', '10': 'cirrus' } image = ee.Image("COPERNICUS/S2_SR_HARMONIZED/20230120T142709_20230120T143451_T18GYT") decoded = image.geetools.classMask(class_info, classes=["dark", "shadow"], band="SCL") decoded.getInfo()
{'type': 'Image', 'bands': [{'id': 'mask', 'data_type': {'type': 'PixelType', 'precision': 'int', 'min': 0, 'max': 1}, 'crs': 'EPSG:32718', 'crs_transform': [20, 0, 699960, 0, -20, 5300020]}]}