How to get your idea and turn it into a script?

Useful tips from one of the winners of the first two rounds of the Sentinel Hub Custom Script Contest

Mohor Gartner
Sep 8, 2020 · 7 min read

Foreword by Sentinel Hub

This post is part of a series of guest blog posts written by script authors, talking about their entries to our Contest. Mohor Gartner is one of the participants whose scripts won several awards in the first two rounds. His winning scripts with detailed descriptions are available on our GitHub repository:

In this blog post Mohor is focusing on the starting point for all of you, who would like to participate in the next round of the Contest.

How to start?

Do you want to participate in the Sentinel Hub Custom Script Contest and do not know what kind of script to do? Well, then this article might be helpful. Firstly, of course, read carefully all information provided on the third round of the Contest.

Choose an Appropriate Topic

Next, I would recommend you try to find a topic, which checks at least one bullet below. Or all, the more, the better.

  • Do a script on a topic which you are interested in and passionate about the most.
  • Think about if you observed any interesting phenomenon around you which you want to know more about and could be identified with remote sensing (in this case satellite imagery archive of Sentinel Hub). That could be something which you see every day in your local area or an occurence, which you noticed while travelling around the world.
  • A topic on which you have some knowledge of, or it is even related to your education. Or a topic on which you plan to get an education in. It is never too soon to start on that.
  • If you can find nothing else, try to do a topic you saw in the news. Or by checking some scientific articles on remote sensing algorithms.
Sentinel Hub OE Browser Visualization of already predefined Scene Classification Map on the basis of the algorithm.

Check Existing Scripts and Scientific Articles

So, did you find a topic on which you would work on? Great! Now formulate a general idea of what you want to find out or identify with the script. Then I would recommend you to do following.

  • Check what kind of custom scripts were already done. And even if your idea was already done, well maybe you can improve the existing script.
  • Identify appropriate data source in the Sentinel Hub which would best fit to present your idea.
  • Optionally, you can also try to find some scientific article with (a simple) algorithm for the implementation of your idea in the script.

Develop Your Script

View of the Sentinel Hub implementation of Monja`s Custom Barren Soil Script. Only a few lines of code and you can get nice visualization of the bare soil for selected satellite image of the Sentinel-2.
  • When you identify that it is possible to accomplish your idea on one location, try to use developed script on other areas, which if possible, are known to you.
  • If applicable, also try to improve the script. Satellite imagery varies depending on the season, location, weather conditions, etc. If you want the script to work well in diverse conditions, additional trying and testing should be done.
  • Finally, when you are satisfied with the script, follow the instructions of the competition on how to send the script and all related data to participate in the Contest.

How I Created My Custom Script

I love to surf. And anybody who surfs must observe the waves and how they break to be in a good position to catch the waves. Otherwise, if you catch the wave unsuccessfully you can for sure feel the power of the white-water when the wave breaks.

A good day to surf in Ericeira, Portugal. White-water area is quite obvious. If you check closely, you can also see quite some surfers in the water waiting to catch a wave (Photo credit: Mohor Gartner).

In addition to that, water also has some other impact on me. I studied Water Management and Municipal Engineering. And I finished my studies with a thesis related to coastal engineering. Because of my passion for surfing, regular observation of white-water and water environments knowledge, it is no surprise that my first idea for the Custom Script Contest was white-water detection. I checked if there is any existing research or scientific articles on white-water detection. I could not find anything. So, I was even more excited, and motivated to do something which it seems it was not done before.

One can ask, why would anybody want to know where are the white-water areas. Regarding surfing, white-water areas present potential location to surf. Of course, a lot of other conditions need to be met in order to have a (good) surf spot. So the results of white-water detection can give you some potential areas where you can check for waves to surf. In addition, white-water areas present a tool for surf zone habitat identification, coastal engineering works, maritime navigation, detection of new reef or island, etc.

Before starting writing any detailed script, I checked existing scripts and some documentation to get the feeling on how hard would it be to produce the script. It did not seem complicated. I have to add that I am not a really experienced programmer. But I already did quite some scripts in Python and Javascript for data analysis and to simplify every day’s work.

The most obvious choice for data source was Sentinel-2 as it has the best resolution from possible sources (10x10 meters) and 13 bands.

My first location to test my hypothesis and to start writing the algorithm was the Atlantic Ocean coastline around Porto in Portugal. The area is very well known to me as I lived there for almost a year. For the first stage of writing the algorithm, I selected an image where white-water was present with some clouds and shadow. I wanted to have an algorithm that would detect white-water in shadow and would not falsely detect clouds as white-water.

Comparison between true color image (left) and image with the white-water detection algorithm (right) for the image on 11.1.2016, Porto, Portugal.

When most of the algorithm was developed, I also started to test it on other locations. So for the second location I selected a surf spot with the highest waves surfed so far, Nazaré in Portugal.

View from the Farol de Nazare on a day with higher waves 24.10.2016 (left, photo credit: Mohor Gartner) and multi-temporal analysis for detection of white-water areas from 1.1.2015 till 13.4.2019 (right) with indication of Farol de Nazare`s location (red).

Of course I also had to test the script on the most famous place to surf, Hawaii.

Result of a Custom White-Water Detection Script for the coast of the Oʻahu island (Hawaii) on 14.01.2018.

I continued with the script testing on other locations around the world, also in areas with lower waves and it worked pretty well. Snowy coastline might be a problem as areas with snow are falsely identified as white-water. I also got the idea to identify white-water on rivers, but for that resolution of the images (10x10m) is too low. White-water would not be detected. Nevertheless, I was able to identify some white-water on one of the biggest waterfalls on Earth, Victora Falls in Zambia.

Multi-temporal analysis with white-water algorithm on Victora falls from 1.7.2015 to 16.4.2019. The big signal is the waterfall, smaller signals are other white-water areas.

In the end I selected the best 5 examples, wrote down all the needed materials and took part in the Sentinel Custom Script Contest.

Of course all of the above is not something you must stick to. It is only to provide you with general guidelines on how to start with the Custom Script Contest if you are stuck. I participated in the first two Contests and I can say that this has been a general framework for me to implement my ideas into scripts for the Contest. If you have some additional tips on how to do the best script possible, just comment below.

Visualization of my three scripts from the first Sentinel Hub Custom Script Contest: White-water detection,
Seldom, regular water surface detection, and Land surface temperature (LST) mapping.

To learn more about satellite imagery and custom scripting we recommend you to check the Sentinel Hub Educational page. You can also visit a dedicated topic at the Sentinel Hub Forum for further information.

Sentinel Hub Blog

Stories from the next generation satellite imagery platform