Monitoring floods using Python and Sentinel-2 satellite imagery

In the last decade, the number of extreme natural phenomena has dramatically increased, causing damage to people all around the world. According to statistics, the number of natural catastrophes is correlated with global warming. The rise in air temperature not only leads to droughts and global fires but also triggers extreme storms and large-scale floods. The research indicates that with a 4-degree Celsius warming, the likelihood of flood recurrence in flood-prone areas increases several times.

Summer 2023 will be remembered as a period marked by a series of grand-scale natural disasters. One of the largest floods occurred this year in Slovenia, where the majority of the country was partly or completely flooded. As recently reported by CNN, estimated damages exceed 500 million euros. Another tragedy struck Libya in September, with a flood in Darnah that already claimed the lives of over 10,000 people, and completely devastated the eastern coast of Libya. The situation spiralled out of control due to poor maintenance of the dam near the city. The dams had not been maintained since 2002. Historically, prior to the construction of flood control dams in the 20th century, Derna experienced recurrent flooding. In this instance, heavy rains led to the dam's failure and the complete inundation of the city. This situation highlights the importance of regular inspection and maintenance of critical infrastructure in flood prevention.

Comparison of the flood situation in Darnah, Libya, using Sentinel-2 satellite images from September 2, 2023 (on the left before the flood) and September 12, 2023 (on the right during the flood). Contains modified Copernicus Sentinel-2 data (2023).

Satellite imagery analysis can be critical to better understanding large-scale flooding, providing valuable information for disaster management and helping to design prevention and response strategies.  Remote sensing offers a range of metrics to delineate the spatial extent of flooded areas and assess the level of damage. Among the simple and popular methods used in this context are those based on indices such as:

·       MNDWI (Modified Normalized Difference Water Index) that helps identify the presence of water bodies. During floods, MNDWI can be employed to delineate the extent of inundation by highlighting water-covered areas in satellite or aerial imagery, aiding in flood monitoring and assessment.

·       NDWI (Normalized Difference Water Index) that assesses the water content of vegetation and soil and can be valuable during floods to distinguish between flooded and non-flooded areas. By detecting changes in water content, NDWI can help map flood-affected areas and assess the impact on vegetation and soil health.

·       SWDI (Soil Water Deficit Index) that primarily focuses on soil moisture levels but can still be relevant during floods. Monitoring soil water deficits can help predict the potential for flash flooding, as saturated soils are more prone to rapid runoff. Additionally, SWDI can aid in post-flood assessments by gauging the impact of excessive moisture on soil conditions.

Satellite data for flood analysis can be found and processed on the CREODIAS platform, which offers a variety of satellite products covering the entire globe, including publicly available images of Copernicus programme (Sentinels) and commercial very high-resolution images. Users on CREODIAS can search for products and filter them by time range, location, product type and many other attributes. See below an example demonstrating how to analyze the flooded region using Sentinel-2 imagery with the above-mentioned indices.

Comparison of the flood situation in the Central Greece region using Sentinel-2 satellite images from August 31, 2023 (on the left before the flood) and September 10, 2023 (on the right during the flood). Contains modified Copernicus Sentinel-2 data (2023).

In this case, we use Python with the programming library Rasterio for the analysis of the flooded region. We calculate the MNDWI index for Central Greece. This part of Greece was flooded at the beginning of September 2023. The MNDWI index effectively illustrates the water surface on satellite data, which is why it is frequently used in flood analysis. The MNDWI values typically range from -1 to 1, where higher values indicate a greater likelihood of water presence, and lower values indicate lower likelihood. MNDWI is widely used in applications such as monitoring changes in water bodies over time, assessing flood extent, studying wetland ecosystems, and mapping water resources. All calculations in the analysis are based on Sentinel products downloaded from the CREODIAS Data Explorer.

The first step after downloading the products is selecting the appropriate images. For MNDWI analysis, we need satellite images operating in the visible range of the spectrum, typically with wavelengths between 490 to 610 nanometers (GREEN, BAND 3), as well as in the Short-Wave Infrared (SWIR, BAND 11). Additionally, we use the Scene Classification Layer (SCL) to mask cloud coverage, which can influence the final result of the analysis. Afterward, we open all images in a Python notebook.

This step is described and implemented in this technical documentation.

Pixel values in raster images need to be normalized to the value between 0 and 255 range. Subsequently, we can calculate the MNDWI index value using the formula: MNDWI = (GREEN – SWIR) / (GREEN + SWIR)

This step is described and implemented in this technical documentation.

Comparison of the MNDWI index values for the Central Greece region on August 31, 2023 (on the left before the flood) and on September 10, 2023 (on the right during the flood). Contains Copernicus Sentinel-2 data (2023).

The images show flooded areas with positive pixel values of the MNDWI index. This type of analysis is crucial for damage estimation and future flood prevention. It provides an accurate representation of the scale of the flood that occurred in Greece. Additionally, the images allow us to observe the structures of agricultural fields and drainage ditches. Such observations can assist in preventing future floods and in better planning of water infrastructure. Furthermore, image data can be transformed into quantitative statistics and used in various industries, including agriculture, the construction industry, insurance, and environmental protection.

The next step involves identifying areas with increased water presence. It is done by subtracting the MNDWI index value before the flood from the MNDWI index value during the flood, all while simultaneously excluding areas covered by clouds. This process results in an image that highlights regions where water presence has risen. This step is described and implemented in this technical documentation.

Image based on the MNDWI index showing areas with increased water content in the Central Greece region. Differences can be seen between August 31, 2023 and September 10, 2023. Contains Copernicus Sentinel-2 data (2023).

Another valuable product we can obtain is an image that specifically displays areas submerged by water during the flood. To achieve this, we use the same calculation as in the previous step, with an additional layer of masking to exclude areas that had a positive MNDWI index before the flood. This creates an image that shows areas currently containing water which did not contain it before.

Image of flooded areas in the Central Greece region, based on the MNDWI index with masked water bodies, showing differences between August 31, 2023  and September 10, 2023. Contains Copernicus Sentinel-2 data (2023).

To sum up, floods and other extreme weather phenomena are becoming one of the biggest hazards for humans these days. It is important to prevent disasters like this by, for example, adopting critical architecture or by building a greater number of retention reservoirs.  Modern remote sensing tools play a pivotal role in achieving this goal. Large-scale repositories like CREODIAS provide access to a wide range of image data enabling qualitative and quantitative analyses. Thanks to modern remote sensing techniques, we can measure various phenomena on a global scale. Continuous Earth monitoring not only allows for the creation of precise models and graphics illustrating flood situations but also enables the development of various ancillary products, such as Early Warning Systems and Flood Risk Assessment.

Author: Tomasz Furtak, Junior Data Scientist at CloudFerro