Dear APEx devs,
i try to dilate the S2 SCL cloud layer (on cdse backend) using this code:
scl = con.load_collection(collection_id="SENTINEL2_L2A", [...], bands=['SCL'])
s2_cube = con.load_collection(collection_id="SENTINEL2_L2A", [...], bands=[...])
cond_scl_cloud = ((scl == 3) | (scl == 8) | (scl == 9) | (scl == 10))
# dilation
k = 11
kernel = array_create([[1.0] * k for _ in range(k)])
dilated_mask = cond_scl_cloud.apply_kernel(kernel=kernel).multiply(1.0)
dilated_mask = (dilated_mask > 0).multiply(1.0)
# masking
b02_masked = s2_cube.band("B02").mask(dilated_mask)
return b02_masked
Using the original scl mask, the B02 looks like expected:
However, using the dilated mask, there are weird artifacts appearing:
I tried casting in various places (as suggested by another thread), but so far without success
Could you help me here? Thanks in advance

