Accessing and Plotting Satellite Imagery (part 1)

Bertrandlobo
4 min readMay 2, 2022

--

A step by step guide to accessing and downloading Sentinel-2 Satellite Data and plotting it in Python.

Introduction

Sentinal-2 satellites provide coverage of the earth once in 5 days with 12 bands at a resolution of 10 metres. Among the vast variety of options to access and download Sentinel -2 data, one of them is via Sentinel Hub EO Browser. Sentinel Hub is a part of the European Space Agency's funding program. Let us dive into the process straight away.

Step 1: Creating an Account

To use all the features of Sentinel Hub EO Browser. signing up is useful and after logging in, the map of Rome should appear, indicating everything went as planned.

User Interface of Sentinel Hub EO Browser, Source: Sentinel Hub EO Browser.

Step 2: Search criteria and Option Selection

For this project, data from the Amazon Rainforest is used as a test dataset. To search, firstly write on the top right corner search bar whichever search criteria. Then the map redirects to the area. There are various options to choose from. For example, Data Sources (In this case Sentinel-2 with the advanced search on, L1C, L2A selected with minimum cloud coverage), Date and time of when the user needs exact data.

Search Criteria and Option selection in Source: Sentinel Hub EO Browser.

Once the search criteria are selected, one can narrow it down to a particular Area of Interest (AOI) as satellite data can often be large. Polygons and squares can be selected for the AOI along with the satellite coverage models as seen on the right. Then the satellite coverage with various cloud coverage options is seen in the Menu on the left.

AOI, Source: Sentinel Hub EO Browser.

When the data with minimum cloud cover is chosen, click ‘Visualize’ in green at the bottom. Various Visualization options like True Colour, NDVI, and False colour can be chosen depending on the user's needs. Some advanced options are also available and one can choose to play around.

Step 3: Downloading the Dataset

The right-hand side of the interface features an image download option. Once clicked, move to ‘Analytical’ and choose image format, resolution, and Layers. For the dataset, I use all bands with an NDVI to correlate plots in Python later in Part 2 of this story.

Downloading Data, Source: Sentinel Hub EO Browser.

Plotting Sentinel-2 Data in Python.

Moving straight to the coding part, this tutorial is a basic guide to installing Python packages, reading data and plotting different bands to build a foundation for further analysis like machine learning and neural networks. The code along with data and some output cases can be found in a repository on my GitHub.

Step 1: Installing Python Packages.

The two packages used are earthpy and GDAL. For installing GDAL in macOS, follow this guide or this documentation. After installing type this line of code either in the terminal or in the notebook.

Source: Author

Step 2: Importing libraries

The python libraries used in this project are rasterio, matplotlib, numpy, glob and earthpy, they can be imported with the following lines of code.

Source: Author

Step 3: Reading the Data

The downloaded data can be saved in a directory locally or in the cloud and the path to the directory should be defined to read the data in Python. The following code reads the 12 bands of imagery I downloaded for the Amazon Rainforest. Out [195] is a sign the data has been successfully read.

Step 4: Plotting Bands of Satellite images

Depending on the user's needs, single bands can be plotted in Python with the following code. Also, seen are Band 1 and 5 of the dataset.

Source: Author

Conclusion

This story is a comprehensive guide to accessing and downloading Sentinel-2 data from Sentinel Hub EO Browser. Followed by the basic use of Python libraries to read and plot the same data as Part 1 of the Project. Part 2 features using supervised and unsupervised machine learning techniques for land cover mapping and will be published soon.

--

--

Bertrandlobo

Python Enthusiast for Data Visualization, Remote Sensing, Machine Learning, Data Science.