I’m trying (with python) to mask cloudy pixels from terrascope LAI product following the openEO cookbook.
No problem if I strictly follow the cookbook example use the .band()
to select the classification layer and build a mask:
import openeo
# load data from openo
con = openeo.connect("https://openeo.vito.be").authenticate_oidc(provider_id="egi")
# Load data cube from TERRASCOPE_S2_NDVI_V2 collection.
datacube = con.load_collection("TERRASCOPE_S2_LAI_V2",
spatial_extent={"west": 5.60, "south": 50.42, "east": 6.3, "north": 50.7},
temporal_extent=["2022-07-01", "2022-08-15"],
bands=["LAI_10M","SCENECLASSIFICATION_20M"])
# get classification band
SCL = datacube.band("SCENECLASSIFICATION_20M")
LAI = datacube.band("LAI_10M")
# masking
mask = ~ ((SCL == 4) | (SCL == 5))
LAI_masked = LAI.mask(mask)
But the .band()
is not documented in the openEO hub and I tried to use .filterbands()
… And I’m getting an error when using the mask I built with .filter_bands()
, meaning that the two processes results in different outputs. Do you have an explanation?
# get classification band
SCL = datacube.filter_bands(bands = ["SCENECLASSIFICATION_20M"])
LAI = datacube.filter_bands(bands = ["LAI_10M"])
# masking
mask = ~ ((SCL == 4) | (SCL == 5))
#Error: OperatorException: Unsupported unary operator 'not' (band math mode=False)