Skip to main content

threedidepth

Waterdepth

Calculate waterdepths for 3Di results. For results of type ‘raw’ the variable ‘s1’ is used as waterlevel. For results of type ‘aggregate’, the variable ‘s1_max’ is used as waterlevel.

Concentrations

Calculate concentrations for 3Di water quality results.

Features

  • Interpolated or gridcell-constant waterlevels or concentrations

  • Interfaces with threediresults via threedigrid

  • Progress indicator support

  • Low memory consumption

For the interpolated mode, the ‘lizard’-method is used. For a detailed description, read the docstring for the LizardLevelCalculator.

For the maximum waterlevel calculation, the maximum waterlevel for each point is taken before the interpolation is applied. This can lead to situations where the highest waterlevel for a pixel for a certain timestep is higher than the maximum waterlevel for the pixel.

Installation

Make sure GDAL is available as (from osgeo import gdal)

$ pip install threedidepth

Usage

From the cli:

$ threedidepth gridadmin.h5 results_3di.nc dem.tif waterdepth.tif
$ threediwq gridadmin.h5 water_quality_results_3di.nc substance1 <xmin ymin xmax ymax> concentration.tif

Or python:

>>> threedidepth.calculate_waterdepth(...)
>>> threedidepth.calculate_water_quality(...)

Development installation with Docker Compose

For development, clone the repository and use a docker compose setup:

$ docker compose build --build-arg uid=`id -u` --build-arg gid=`id -g` lib
$ docker compose up --no-start
$ docker compose start
$ docker compose exec lib bash

Create a virtualenv:

# note that Dockerfile prepends .venv/bin to $PATH
(docker)$ python3 -m venv .venv --system-site-packages

Install dependencies & package and run tests:

(docker)$ pip install -r requirements.txt
(docker)$ pip install -e .[test]
(docker)$ pytest

Update packages:

(docker)$ rm -rf .venv
(docker)$ python3 -m venv .venv --system-site-packages
(docker)$ pip install -e .
(docker)$ pip freeze | grep -v threedidepth > requirements.txt

Changelog of threedidepth

0.7.4 (2025-10-03)

  • Remove faulty assertion. Add a note.

0.7.3 (2025-10-03)

  • Handle broken WaterQuality results gracefully.

0.7.2 (2025-10-03)

  • Add timestamps to band descriptions.

0.7.1 (2025-09-24)

  • Keep old mode constants available for backwards compatibility.

0.7.0 (2025-09-23)

  • Add support for water quality results.

0.6.3 (2024-03-22)

  • Fix no_data_value is undefined.

0.6.2 (2024-03-14)

  • Assign a default value if no_data_value is undefined.

0.6.1 (2023-07-11)

  • Add release action for automatic upload to GitHub and PyPI.

0.6.0 (2023-07-10)

  • Update dependency versions

  • Add support for calculating maximum waterlevel as well as per timestep.

0.5 (2021-07-02)

  • Added support for result type ‘aggregate’.

  • Got rid of NetCDF4 dependency by using h5netcdf.

  • Fix coordinates of NetCDF output. (#17)

0.4 (2021-03-23)

  • Enabled multiple calculation steps.

  • Added netCDF output option.

0.3 (2021-02-10)

  • Reorder to match the lizard triangulation.

0.2 (2020-12-10)

  • Implemented lizard method and set it as default.

0.1.2 (2020-09-21)

  • Fix off-by-one-pixel nodgrid.

0.1.1 (2020-09-11)

  • Fix flipped nodgrid.

0.1 (2020-09-03)

  • First version.

Release files for threedidepth 0.7.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for threedidepth 0.7.4
File Size Uploaded
threedidepth-0.7.4.tar.gz 24.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for threedidepth 0.7.4
File Interpreter ABI Platform
threedidepth-0.7.4-py3-none-any.whl Python 3 none any Details

Total release size: 41.5 kB

Release files / threedidepth-0.7.4.tar.gz

Download URL threedidepth-0.7.4.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ddb577dde9b702ab8e4feecd859f78a3e77d4250b894fe1fe5f589e1f363998c
BLAKE2b-256 checksum
How to use checksums
6f58974bcaee4d00c0d5d79d04c4cb018fcff6aa99ccfef30f25f913aa4c97a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / threedidepth-0.7.4-py3-none-any.whl

Download URL threedidepth-0.7.4-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b83e96e89aa38a9ae433d2fdcb524669a412b065f25672cea5d2173cde49eacb
BLAKE2b-256 checksum
How to use checksums
9228147fcc5d709be6615916f3545b05354c48233671de2b59165b4bf2263f01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.7.4 This release

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page