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
$ pip install setuptools numpy==1.26.*
$ 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.

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.24.10.tar.gz (70.5 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.24.10-cp313-cp313-win_amd64.whl (72.1 MB view details)

Uploaded CPython 3.13Windows x86-64

threedigrid_builder-1.24.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.24.10-cp313-cp313-macosx_14_0_arm64.whl (71.2 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

threedigrid_builder-1.24.10-cp312-cp312-win_amd64.whl (72.1 MB view details)

Uploaded CPython 3.12Windows x86-64

threedigrid_builder-1.24.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.24.10-cp312-cp312-macosx_14_0_arm64.whl (71.2 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

threedigrid_builder-1.24.10-cp311-cp311-win_amd64.whl (72.0 MB view details)

Uploaded CPython 3.11Windows x86-64

threedigrid_builder-1.24.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.24.10-cp311-cp311-macosx_14_0_arm64.whl (71.2 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

threedigrid_builder-1.24.10-cp310-cp310-win_amd64.whl (72.0 MB view details)

Uploaded CPython 3.10Windows x86-64

threedigrid_builder-1.24.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.24.10-cp310-cp310-macosx_14_0_arm64.whl (71.2 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

threedigrid_builder-1.24.10-cp39-cp39-win_amd64.whl (71.9 MB view details)

Uploaded CPython 3.9Windows x86-64

threedigrid_builder-1.24.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.24.10-cp39-cp39-macosx_14_0_arm64.whl (71.2 MB view details)

Uploaded CPython 3.9macOS 14.0+ ARM64

File details

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

File metadata

  • Download URL: threedigrid_builder-1.24.10.tar.gz
  • Upload date:
  • Size: 70.5 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.24.10.tar.gz
Algorithm Hash digest
SHA256 c4817c2ece9a7b6f17cd92df2231c171a060828248b12ad23cd9389f5bc35415
MD5 28320414ca0e66f4b3b6a7281e333c23
BLAKE2b-256 973031a703d5bb716ed367818fe9c37fd328a450dfe29b189ed78596d2862e61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d5c77840507efd6023f9704422aed4431a5a9f87d13afd898f3e9f181e9c1893
MD5 d42d37c7c639e35ced4d153eb17792c6
BLAKE2b-256 bef41d9ed5b4ba7776987062acc205306491b7e538fbe3c9687f2f09c6e2c72b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dbb4c71f7dd8fb905f0dcad69d33433a502fd6c9033b3838ef42a68d12676e1f
MD5 6c12ba2697d1e049648a2fc295f0f757
BLAKE2b-256 89e9ce56d73a5d651998d960e4550f8b1e6727a50bf9dc3f463e6c090fafed17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 f9b96292e52d6853ed3cad6451904aacc23709bb5f9ee31f4d64d418ebe07a70
MD5 38db680f7947f6c9ca33683ed42ef7ef
BLAKE2b-256 9dc39793561a3fe34b0e2f353884ebecf43be34312e0877f301861ffa86c870f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5fcfc2aa5e43c242d38f608e7d55050baa90e1155dc233a3ca9bbac5618dd5f6
MD5 d660239465410b68ab68ac6f2dfca6a0
BLAKE2b-256 53be4bb92b7f4486633811966dd74e8b827418c0c973e84ef0adf8649fe92283

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 117c8473a113e486d7286b5fa95f421aa8dc57e587d25e1cbdb473c68c67c04c
MD5 4c5dd4bb7e5ede95ca01757dde35918f
BLAKE2b-256 94cd4e7cda7e46c98b3fbc8c5d025e16aebfb35cfa328d7e3a3d05d8ad57a05c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 b6c943a4441e1ee6304c15fc2bdbbbda33340cd4d8361b58fe4f7618e3ce958c
MD5 485711d4a8f8e9727ea67f5c539e3ba2
BLAKE2b-256 6f139a1875b0f551fc247e250a9ab75d78c6e8dc9ed5de33c07a6de08ab0d2f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9868fa838a8e07671511395fdf3164d01423e64f337e824921dc522a2ea3fb3b
MD5 79d4adfa4cced0a01bef8ffa7a7c7633
BLAKE2b-256 d36c65b6a9aec7b82e71172380f7d9e6295e537303f7628cbb92ba5330a32966

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8c2f36c7152eb2ac5a2da8e2700d06c13a62753aa0f0252345f6cfbc1f668665
MD5 df5e0c1892bcf71c1790a47356ad90d5
BLAKE2b-256 5cb2fa96747a2f0099ad80dabdf0e0901a1085d2fed3042e46841ccbe624a2fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 69e9d9bb8d90b038121ae5beddef318ebab820f889eb3c0a92cf98d485d567e8
MD5 c1953f750e5bba56377a48d0e75e05cd
BLAKE2b-256 1f2b4db2c494295c68d88f388bb27852b4ec53057a25e6468e84a27bfe68a3d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7aae61a34aac7e2bd990614b514f94556ba1998d22d19b5eb95bbba5a3ec02ac
MD5 8d4276d985fa1279fd72fa40368e7503
BLAKE2b-256 e7e327ac7696e87d394e4af68e29cc1a07157c4aa511e19426e283ba74a29591

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2135160ed5593567057791fef9cfa5dbbdd4084d5c0099f7319ff8b112fa7883
MD5 9bf4a01d8ba0bff70d79b216753e4443
BLAKE2b-256 2c0828d03833293a2b19073095a0cc88cd986990265ecc5b1e97a78d1ac2e817

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1eeda482f5c9e49cb82b957de712ec624e7348dcbe6c717fa5276c50858e4890
MD5 14d66b24ebaa84e5b4a20c29e9b4a688
BLAKE2b-256 603da513b05ac4b58761d8ec788ebfbfc3f2f1cb0359dfd3171f1e3d75724915

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6cdd4ea64b6c80dc7012d063596f9cc8ecdec05d966797a3bdcbbde968753e73
MD5 759b87869438b1ae3c1f8e3b4ca5c39f
BLAKE2b-256 2d29fce98fd55c7a58d0c17600f9a759ae6c3ee6851ba79ade8834ae11fe988f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 646496ed2647fa751f1ebff5ec5c0b8c4f22928c7b533d1d108e8f96f00333a8
MD5 5fc40716aec0d2e54984db85e4711589
BLAKE2b-256 ae6d242b82f56d71b018bbdf4e0d8e5d40fdd57e5330a398743b101726c8b683

See more details on using hashes here.

File details

Details for the file threedigrid_builder-1.24.10-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for threedigrid_builder-1.24.10-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 a12dae95671af794927b1dacdde378a71432aa68f30616c2ab80e6251e2b47c2
MD5 769c624ed7b9b54f614b42931ab1e8a2
BLAKE2b-256 68fff6f76feffe3da9b2ff1fba7064f66af1476901fdc49e5f5eee333ce70c4a

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