https://github.com/nens/threedidepth
Calculate waterdepths for 3Di results.
https://github.com/nens/threedidepth
library threedi
Last synced: 5 months ago
JSON representation
Calculate waterdepths for 3Di results.
- Host: GitHub
- URL: https://github.com/nens/threedidepth
- Owner: nens
- License: other
- Created: 2020-07-14T15:06:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-10-03T12:35:58.000Z (9 months ago)
- Last Synced: 2025-11-28T05:34:15.202Z (7 months ago)
- Topics: library, threedi
- Language: Python
- Homepage:
- Size: 210 KB
- Stars: 0
- Watchers: 12
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: LICENSE
Awesome Lists containing this project
README
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 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