Back to main

In my work as a remote-sensing engineer monitoring the coastal environment, I often come across beautiful scenes. I had the idea of sharing this by creating a twitter bot that would randomly post snapshots of satellite acquisitions anywhere in the world (I moved it to Mastodon since). I took inspiration from already existing twitter bots. But for this idea, I wanted to restrict the image selection to recent acquisitions covering some coastline with minimum cloud cover.

For this bot I decided to use Sentinel-2 data and the sentinelsat API, which allows to easily query imagery acquired after a given date, and with cloud cover ratio below a given threshold value. The extra work lied in constraining the bot to query only images of the coastline. For this, I used a vector file of the world's coastline provided by Natural Earth. Sentinel-2 images being distributed following a fixed grid, for which a vector file is also available, I used both vector files to list all tiles intersecting some part of the world's coastline. The bot relies on this list to build the sentinelsat query. More precisely, a random subsection of this list is used, in order to comply with sentinelsat's query length limit.

Like the already existing Sentinel2Bot and LandsatBot, s2coastalbot uses the Open Street Map reverse search engine to name the location of the image.

Sentinel-2 tiles cover an area of 100 x 100 km2, but I often like to focus on smaller areas. Therefore, I added an additional step to crop the image to a subset of approximately 10 x 10 km2. The Natural Earth vector file is used again in this step to ensure that the subset intersects the coastline. Nevertheless, the bot can sometimes post images where no coastline is visible. This is most likely due to the accuracy of the Natural Earth coastline file, which includes errors of several kilometers in some locations.

For now, the bot simply uses the True Color Image provided in Sentinel-2 level 2 data. That is, images that were already processed by the Sentinel-2 standard atmospheric correction algorithm. I might improve this in the future by using an atmospheric correction algorithm specific to the coastal environment. This would notably help correcting reflection of the sunlight over the water surface, that usually occurs by rough sea state.

Source code: