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.3.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.3-cp313-cp313-win_amd64.whl (71.7 MB view details)

Uploaded CPython 3.13Windows x86-64

threedigrid_builder-1.25.3-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.3-cp313-cp313-macosx_14_0_arm64.whl (70.9 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

threedigrid_builder-1.25.3-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.3-cp312-cp312-macosx_14_0_arm64.whl (70.9 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

threedigrid_builder-1.25.3-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.3-cp311-cp311-macosx_14_0_arm64.whl (70.9 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

threedigrid_builder-1.25.3-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.3-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.3.tar.gz.

File metadata

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

File hashes

Hashes for threedigrid_builder-1.25.3.tar.gz
Algorithm Hash digest
SHA256 e5cd092a61031c5a678127cdd783551aad33df3d10eecbb829c2cc0ca47ec4cb
MD5 7a3fef9ee0c026fbb3a92fb2e9b92a74
BLAKE2b-256 f85fa92d48b8ad6631e1d8d6b917de96fd46a9f4055e632e4ad99cad9be152bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6f9e250672abfb9afb2d1b11bec318d0ef5080d7ff66866fd73e9e5882aed0ec
MD5 1221f10348872ad85ee9c7e40ae259d4
BLAKE2b-256 8fdf60079429c29964d6c82fdad1d6c0db8efabe752960c69a0bfa553361ee05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9143589f2301bd64769f7d55b3b52a8a238aeef89fae37c523c2896074a34332
MD5 9c5eb1333204b0053ad548da9940945a
BLAKE2b-256 ad2155125aedfcb5cda6b95e2b2e779df80abe757470a863815bfbbc9ddbf5d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 91fbd44564b1c4a076f22c6f2b8f9b1303d815ab3d38b2f5faa4c4283b30389d
MD5 1d29ca7ee3bbeb6884e2a41ab3920eb8
BLAKE2b-256 3c3fe994c5dd1511c6c269cb63c40b94e963dd7e218226bf1a739087aeeb1a90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c1aefe3ea0692ed46df1bd63847a8998c640d1e86b598dcfd2349a11f83f964b
MD5 54029e688d0dbbe77f57cbb79003c6a0
BLAKE2b-256 281cadbdffa05271fe66bd041f29df81868ea0e01f35bf6eb39b259b8d9e218e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 748272883c72eeec92b88e91b4229371f43da17e714fdae176740c7befd3e2c4
MD5 cf17d73b1d0c26217dc38e4b64e571a0
BLAKE2b-256 387bec37e8c315c0414ecf72bc5cc5464368477bddb61fd5edd3370312560677

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 9d8cedffada30be5150c8155db4fbd1a93b01f03b0cbf5d439df7fe7ff836247
MD5 e7bd19eaaa12f1c6d8675abb71db74fb
BLAKE2b-256 a9c6d14fc395f2b8206f75e91ba4cb98e2561e85336e794c884965ee432fc678

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bd3a0e02c6db11fb688d8710e9243d420b013e1fb9d5dbdd482881d5ea1b4cf4
MD5 e7c6cd3764ae9cf8a9959fed74310613
BLAKE2b-256 596eeff6a084b0d5c1e075bf002ab55cd68b880a68d9ffc692b6522c6a1687db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6cd10c30b73a0c240b6b47e526ad9be425fc58458032072e2acf48a64fa53cf3
MD5 eb01588b402169ff1e3038759510642c
BLAKE2b-256 3b162a12a80849ae404005d3a0214dd0d71dbba6919b760e8d5c29895df53d1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 fbdfbcd00c6897533f526bb0bd6efd7a59aa27514d736e809b2290e8743c80eb
MD5 51ae0a5ee0545a776b05a14f1dd3932e
BLAKE2b-256 9e31040270f1e47fb3a268b9194cbc20a3cf3803814f7531d65678fb6bf013d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0aac1e570b7660f71f2b61a36a80a9d99e0ab10f8917cc9e7c032d238451fa3e
MD5 c7ad470fbf5aca33f62d17efbc7bb2ca
BLAKE2b-256 5ab0fbef0cac46d07907c7abb82713711da291f760d13c0ccc44ada2d05835a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e23d7112a95267e58550d1f43b79e5aca365a45c44e55923e9b06104dab9e8a9
MD5 0d6071369866564db87d0d9f109bec84
BLAKE2b-256 a69739d55b9827a9be47c386ee6447ef684cc85367f9baf9d0bfd77bc43fbec6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.3-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 13fa4f0ddc28966a7f8ac59a7f6d25ccbe0010f0b6afdf7e48de754a298676e7
MD5 a915e48ed8cf0d4e1f5d85dd328d7530
BLAKE2b-256 389d1674ab1509cd14c69b3d1bafd505a40de0b78d06f3e21a738d279da58df1

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