How to Create Cloudless Mosaics
One of the problems with optical satellite imagery is that you don’t always see the ground as clouds get in the way. For small areas (i.e. a few hundred km in each direction) it can suffice to wait for clear skies. However, notoriously cloudy areas, such as various tropical ones, and larger areas such as entire countries, continents, or even the world, present a problem. With these we cannot practically wait for clear skies. And if we want to create a cloudless mosaic, we need to find a proper solution.
How to Create a Cloudless Mosaic?
Since it often happens that one small area on a certain date can be cloud-free, the solution requires merging and stitching images. So, let’s just choose that area and repeat until the entire area of interest is covered. The beauty of this solution is that the whole process can be done in Sentinel Hub.
One way to create a mosaic is to define the “small area” as one pixel. Each pixel in the resulting mosaic should be the best pixel from bunch of images. OK but how do you do that? And what about the clouds you mentioned in the beginning? And won’t there be artifacts since everything is done per pixel?
All valid objections, yet incidentally, with the right choice of pixel selection function and enough data, the results turn out rather good.
So How Do We Really Do It?
Take a stack of images, and for each pixel in the output image get all the values of input data at that pixel. Some of these values will come from pixels in images covered with clouds. In order to get as good results as possible such pixels and corresponding values need to be masked out. This is done by a validity function that flags each pixel in the image stack as either valid or invalid (i.e. cloudy pixel).
Use statistics. With a large amount of data this increases the number of valid input values which in turn also decreases the variance. Lower variance means a more stable choice of value, therefore fewer artifacts, as the choice function is closer to continuous.
In practice, we order the valid input values from lowest to highest, and take the value at the first quartile. At this point, you might ask yourself why not the median. Testing has shown that the most obvious choice for the validity function for Sentinel-2 — the scene classification map produced by Sen2Cor — fails to correctly identify all the clouds. So clouds can creep in in particularly cloudy areas. Taking the median instead of the first quartile produces in such cases too bright mosaics.
The validity function. Sentinel-2 atmospherically corrected (L2A) data comes with scene classification masks where each pixel is classified into one of twelve different classes. So if S2 L2A is your source for producing the mosaic, you can simply use that. You validate pixels by their scene classification value. For example:
Is it cloud? Invalid. Cloud shadow? Invalid. Vegetation? OK sure.
We used this for the New Zealand mosaic (image below). The mosaics were visually enhanced afterwards as well, but this is optional of course.
Sentinel-2 New Zealand Mosaic
Since New Zealand is very often covered with clouds the four months of data is not enough to produce cloudless mosaic. In the end, we used about one year of data.
To explore the resulting mosaic in full resolution (10m/px), go to the Land Information New Zealand web page and dive in.
Sentinel-3 Europe Mosaic
The cloudless mosaic over Europe in the Lambert Azimuthal Equal Area projection presented at the beginning of this post is an example of a mosaic made with another datasource. For this one we have used four months of Sentinel-3 data. The size of the final mosaic in full resolution is 4 GB, and it was created for ESA. If you would like to see it, let us know.
But we are not the only ones playing with the idea of cloudless mosaics. As one of the first large-scale tests of the EO Browser temporal capabilities the following mosaic was generated. Pierre Markuse did a splendid job with the processing script and post-processing. It is a four gigapixel mosaic made from seven months of Sentinel-2 L1C data.
More insights into the temporal processing, post-processing and other interesting information on how Pierre resulted in this astonishing image is available on Pierre’s page. For a bigger versions of his mosaic take a look at the download options on his page as well.
After the creation of the Sentinel-3 Europe Mosaic, the next step is clear. Stay tuned for more information on the Cloudless Global Mosaic!
We have to thank to Brockmann Consult and GeoVille as we have learned a lot about mosaics from them.
We hope to see a growing number of applications making use of multi-temporal capabilities in the future. Check out EO Browser, and feel free to open an account and test the capabilities of the Sentinel Hub services.