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.24.6.tar.gz (159.8 kB 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.6-cp313-cp313-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.13Windows x86-64

threedigrid_builder-1.24.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.24.6-cp313-cp313-macosx_14_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

threedigrid_builder-1.24.6-cp312-cp312-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.24.6-cp312-cp312-macosx_14_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

threedigrid_builder-1.24.6-cp311-cp311-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.24.6-cp311-cp311-macosx_14_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

threedigrid_builder-1.24.6-cp310-cp310-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.24.6-cp310-cp310-macosx_14_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

threedigrid_builder-1.24.6-cp39-cp39-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

threedigrid_builder-1.24.6-cp39-cp39-macosx_14_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.9macOS 14.0+ ARM64

File details

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

File metadata

  • Download URL: threedigrid_builder-1.24.6.tar.gz
  • Upload date:
  • Size: 159.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for threedigrid_builder-1.24.6.tar.gz
Algorithm Hash digest
SHA256 87ba698a4f3e24cd891b8eb16e5484c60b6800096ffbe49998591da47355f754
MD5 cd77864bf9ba96869093214d1cff9442
BLAKE2b-256 d84fefdb4c696d9aa1c7fae895dff32d02e9834c36d9353fc3057ca2bb11b0e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 38295595f06ed635d352565c301d45928c6e6ba12e4969c5992cb99fc3674b23
MD5 59e770a774148eba3cc49a9883f16282
BLAKE2b-256 3bc26ac7be5eef21333e0810485cb2c8c6478fa1ecbc0d4c9906fbe4cc6ac385

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7242c85f907b55fca53c702e4cca0512963f9e3575012f94389c780543636d4b
MD5 b43c95d55241fc73e01b769039ea805b
BLAKE2b-256 96b08e1947d82a42db148bb9df28ac18c53e3548c2e2e625cb93cb172be41de9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 692dc22650501a30381c23c5b6f8a6024aa9c3efc746ed1f2ba3091a49d69472
MD5 bed0a68fbb75bc19b31ec23e01d6291b
BLAKE2b-256 501a3939ef50dba525b5a454ae5e45bfbd69860d0c499deac87168dfaa84d9f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9efd7925c4f454069f2de3d19a9912503ba957e3a428fb30694a6e66ddab01af
MD5 3fa7384e0c90047b5b4340c545484c2e
BLAKE2b-256 b1cb31cbff1630d202139b437bdb8f2811a146a09940800d7fd69adc8bad11af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5198217c2e0ccd81d8ec0bc36f1a307d6c74095ff4b65e61344585d34e46987a
MD5 38b57fb08295a99c03aa7852adb3eb1d
BLAKE2b-256 1387771d853dc138e93ce089103ea64c007c4e7467ca6446c796345ca487dd15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 401271fceb8e74936e96a3d42e80f6934f8ba46325b0c3af9cffd289c6294f76
MD5 8148e46c19a578d07be615b53f082996
BLAKE2b-256 2bee5483148d171b30e74880ae1c2f8a5e9f4d9617e7372534460d44a23d35ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b0e917c4f05722762097fabf030af2e89fa8a517c6264179145d2627104440c5
MD5 0f348ccaebf20e65e2c16852b2428518
BLAKE2b-256 79e35bae40f22f112bb3572c8fdfff9aa2fb8fba5bfb241e4b1b326ec4dad4a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 55e2ecf36d6b1cd411f4f816db8cca75f8119664e28d34546263e8f51ff594e7
MD5 6deec4e8de6c598b59f6c018126fb1e2
BLAKE2b-256 f3083a3347abb1fdbb01448c57d3b271cdcd37a5747b207e5947a1f408f247b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c0b1f5d5d07011128fa3a524ccac4c00cc1a19c7f46433eae7c96e75b414ec1c
MD5 fc7cee693f5e6970f5abcdad41610ca4
BLAKE2b-256 802f23b02f5af37dd61aa0409853adc4d9daf029c64d6b4aa2795e07ab2c4091

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 aaf7572708f23fafe5384cb0c16e842f4d85ea65ae63066aa385a19bb00a82fb
MD5 a12070b74b4b56c64bb76c1343a5b155
BLAKE2b-256 3af55375fd371e7edd3c6ab330bec60212267ea21d4ed5199daa00f14b9ab7f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae8e051cdc8fdec07b41233d4201cbd9fdda97e358c7791b67fdb237f4d70aa3
MD5 ac18a498703e2a045719b4ac80d186a1
BLAKE2b-256 e28049e25fb806cf17a79f09d179a7f94fa7ff493e7e5e80a40b0fe8aec40c8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 08bb79464d162ef09eee345e04bd13406a501c9bca248ad9bc394c899eb8be9a
MD5 fc87c4307993301c6de1b2210509ede4
BLAKE2b-256 3ef5603f9a3f4b5fd700c82bc8ad0b15d4a84e2cb6548be6a0ef4403be054762

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6581025271a5fa6bdef9c7277d5cb37bbac3508eb0c344e7a88894999f5f607c
MD5 35ab89c084f144ca8a7e19384c407e7e
BLAKE2b-256 c59b6d4961b0aab40eb1ba21ecd4c98ab97ce611eef3276f5c32a763099b6b04

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a0c9f59cd037165a9b190d1853305334b227d4cfdc7823355837a1cd88736d4c
MD5 559e82ac5dee787d94d5913814c56c07
BLAKE2b-256 a25a05b9c87435a273023b8bbfff7c8595f87d2a5ab597c38ef9e10a10065137

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.6-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 7ceb025f5debc68dbe7214c32427ab9121982da453c86c734ac7bccb526c59ed
MD5 cca82e2d5faf584a40cf5cc23b537c4d
BLAKE2b-256 288a7fc01af8f3a6b4fa769e72d16a8a4c653797f48bf6c055eebe142a5ce508

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