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/interTwin-eu/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/interTwin-eu/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.

[!CAUTION] 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, 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, Clay Harrison

Contributors

https://github.com/interTwin-eu/dask-flood-mapper/graphs/contributors

Contributing Guidelines

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

Automated Delivery

This repository holds a container image 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.

docker pull ghcr.io/intertwin-eu/dask-flood-mapper:latest

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.

License

This repository is covered under the MIT License.

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.

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.5.tar.gz (201.2 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.5-py3-none-any.whl (219.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dask_flood_mapper-0.1.5.tar.gz
  • Upload date:
  • Size: 201.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dask_flood_mapper-0.1.5.tar.gz
Algorithm Hash digest
SHA256 854385e9c678bbd5ac47e558496be68fbc2378c64a172859cd8675a6764b5216
MD5 946688bd3c45d186be9e3cac6dbf89c0
BLAKE2b-256 b1fa740c754788482c40b132df69cfa9166a7a9779e89cbade1764a593c79a52

See more details on using hashes here.

Provenance

The following attestation bundles were made for dask_flood_mapper-0.1.5.tar.gz:

Publisher: pypi.yml on interTwin-eu/dask-flood-mapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for dask_flood_mapper-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3c4cc95cc08279120a87d36feeae92e2fc142bde4b55157c13a3b60fc1a11545
MD5 9d5c3898a95f47517d39934270c72ff5
BLAKE2b-256 02fa46d4fa45731b2d34782f94bddc3987792cea8e1633ae5e107f6426c58ff7

See more details on using hashes here.

Provenance

The following attestation bundles were made for dask_flood_mapper-0.1.5-py3-none-any.whl:

Publisher: pypi.yml on interTwin-eu/dask-flood-mapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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