Skip to main content

Generate a 3Di simulation grid from a model schematisation.

Project description

Github Actions status PyPI

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

threedigrid_builder-1.21.0.tar.gz (159.5 kB view details)

Uploaded Source

Built Distributions

threedigrid_builder-1.21.0-cp312-cp312-win_amd64.whl (629.6 kB view details)

Uploaded CPython 3.12 Windows x86-64

threedigrid_builder-1.21.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.21.0-cp312-cp312-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

threedigrid_builder-1.21.0-cp311-cp311-win_amd64.whl (629.6 kB view details)

Uploaded CPython 3.11 Windows x86-64

threedigrid_builder-1.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.21.0-cp311-cp311-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

threedigrid_builder-1.21.0-cp310-cp310-win_amd64.whl (631.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

threedigrid_builder-1.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.21.0-cp310-cp310-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

threedigrid_builder-1.21.0-cp39-cp39-win_amd64.whl (631.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

threedigrid_builder-1.21.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.21.0-cp39-cp39-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

threedigrid_builder-1.21.0-cp38-cp38-win_amd64.whl (628.2 kB view details)

Uploaded CPython 3.8 Windows x86-64

threedigrid_builder-1.21.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.21.0-cp38-cp38-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file threedigrid_builder-1.21.0.tar.gz.

File metadata

  • Download URL: threedigrid_builder-1.21.0.tar.gz
  • Upload date:
  • Size: 159.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for threedigrid_builder-1.21.0.tar.gz
Algorithm Hash digest
SHA256 36cd4438ac087212409cf9721d2682f0dd476f593e0e930b09bfd7d81d455f0d
MD5 6beab376eede2fa0e6a876e856a530a9
BLAKE2b-256 3126718ed1c36337f28fa41f4f5cceefc7217c633339080a5b08a838ed21e538

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4b9608ffa3e6d25685665fe4aa6734f302b8d96c7efff8b71d0daaf7a3acf106
MD5 e36549f405e68ca4e2ccf27113b8eafd
BLAKE2b-256 82e640395d10a237dcaef809daa7d0309c4d634bc619703441340f503f359519

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 acaead1e417df770615c555e11b20d5da0ca5bb8ee12f9d5ab1f38b7fc634438
MD5 eccfe376b8af16dbde8ecfa5b598c713
BLAKE2b-256 54b0fc086e87fe7ba93e678d51dec2acef3365ccf3598c81e06d8622d82c966a

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ad10d2985b4d716ce8126f0503f3920c54ffff1ec64d36ca6f78204bce22d090
MD5 3f01724c0eefca295103dc7d27be9038
BLAKE2b-256 ac1f7b9bad59fd1e58ee6fe5c38623b176c31d291866b27e7c0027ec32dd56aa

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bebdd4ec98600a1fac3bff47009bae28d3fc9febbd1e39ad3e4dee36318b9a99
MD5 0e6b2807973d495c8b036d8a6029c073
BLAKE2b-256 b4f270c77a04a2007f63c7c6a6c8d004e6feccb0ca60ea4db76eb77e2b42f98e

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 736a0799b11680e80c3f6d06cc85d1bbf4e56cf75638a44e3dda8adf8bd491bd
MD5 59600586449694a0624e44635082c899
BLAKE2b-256 89a338314d68666922ffe06b041e7e4ba7e3cc534eda04ac2d890544cb856658

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 078bd31aae73790e2cb8011a10289641b4db1f068bec6c06334b7df12c10c26b
MD5 6ec68b463bd6f9a8695373854dbbc8bb
BLAKE2b-256 f1eb1e8d42ee71e0c4764500db7662aff71928614d61d23ccc9e2c3c27ac6bd8

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d59af64b02a9e70fd05e2382935568027cdd622b351bc97e73bab55b532d8a96
MD5 0bff6b5e39f0b2a3e6d63ee6ed18b7a1
BLAKE2b-256 5e514acd4281f98c968e4b42830c44a93d396ce718d50200d05753011506c8a3

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f85fd43291c703504c16af7b06d5abe067f3909ae7119d8b2fbc3e089a50a1c
MD5 c805c35ea02871d61690aefa4c645f3e
BLAKE2b-256 b4456d8cdc07885b0d779e1dde2da0f79b8d64881695973702dcf2e5206c4e24

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 657da0dca9380e2d5282685d02ddfbb9a36f2b336ec5535c3aa945852cb82937
MD5 18f1e97dfb2e4438211bcf761ae5a73b
BLAKE2b-256 1c57e44387e71fa7cc7e9f782f16dd0debb64d355d942194dc2e9c076e53b11d

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 05642e60fdf973dda67a912959ce903963beb28129804863e6682fe2ab233e55
MD5 059850db22620a269027be201a1f5db3
BLAKE2b-256 9d2c773df098d41313d50473ea0fe1807063514d11afb173f034e579fde2a1c5

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5a2d84f00aee5a34f92196a4a96c4c58408b225f0ad0d863ff6a0d5d0bf651a3
MD5 cd16fcd00e4f86c6086607bdbb20514e
BLAKE2b-256 d0a25b69719299b4fc9866ba9eef6f11b1fdc16f02a56a72220cfa2d5a549810

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 68558c1370d94ca1f0683b01488ce649827fe52bd765ede437a9e56bbd6370be
MD5 6332b4c1611580f53d2dbbbe3413f50d
BLAKE2b-256 e03eb4a50264e7a98a68b1ff28cea894b6e5821926d5343bae961a7419872e1a

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d26069ceb52aa013440694fc29927aa7acb241decff4fcab59bfe0e100159bcd
MD5 bbec0edf8926f47dea5c6c3879a23191
BLAKE2b-256 1043805058840c87ecc1a75b1cc483b46a6dbe40efa50217b0aadb8f93a31941

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 703e68dcc95cc18ff806592d6d84bb3d6fcd934a587016816d80271227c86268
MD5 20638bc6f176b6937b7f6455a4d81ae8
BLAKE2b-256 db9dc2260385a1b05ff7f3f34c00253008a54e856dc9e5ee41e399e949d2096b

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.21.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.21.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 46f5585caa10c60c63c9fca65910b602197e0834c318aa1ff3c33480920d2a37
MD5 d03c3717ec247c6108da613ce42aecee
BLAKE2b-256 b9af561cdcd08f009c94ddb9f8d21836d4eec44652c4a22595d634c5688f68fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page