Skip to main content

Map floods with Sentinel-1 radar images. We replicate in this package the work

Project description

Dask based Flood Mapping

CI DOI pypi GitHub Super-Linter GitHub Super-Linter SQAaaS source code

Map floods with Sentinel-1 radar images. We replicate in this package the work of Bauer-Marschallinger et al. (2022)1 on the TU Wien Bayesian-based flood mapping algorithm. This implementation is entirely based on dask and data access via STAC with odc-stac. The algorithm requires three pre-processed input datasets stored and accessible via STAC at the Earth Observation Data Centre For Water Resources Monitoring (EODC). It is foreseen that future implementations can also use data from other STAC catalogues. This notebook explains how microwave backscattering can be used to map the extent of a flood. The workflow detailed in this notebook forms the backbone of this package. For a short overview of the Bayesian decision method for flood mapping see this ProjectPythia book.

Installation

To install the package, do the following:

pip install dask-flood-mapper

Usage

Storm Babet hit the Denmark and Northern coast of Germany at the 20th of October 2023 Wikipedia. Here an area around Zingst at the Baltic coast of Northern Germany is selected as the study area.

Local Processing

Define the time range and geographic region in which the event occurred.

time_range = "2022-10-11/2022-10-25"
bbox = [12.3, 54.3, 13.1, 54.6]

Use the flood module and calculate the flood extent with the Bayesian decision method applied tp Sentinel-1 radar images. The object returned is a xarray with lazy loaded Dask arrays. To get the data in memory use the compute method on the returned object.

from dask_flood_mapper import flood


flood.decision(bbox=bbox, datetime=time_range).compute()

Distributed Processing

It is also possible to remotely process the data at the EODC Dask Gateway with the added benefit that we can then process close to the data source without requiring rate-limiting file transfers over the internet.

For ease of usage of the Dask Gateway install the eodc package besides the dask-gateway package. Also, see the EODC documentation.

pip install dask-gateway eodc
# or use pipenv
# git clone https://github.com/TUW-GEO/dask-flood-mapper.git
# cd dask-flood-mapper
# pipenv sync -d

However differences in versions client- and server-side can cause problems. Hence, the most convenient way to successively use the EODC Dask Gateway is Docker. To do this clone the GitHub repository and use the docker-compose.yml.

git clone https://github.com/TUW-GEO/dask-flood-mapper.git
cd dask-flood-mapper
docker compose up

Copy and paste the generated URL to launch Jupyter Lab in your browser. Here one can run the below code snippets or execute the notebook about remote processing.

from eodc.dask import EODCDaskGateway
from eodc import settings
from rich.prompt import Prompt


settings.DASK_URL = "http://dask.services.eodc.eu"
settings.DASK_URL_TCP = "tcp://dask.services.eodc.eu:10000/"

Connect to the gateway (this requires an EODC account).

your_username = Prompt.ask(prompt="Enter your Username")
gateway = EODCDaskGateway(username=your_username)

Create a cluster.

Important: Per default no worker is spawned, therefore please use the widget to add/scale Dask workers in order to enable computations on the cluster.
cluster_options = gateway.cluster_options()
cluster_options.image = "ghcr.io/eodcgmbh/cluster_image:2025.4.1"
cluster = gateway.new_cluster(cluster_options)
client = cluster.get_client()
cluster

Map the flood the same way as we have done when processing locally.

flood.decision(bbox=bbox, datetime=time_range).compute()

User Interface

It is also possible to run the workflow in an user-friendly interface instead of the Jupyter notebooks, as shown below:

screenshot

Firstly, install the extra packages with:

pip install 'dask-flood-mapper[app]

Then, to access it, simplify run the in terminal the command:

floodmap

It will open the GUI in the web browser.

Authors

Martin Schobben, Thais Beham

Contributors

Contributing Guidelines

Please find the contributing guidelines in the specific file CONTRIBUTING.md.

Automated Delivery

This repository holds container images to be used for running Dask based flood mapping on the EODC Dask Gateway. Use the url "ghcr.io/intertwin-eu/dask-flood-mapper:latest" to specify the image.

Credits

Credits go to EODC (https://eodc.eu) for developing the infrastructure and the management of the data required for this workflow. This work has been supported as part of the interTwin project (https://www.intertwin.eu). The interTwin project is funded by the European Union Horizon Europe Programme - Grant Agreement number 101058386.

Views and opinions expressed are however those of the authors only and do not necessarily reflect those of the European Union Horizon Europe/Horizon 2020 Programmes. Neither the European Union nor the granting authorities can be held responsible for them.

Literature

  1. Bauer-Marschallinger, Bernhard, Senmao Cao, Mark Edwin Tupas, Florian Roth, Claudio Navacchi, Thomas Melzer, Vahid Freeman, and Wolfgang Wagner.Satellite-Based Flood Mapping through Bayesian Inference from a Sentinel-1 SAR Datacube. Remote Sensing 14, no. 15 (January 2022): 3673. https://doi.org/10.3390/rs14153673.

License

This repository is covered under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dask_flood_mapper-0.1.0.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dask_flood_mapper-0.1.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file dask_flood_mapper-0.1.0.tar.gz.

File metadata

  • Download URL: dask_flood_mapper-0.1.0.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for dask_flood_mapper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b3c943272eb05e318e39ec18cd31dc37cc72ee21c28adce5e7bd7445351f8979
MD5 f821f21728651faf7f33d668fe405aea
BLAKE2b-256 cbcfb65738ec98ef1446f7e5ccf40631815972b4cbc4d5900365dc50795e587e

See more details on using hashes here.

File details

Details for the file dask_flood_mapper-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dask_flood_mapper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28a7c472dae9aad09be0c4db952b4f6664bab0b1f1b1820dad453df693a3aa9e
MD5 3d8b9f7cee4ea1c8239ecd973ca332ef
BLAKE2b-256 1a3b96c2b3af975468ca051395b8a6b729a3a85f788dc94ddf769d69619c9742

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page