Generate a 3Di simulation grid from a model schematisation.
Project description
Generate a 3Di simulation grid from a model schematisation.
Usage
This library converts a model schematisation to a 3Di simulation grid. This can be done using a single function that reads data from an SQLite and TIFF and then outputs the generated grid into a Geopackage or HDF5 file:
>>> from threedigrid_builder import make_gridadmin
>>> sqlite_path = "/path/to/model.sqlite"
>>> dem_path = "/path/to/dem.tiff"
>>> out_path = "grid.gpkg" # or "something.h5" for HDF5 output
>>> make_gridadmin(sqlite_path, dem_path, out_path)
Alternatively, the generated grid can be output in-memory:
>>> make_gridadmin(sqlite_path, dem_path)
{'nodes': {'id': array([ 1, 2, 3, ..., 7903, 7904, 7905], dtype=int32), ...}
Installation
This package is distributed as source and binary wheels on PyPI. The currently supported platforms are Windows, Linux, and OSX, all 64 bit versions only.
First install sqlite and spatialite libraries, e.g. on Ubuntu:
$ sudo apt-get install sqlite3 libsqlite3-mod-spatialite
For raster input, GDAL is required to be present. We omitted these from the dependencies because installation of GDAL depends on your platform an on your personal perference. One option is to install gdal using apt-get, and then pygdal with a matching version:
$ sudo apt-get libgdal-dev $ pip install pygdal=={your gdal version}.*
The current platform version of GDAL can be retrieved by:
$ gdalinfo –version
Install the threedigrid-builder:
$ pip install threedigrid-builder
For output into a file for the 3Di calculationcore, enable gridadmin output:
$ pip install threedigrid-builder[gridadmin]
For output into Geopackage for display in e.g. QGis, enable gpkg output:
$ pip install threedigrid-builder[gpkg]
The command line interface requires Typer:
$ pip install threedigrid-builder[cli]
Development
Clone the repo and fetch the LFS objects:
$ git lfs fetch origin refs/remotes/origin/master
Install the build tools:
$ sudo apt install cmake gfortran
Install platform dependencies:
$ sudo apt-get update && sudo apt-get install --yes --no-install-recommends libgdal-dev sqlite3 libsqlite3-mod-spatialite
Create and activate a virtual environment:
$ python -m venv ./venv $ source ./venv/bin/activate
Install the dependencies. For your distribution, check the dependency matrix in .github/workflows/test.yml. For example, for Python 3.10 with numpy 1:
$ pip install --upgrade pip wheel scikit-build $ pip install setuptools==63.* $ pip install numpy==1.23.* $ pip install -e .[test,gridadmin] --no-build-isolation h5py==3.7.* sqlalchemy==1.4.40 shapely==2.0.* pyproj==3.4.* "pygdal==$(gdal-config --version).*"
In case the Fortan code needs to be recompiled:
$ python setup.py develop
Now you should be able to run the tests:
$ pytest $ pytest integration_tests
For VSCode, optionally select the python interpreter corresponding to the virtual environment.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file threedigrid_builder-1.20.1.tar.gz
.
File metadata
- Download URL: threedigrid_builder-1.20.1.tar.gz
- Upload date:
- Size: 155.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65089edaeecce22ce42a05472e76a57f70d44aa8f83e17c3ba996d7e9ae34690 |
|
MD5 | 8d11ed2258a11a8d3538a20b6d30790a |
|
BLAKE2b-256 | 70aa8b625deb54b92847b3de37463556b82e358b6136f959522e66d1ee18a4c2 |
File details
Details for the file threedigrid_builder-1.20.1-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 625.6 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ea4f9bf5749b3ea888e7933ce7da2c7ca3bd3f6142f06d7ce9c6f14745637a2 |
|
MD5 | 9deb3f1cf9afe6b61a037fa3e30dbf29 |
|
BLAKE2b-256 | 4bdb3c64c9f5617ad93878f2df740dabbb78c70ef4331ec50a6d7b05deff90d5 |
File details
Details for the file threedigrid_builder-1.20.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e5a75fccb36e5af8ab614573855ddf30b28673330e89a601ad6b328e5b49111 |
|
MD5 | 23bca041e01ac838ee5632f70530a4bf |
|
BLAKE2b-256 | 7652b90bc5acff0a5cc3f1fd5641a56d8f225b1190d6eb1ab43503d4e5231a03 |
File details
Details for the file threedigrid_builder-1.20.1-cp312-cp312-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp312-cp312-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.12, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 455acf034a6196c10ebbdff3237a58b25a11d30195ea71864f8fcb2fd571c988 |
|
MD5 | 3268e884ebc2bfc8ed4c5ee0c61e364e |
|
BLAKE2b-256 | 09276ac3612de2ac5c1eae81d9c9a19b2c7f9553e0a7c8b496c4064b678d9d25 |
File details
Details for the file threedigrid_builder-1.20.1-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 625.6 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00277d780b4968393860d5d975f11c163a470660f12a28c9e62a4f2b34d9f21f |
|
MD5 | d3d5640b2f8f3e999d38f307ae8270f4 |
|
BLAKE2b-256 | f10256d046df991c28c9c37d5e4d67005523c4e66342c6c63140a0307000aa36 |
File details
Details for the file threedigrid_builder-1.20.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 428f2e1f47d6e51fc09a09b50965f70b62554691f2636074b536cb0d5ff2fc74 |
|
MD5 | 4329b3685ec1d1edf622ea065c96ccb1 |
|
BLAKE2b-256 | 2046fa957c4e6db4da186d882e45c62ccb13ab8a48b6fcbe2f18028afb5fda11 |
File details
Details for the file threedigrid_builder-1.20.1-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06f9e3b9d2608e3c842e41d5660c1def6dac3304178ec43ef4239cce94228623 |
|
MD5 | 0afe5d6eeb26e85add01e237aac64b0b |
|
BLAKE2b-256 | c3907f663ec1f6d1b7323ae47ca2de1f69af9ae3d4ceef39bf12961261fd0525 |
File details
Details for the file threedigrid_builder-1.20.1-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 627.0 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3812a079d54760517814276f22c1537330350d967b71919ad7d9607c73f4559 |
|
MD5 | 9025dabc0bbcc5faea690e9821d11e62 |
|
BLAKE2b-256 | cd782884833bced85cc80aad069a4a27d816b4b49b7313945c6c379916fdcdf0 |
File details
Details for the file threedigrid_builder-1.20.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62bc9d7a002b1fce9428ffed000e80543b8a2e436bd1da962bc3f4c076866994 |
|
MD5 | f880f38634fc8235f324c8d2de183956 |
|
BLAKE2b-256 | c238fdc018cd006f1993e9a7dceb6402337a2c573734e526bcc201607b5d4b36 |
File details
Details for the file threedigrid_builder-1.20.1-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ac7d1397a185aa9ed6c606a5d954edfd98f6864c095c3274af5698fc402dc81 |
|
MD5 | 770db58c84dd88f3686a8d93afae0a4d |
|
BLAKE2b-256 | bc4312f2df3a68064f76076031271889d5fa1fcef81cb6f4bdbfd581e378d02c |
File details
Details for the file threedigrid_builder-1.20.1-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 627.4 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90bda460fccf43037eef5b7ab3ee09681bbf867252b80ce4b8761b7cd97b35eb |
|
MD5 | 04601ab3f384f591df6a45631179e9b1 |
|
BLAKE2b-256 | ad07c82f9d3a54634e49e401af91ae0dfe0c2ae1a40b01305d672bb6ea81224b |
File details
Details for the file threedigrid_builder-1.20.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff63cd94c124d1e547c279097d654447691da34b06b0020d43ebd732da47f938 |
|
MD5 | 4cca95abbafac0ac159eeb5ac6d56a2c |
|
BLAKE2b-256 | 69bc7cab7a1285e5a7c82938a2472527969cbe852f94d9ac1a262fd7b711f86b |
File details
Details for the file threedigrid_builder-1.20.1-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7e9e59662ba47ef455c7d2f8ce5569739633b4f624c65e3a42a26c935cc4ca0 |
|
MD5 | 180e187523fcdb18e05de6fb2e54fe81 |
|
BLAKE2b-256 | 3ecc969a3c28dbb2e9acc902cd4017c1a45a195e63a34d547c286d68ec57177b |
File details
Details for the file threedigrid_builder-1.20.1-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 624.2 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0993645bd1b7251481c7adc2dbf12f4ba761c4153513dac1b80729f905391542 |
|
MD5 | 8aecc85b442d1b5ed64809cd70bf11a9 |
|
BLAKE2b-256 | 602dc4f3d0e289316a77d3dafbe73a6134fc8c08f57153e651710851c74c2c17 |
File details
Details for the file threedigrid_builder-1.20.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f50c019193fd3b94101bd6c56e9ac10cca859b661ab65143397f34336ad2c8b |
|
MD5 | be7a199a9a7706aed7b61472e47c397b |
|
BLAKE2b-256 | fb5631d2605609e71cfc262f6c2cbebfd44a26cb9f70bda5d0481d4a092ce377 |
File details
Details for the file threedigrid_builder-1.20.1-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: threedigrid_builder-1.20.1-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89b685bec7f2682cc0c29e584e51c740f4048f4fd36eb24bd3e0304d7ba7f40a |
|
MD5 | 9563e97068857f1114e986f99c105297 |
|
BLAKE2b-256 | d274b3c75f5e162c6762d98fdd7847d794a6d40019e936a184fbacc075e95c7f |