I am currently processing S2MSI2A products on SNAP ESA by removing pixels classified as cloud. On the base product, there are some interesting masks like ‘opaque_clouds’ and ‘cirrus_clouds’ but they are not very precise. By resampling a product (with the tool Raster > Geometric > Resample for example) we obtain new scl (sample scene classification layer) masks with a new classification of pixels, which seems more precise. Could anyone tell me how these scl masks are created, precisely? Is it based on a non-superivised classification? If so, with what parameters?
The band quality_scene_classification, which contains thge masks you mention, is only provided in 20m resolution in the Level-2 product.
During the resampling there is no additional classification performed. Just a resampling.
Bringing all bands to the same resolution, the comparison might give better results. How have you done the comparison?
Thanks for this explanation @marpet, I didn’t realize that these scl masks were already present on some bands! However, I noticed that these masks lacked precision and allowed many false negatives and therefore cloudy pixels to pass through. Is there a way to recover these forgotten pixels, without having to redo a classification?
Regarding the comparison, I don’t think there’s a major difference between the masks, whether they’re 20 metres or 60 metres. On the attached image, the masks scl_cloud_medium_proba, scl_cloud_high_proba and scl_thin_cirrus are shown in green; the mask scl_unclassified is in red.
There are not many options without doing a reclassification.
You could define a filter and let the cloud mask grow. or maybe you can find an expression which covers those cases were the cloud flagging is not good.
Alternatively, you could use the L1C data and use sen2cor (which is used in the ground segment) on your own. An adapter is available to use it from SNAP (Sen2Cor – STEP (esa.int)) With different settings it might give better results. I’m not sure if it allows you to configure the cloud masking process.
As alternative you could use other cloud detection processors. There was a comparison some time ago. CMIX - CalValPortal (ceos.org)
Idepix for example is available for SNAP as a plugin.