Cloud mask at surrounded area by boundary coordinates

I am surrounding some specific areas by boundary coordinates on sentinel-hub WMTS layers for my application. Configuration utility and s2cloudless seems to be available to detect clouds at per tiles not like specific area as I am expecting to mask clouds. Is it possible to mask clouds in such specific areas? If yes, JavaScript is convenient for my purposes. Any example would be appreciated.

You can simply use CLM (cloud mask) or CLP (cloud probability) “bands” both with Sentinel-2 L1C or L2A data (e.g. define them as layers in configurator tool or use them in your script to remove cloudy data).

The masks and probabilities have been calculated with s2cloudless. Also have a look at a blog post.

1 Like

I understand CLM and CLP becomes good help to detect clouds. My next question is how I am removing cloudy data detected by CLM/CLP bands. The blog post shows a way of changing RGB if sample.CLM == 1. How would cloudy data be removed in this case?

When you say removed, what would you replace it with?

Replacing cloudy parts with no cloudy parts.

What you are looking for is called a “cloudless mosaick”. There are already some blog posts on that topic (e.g. How to create cloudless mosaic), and another one is on its way (to be published in next days, will update the answer when it is finished).

Beware that preparing cloudless mosaic requires dealing with temporal data (one needs several observations to get at least one good cloudless observation). Look around the forum as well, I believe there should be some posts on that topic.

Good luck!

1 Like