3 rewards including a first prize for my participation in Sentinel-Hub contest !

16 May 2019 Mapping Remote sensing 0

Sentinel-hub Playground is a wonderful tool to explore Sentinel images. I really appreciate its capability to deal with the temporal information, but custom scripts using temporal information are rare. Getting an image every 5 days allow to do wonderful things, such as having computed cloud free images in places where there is too much clouds for people like me who love optical remote sensing.

My participation at the Sentinel-Hub custom scripts contest have so only been with multi-temporal script. With my three different scripts, most of the clouds have been dismissed by taking only pixels where the blue is below 0.18. When the pixel was never below 0.18 (which is the case for snow or most of urban land-cover for example) some workarounds have been coded.

I am so happy because it was a pleasure to code these scripts (although I really prefer python above javascript) and besides I won the first prize for the snow category and 2 second prizes !

Monthly snow report : First prize in Snow and Glaciers

Persistent snow cover in Corsica, february 2019. (Click on the image to see in Sentinel-Hub Playground)

The idea is to map the persistent snow cover within the last 31 days of the selected date. The script uses the NDSI (Normalized Difference Snow Index) with a threshold at 0.2, a bit different from what Simon Gascoin used for the Theia snow product.

Pixels which are systematically detected as snow are shown like the beautiful visualisation by Simon Gascoin, the other are saturated in green to ease the visual separation. If the pixel is never or occasionally snowy, the script will plot the median of the dates where no snow has been detected.

Chamonix, monthly snow report from 24th april. (Click on the image to see in Sentinel-Hub Playground)

Forest cut temporal detection : 2nd prize in Agriculture and Forestry

Deforestation is the main reason of global biodiversity loss, and stopping eating animal products is certainly the best thing you can do to avoid it :).

To map the loss of forests in the past year, I used the 90 previous days of the selected image, and I compared the NDVI with the same 3 months from the previous year.

In order to avoid the maximum as possible confusion with crops, the script will keep pixels only if the mean NDVI of each of the 3 months the previous year is above 0.7.

The more the difference is high, the more the pixels will be saturated in red :

    if ((NDWI(samples[0]) < 0.5) &amp; (difference >= thresold) &amp;(avgPreviousYearNDVI > minimunNDVI) &amp; (mean(lastYearMonth0) > minimunNDVI) &amp; (mean(lastYearMonth1) > minimunNDVI) &amp;(mean(lastYearMonth2) > minimunNDVI)) {
        // the more the difference is high, the more it is red
        colorMap = [stretch((2.8 * (2 / 3) * 10 * difference * samples[0].B04 + 0.1 * samples[0].B05), stretchMin, stretchMax), stretch((2.8 * samples[0].B03 + 0.15 * samples[0].B08), stretchMin, stretchMax), stretch((2.8 * samples[0].B02), stretchMin, stretchMax)];
    }
    // else show current image
    else {
        colorMap = [stretch((2.8 * samples[0].B04 + 0.1 * samples[0].B05), stretchMin, stretchMax), stretch((2.8 * samples[0].B03 + 0.15 * samples[0].B08), stretchMin, stretchMax), stretch((2.8 * samples[0].B02), stretchMin, stretchMax)];
    }
Deforestation in Madagascar between october 2017 and october 2018. (Click on the image to see in Sentinel-Hub Playground)

Monthly synthesis : 2nd prize in other scripts category

The idea of this script was to develop an simple and efficient way to have a cloud-free images with images from the previous 30 days.

As Sentinel-hub cloud mask is in development, I had to find a way to avoid clouds in the composition of the image. It was quite difficult to find a efficient solution (I’ve been testing several parameters using the blue band, and by using the median value in the blue). Sadly, these methods were affected by huge artefacts, especially in the urban landscapes and a some clouds and shadows were still present.

The best and simplest solution to code I found is to select the pixel where the ratio between two bands is the highest.

A little explanation of the script :

If the value in the blue bland (B02) is at one date less than 0.12 :

  • Date is selected where the ratio between near infrared (B08) and green (B03) is the highest.

Else if the value in blue is at one date less than 0.45 :

  • Date is selected where the ratio between green (B03) and blue (B02) is the highest.

The natural colors are from Pierre Markuse’ script. The overall result is satisfying, especially if you’re not looking pixel one by one, so do not zoom too much 🙂

Pyrénées, February 2019 with Sentinel-2 month synthesis. (Click on the image to see in Sentinel-Hub Playground)

These scripts are of course improvable, so feel free to contribute !

A special thanks to Pierre Markuse, Harel Dan and Simon Gascoin for their nice codes and awesome work. I really appreciate the way you work, especially by sharing your nice stuffs all the time !

I hope you enjoyed this post and above all found these scripts useful.