Skip to main content

Calculate waterdepths for 3Di results.

Project description

threedidepth

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.

  • Interpolated or gridcell-constant waterlevels

  • 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

Or python:

>>> threedidepth.calculate_waterdepth(...)

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)$ virtualenv .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)$ virtualenv .venv --system-site-packages
(docker)$ pip install -e .
(docker)$ pip freeze | grep -v threedidepth > requirements.txt

Changelog of threedidepth

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.

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

threedidepth-0.6.1.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

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

threedidepth-0.6.1-py2.py3-none-any.whl (14.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file threedidepth-0.6.1.tar.gz.

File metadata

  • Download URL: threedidepth-0.6.1.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for threedidepth-0.6.1.tar.gz
Algorithm Hash digest
SHA256 2f4b3ad09f0487741167d63ee13ed12e68e3d6e6bac141937201e9e69b881b9c
MD5 67b1299e277be4f53e4889e69427e421
BLAKE2b-256 5c5ca94c463e6f307e196b274e27751dad1abae35192221a20225f5874764134

See more details on using hashes here.

File details

Details for the file threedidepth-0.6.1-py2.py3-none-any.whl.

File metadata

  • Download URL: threedidepth-0.6.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for threedidepth-0.6.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e313e6c47a88b7673e384465ae0d1b7c6f143174a2db661a0e1bf59796bed814
MD5 bfd5c236f0269f307ba08f0346675caf
BLAKE2b-256 7351bb44f0054d47f2d7b7cf6c97692c1cab78c8a606fd1d8c9038edb75e120b

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