Sentinel 2 from ESA satellite is sensitive to clouds when producing images. It is important to generate a cloud mask layer to avoid bad calculations during image processings.
This post is written to highlight the some delaults of cloud mask algorithm from ESA (sen2cor) as shown on the following example.
On the above image it is clear that there are clouds masking the ground, cloud shadows are more difficult to discern.
By using a composite image and replacing the red band by the near infra red band, cloud shadow is more visible.
The cloud shadow detection is a quite difficult problem because, on the ground, the distance between the shadow and the cloud depend on the cloud altitude, increasing with cloud height and the inverse sun angle (during winter sun angle is around 20° so cloud shadow footprint will be far from the cloud footprint), Thus, defining a security perimeter around the cloud to avoid shadow problems is quite impossible. Some times the shadow is distant from the cloud footprint by several kilometers and sometimes is jointing the cloud footprint. Sen2cor is planned to take all these elements in consideration, but, unfortunately, with a lack of accuracy.
As shown on above image, cloud shadow id not well detected by the algorithm, which is visble when zooming on a field:
As a complement of Sen2cor which is nethertheless efficient and it out of question to let it down, a decision tree regression model was developped to focus on clouds and cloud shadow which produced the following results:
Clearly, using the decision tree help in shadow detection by discarding dark pixels using the NIR band and setting a thresold.
The two masks will be used in superposition to discard bad pixels, it will be interesting to test other algorithms like Fmask and optram model, also some convolutional neural network could be tested as, like regression decision trees, they are regression and classification systems.