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:

$ pip install --upgrade pip wheel scikit-build-core setuptools numpy
$ pip install .[test,gridadmin] --no-cache-dir --no-build-isolation GDAL[numpy]==$(gdal-config --version)

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.

Only build the Fortran files:

$ ./build.sh

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.25.2.tar.gz (70.1 MB view details)

Uploaded Source

Built Distributions

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

threedigrid_builder-1.25.2-cp313-cp313-win_amd64.whl (71.7 MB view details)

Uploaded CPython 3.13Windows x86-64

threedigrid_builder-1.25.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.25.2-cp313-cp313-macosx_14_0_arm64.whl (70.9 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

threedigrid_builder-1.25.2-cp312-cp312-win_amd64.whl (71.6 MB view details)

Uploaded CPython 3.12Windows x86-64

threedigrid_builder-1.25.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.25.2-cp312-cp312-macosx_14_0_arm64.whl (70.9 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

threedigrid_builder-1.25.2-cp311-cp311-win_amd64.whl (71.6 MB view details)

Uploaded CPython 3.11Windows x86-64

threedigrid_builder-1.25.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.25.2-cp311-cp311-macosx_14_0_arm64.whl (70.9 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

threedigrid_builder-1.25.2-cp310-cp310-win_amd64.whl (71.5 MB view details)

Uploaded CPython 3.10Windows x86-64

threedigrid_builder-1.25.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.25.2-cp310-cp310-macosx_14_0_arm64.whl (70.9 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

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

File metadata

  • Download URL: threedigrid_builder-1.25.2.tar.gz
  • Upload date:
  • Size: 70.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for threedigrid_builder-1.25.2.tar.gz
Algorithm Hash digest
SHA256 b20190d95bfa4eff3a15c670e5e58a053b1f1fe6767054fc34408cfd0a86a675
MD5 4b88bb57dd32dabb756a8d1e5801f5ff
BLAKE2b-256 407453fc870ad6120e4e7248d51fe35837e7425a9663ed19a66ee937ecbbb5e5

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.25.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 dc481e822c1974370c525345d0d06742c60fd28d6b18b7237982cff531a75b65
MD5 edcbad901169c25fabf931fa9c30415b
BLAKE2b-256 833f6ce051528af273301288a70f5cce7449f7cd5c63fb1a094bc0cb1f238b0f

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.25.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 17620245b79d4e00de9de3207264d281e6e34d4ba52dcbfcf7294dece8417ff7
MD5 9b695934e80209ae3c867e50465de59b
BLAKE2b-256 107ac24608d8ff588c90b5f32a74bba4b046dc80154fc09260a54f1fa7deb8ff

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.25.2-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 2c478eaf6b623a47f2deee8660ee0cd3c63fedee4f21908432c478138676cde9
MD5 f735ab31ff670515f29509907668df63
BLAKE2b-256 650c088aa887d68f2b426c930067e50ff84184dc0d012bd80911e130910c6232

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d9b379df6ab9d4468c44dbee0b5a463648ec7142d9daa09b36c552a712ddddbe
MD5 ad7a5968992b76846fb9858d5dc133e7
BLAKE2b-256 cb730c93dc25aba29d08e362e2ec16e662397da9bba9c00dbf255e1cd323f589

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f14cbc1bdf4c0a65cbfa186f60a81ffe98f1d3779a024ca1129cf25556df1297
MD5 b0752b779b8241eee26d307e151a5e9f
BLAKE2b-256 87ec488533b5c9d6276f9078937245a1549a5b125d5280a72fe8075c6ca67c0a

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.25.2-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 09ab8d3d87ed74b5fdcd0eeccd3a6b13a15056e94ffbaf562568f998966081a7
MD5 01a0814b22808c974a701b0569e12aea
BLAKE2b-256 78f7ccf875af9d4ebf7b05e257f1c71750c5f9ffd68bc74c04896086d56458bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 150618dac5196f15b276eb6b77e98343035c2e0647ca4007a4dd6b5c12c04252
MD5 f2a7c8f18495a1635957313e306a9ea5
BLAKE2b-256 d4163f27ec8284a0c9c3da7174dc9d1b984ec71eedc8580735833228bf2f13e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0f10363b527e4b4b8384069ba64fd013d6b2c52d322a2b615dbf1568ccbd038f
MD5 477210f9987fd88756c83679d791b903
BLAKE2b-256 5c47f0fad9e91e494e3905fb74083542082f575eadc920145b4440f6caddd244

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.25.2-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 ef2007f4d57be2bf13839404afd5bba7cfc8f8da8a01f0f02dc6f3697c3a80de
MD5 370c84c6c930afba0201fd8b59f7fffe
BLAKE2b-256 154e0a47424446248abc20a8691fca4f79a2ba8895d390db54ba13a8554126b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 336d7d073fa3a19dfa78222e8fb07acfbde193e7d34e61918512a2edd2c74c4c
MD5 a6c5826bc89bb80d7542259a6c57e796
BLAKE2b-256 381cb0b86fe5a800a89ef4c3693ea04f7a0392517ff1158b37dba3bc626f3d6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 17acdc668872a67cde10bc2ce0c066f46b1e68a0401be69bcb84eb2a1ecee480
MD5 5a54ba153573c06c5116b148d6c29923
BLAKE2b-256 da47bbcaa27dbdcb85ccfac1c95dcc42b06790afc88999468c35b672db639164

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.25.2-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.25.2-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 9b2b8f03ea20987d19456f4c07b0413cf4235ef2dd73403442dde698923866f4
MD5 67cf7ab0a6980c8bdec553b5ab46eb26
BLAKE2b-256 02aa1692685eb41a2a53d75010d36ff74b7a69641b8f758b3a951cba58ca3a70

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