Satellite Imagery Analysis using Python | by Syam Kakarla | Towards Data Science

This article helps readers to better understand the satellite data and different methods to explore and analyze the Sundarbans satellite data using Python.
Sundarbans Satellite ImageryData AnalysisVegetation and Soil IndicesWater IndicesGeology IndicesConclusionReferences
Sundarbans Satellite Imagery
Data Analysis
Vegetation and Soil Indices
Water Indices
Geology Indices
Conclusion
References
Let’s get started ✨
The Sundarbans is one of the largest mangrove areas in the delta formed by the confluence of the Ganges, Brahmaputra, and Meghna rivers in the Bay of Bengal. The Sundarbans forest is about 10,000 sq km across India and Bangladesh, of which 40% lies in India, and is home to many rare and globally threatened wildlife species. The below Google Map shows the Sundarbans region.
In this article, we are going to use a small part of the Sundarbans satellite data which is acquired using the Sentinel-2 Satellite on 27 January 2020. The optimized natural-color image of the saidSundarbans data is shown below:
The Satellite data has 954 * 298 pixels, 12 bands with the spectral resolution varying from 10 — 60 meters. The data can be downloaded using the below link.
github.com
To perform different operations on the Sundarbans data, we are going to use libraries such as EarthPy, RasterIO, Matplotlib, Plotly for Data Visualization and Analysis.
Let’s start coding by importing the necessary packages,
let’s read the 12 bands using rasterio and stack them into an n-dimensional array using numpy.stack() method. The resultant data after stacking has the shape (12, 954, 298).
As we discussed, the data contains 12 bands. let’s visualize each band using the EarhPy package. the plot_bands() method takes the stack of the bands and plots along with custom titles which can be done by passing unique titles for each image as a list of titles using the title= parameter.
These Sundarbans data has multiple numbers of bands that contain the data ranging from visible to infrared. So it is hard to visualize the data for humans. By creating an RGB Composite Image makes it easier to understand the data effectively. To plot RGB composite images, you will plot the red, green, and blue bands, which are bands 4, 3, and 2, respectively. Since Python uses a zero-based index system, so you need to subtract a value of 1 from each index. Therefore, the index for the red band is 3, green is 2, and blue is 1.
The Composite images that we created can sometimes be dark if the pixel brightness values are skewed toward the value of zero. This type of problem can be solved by stretching the pixel brightness values in an image using the argument stretch=True to extend the values to the full 0-255 range of potential values to increase the visual contrast of the image. Also, the str_clip argument allows you to specify how much of the tails of the data that you want to clip off. The larger the number, the more the data will be stretched or brightened.
Let’s see the code to plot the RGB composite image along with the stretch applied.
The above image shows the RGB composite image of Sundarbans data before and after stretch applied.
Visualizing the bands of the hyperspectral image dataset helps us to understand the distribution of pixels/values of the bands. The hist method from the earhtpy.plot does the work by plotting the histograms for the bands of the dataset/stack that we created previously. We can also modify the column size, titles, colors of the individual histograms. Let’s see the code to plot the histograms.
Normalized Satellite indices are images that are computed from Multi-Spectral satellite images. These images emphasize a specific phenomenon that is present while mitigating other factors that degrade the effects in the image. For instance, a vegetation index will show healthy vegetation as bright in the index image, while unhealthy vegetation has lower values and barren terrain is dark. Since shading from terrain variation (hills and valleys) affect the intensity of images, the indices are created in ways that the color of an object is emphasized rather than the intensity or brightness of the object.
To determine the density of green on a patch of land, researchers must observe the distinct colors (wavelengths) of visible(VIS) and near-infrared (NIR)sunlight reflected by the plants. The Normalized Difference Vegetation Index (NDVI) quantifies vegetation by measuring the difference between near-infrared which vegetation strongly reflects and red light (which vegetation absorbs). NDVI always ranges from -1 to +1.
NDVI = ((NIR - Red)/(NIR + Red))
For example, when you have negative values, it’s likely water. On the other hand, if you have an NDVI value close to +1, there’s a high possibility that it’s dense green leaves. But when NDVI is close to zero, there aren’t green leaves and it could even be an urbanized area.
Let’s see the code to implement NDVI on the Sundarbans satellite data.
The Soil-Adjusted Vegetation Index (SAVI) is a vegetation index that attempts to minimize soil brightness influences using a soil-brightness correction factor. This is often used in arid regions where vegetative cover is low.
SAVI = ((NIR - Red) / (NIR + Red + L)) x (1 + L)
The L value varies depending on the amount of green vegetative cover. Generally, in areas with no green vegetation cover, L=1; in areas of moderate green vegetative cover, L=0.5; and in areas with very high vegetation cover, L=0 (which is equivalent to the NDVI method). This index outputs values between -1.0 and 1.0. Let’s see the code for the implementation of SAVI.
The Visible Atmospherically Resistant Index (VARI) is designed to emphasize vegetation in the visible portion of the spectrum while mitigating illumination differences and atmospheric effects. It is ideal for RGB or color images; it utilizes all three color bands.
VARI = (Green - Red)/ (Green + Red - Blue)
Surface water change is a very important indicator of environmental, climatic, and anthropogenic activities. Remote sensors, such as sentinel-2, Landsat, have been providing data for the last four decades, which are useful for extracting land cover types such as forest and water. Researchers have proposed many surface water extraction techniques, among which index-based methods are popular owing to their simplicity and cost-effectiveness.
The Modified Normalized Difference Water Index (MNDWI) uses green and SWIR bands for the enhancement of open water features. It also diminishes built-up area features that are often correlated with open water in other indices.
MNDWI = (Green - SWIR) / (Green + SWIR)
The below code serves the purpose of implementing MNDWI and the output is shown below.
The Normalized Difference Moisture Index (NDMI) is sensitive to the moisture levels in vegetation. It is used to monitor droughts as well as monitor fuel levels in fire-prone areas. It uses NIR and SWIR bands to create a ratio designed to mitigate illumination and atmospheric effects.
NDMI = (NIR - SWIR1)/(NIR + SWIR1)
Let’s see the implementation and the output:
Satellite imagery and aerial photography have proven to be important tools in support of mineral exploration projects. They can be used in a variety of ways. Firstly they provide geologists and field crews the location of tracks, roads, fences, and inhabited areas.
The clay ratio is a ratio of the SWIR1 and SWIR2 bands. This ratio leverages the fact that hydrous minerals such as clays, alunite absorb radiation in the 2.0–2.3 micron portion of the spectrum. This index mitigates illumination changes due to terrain since it is a ratio.
Clay Minerals Ratio = SWIR1 / SWIR2
The ferrous minerals ratio highlights iron-bearing materials. It uses the ratio between the SWIR band and the NIR band.
Ferrous Minerals Ratio = SWIR / NIR
This article introduces different methods such as data visualization and normalized vegetation, water, and geogloy indices to analyze Sundarbans satellite data using python.
The satellite data used in the article and detailed code can be accessed using the below GitHub link.