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

Uploaded CPython 3.13Windows x86-64

threedigrid_builder-1.24.8-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.8-cp313-cp313-macosx_14_0_arm64.whl (71.2 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

threedigrid_builder-1.24.8-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.8-cp312-cp312-macosx_14_0_arm64.whl (71.2 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

threedigrid_builder-1.24.8-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.8-cp311-cp311-macosx_14_0_arm64.whl (71.2 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

threedigrid_builder-1.24.8-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.8-cp310-cp310-macosx_14_0_arm64.whl (71.2 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

threedigrid_builder-1.24.8-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.8-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.8.tar.gz.

File metadata

  • Download URL: threedigrid_builder-1.24.8.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.8.tar.gz
Algorithm Hash digest
SHA256 0691f873b033555d16092b5ff12b51f87f0cb049189bcea494bd478e3c08ddce
MD5 a00fb4b8238bdbc93a6efc951c398ef4
BLAKE2b-256 b920ba15d0b84e417b79ee2e706593aa549627d4855823b353a0a8bac51e5c8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 bd785fdad40e57d797d948a38a077e1b3fa0d1b55b5fa9862f917095ab0db97b
MD5 5bbbf19e70d2d6c76f817ea739cf9ba3
BLAKE2b-256 7a19c68514e6f65954b71801e49f4f7ae2ca9a3a6702176b081f066d3e600bdd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0fd60da6a0831d12f95a3234f58ddfac7ea0671494f7d82c8cce928595066674
MD5 9ea51bebb3260240b54a0739a31da214
BLAKE2b-256 e2e946c2ffb46bc4fa33409e5ef19c488a3d7fc431ed456088ead190bf1f1224

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 31cf4783b642d5232bdf2afedc183976d6112dd35f9bd3716c868a8cb2feed87
MD5 cb6e8aee9a73e6470c939f6872a31cae
BLAKE2b-256 7f025390c74ea3fb00c3eca9541b7ade37026ce2b386dd853a34fa36e5f0eb46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4d1e14c1a36d529964b72af886aa15139b957470aca95dfdef0ce2d203cd5d86
MD5 6d6c6f76b45bdbb1c966f154e220340f
BLAKE2b-256 8a14f91810a23ade467d1e619edf1cee9844482ae1bffc371ac485c18c24c711

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 03d48809d8cdeab25356974f8daa3e667eab18719f8aefe7fdbca50b5738abbd
MD5 ae6f9c86fb34dce05229d728fe877f7f
BLAKE2b-256 14d30410cdd61cae4b6f935e1b0ef3726a3ece5ae086a9bb5b960f8e0373fc3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 77174ddad61a50aab4b095194b00584fbad52a60044cd957c2492bac22cc5a6b
MD5 7c6da9439abd0922ba18c3c2c919eed4
BLAKE2b-256 777897e4e00218a0fd29c5e194c7e6f99c6034d5a78ba244ff3e966a301a5c86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8a48c9e1881700a42f737517cde9207c867fab1901ef3e2a16c060a3a3bba873
MD5 053230dcb27f3bdd3fae0ce6fe314dea
BLAKE2b-256 434a75d18406676032ce723746b1125c378166fb901f51aadf97fe54861ca8bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 662ea6c5d3c254c12ee6a3108308b4a475b5fb50943af07f34956d00c058b805
MD5 8a95a48d938b44acdc6a737b4c75fb12
BLAKE2b-256 a08bcb9520444e4504dfe4a368041b5011ed3c8e7eca30dad1eba8581d231f59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c94720184566f8d86cea11001c0a92ad2f2a99808b4086b6d8bece569ed17d92
MD5 8d7b43ee5d622c24d1b3127e43fe1dfe
BLAKE2b-256 dea8fa5a6b3e7c226db703bf445512fd67db065bc4906b25556c3e17925eb670

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 28bd8320a5adb2c35e357b87d811e2f09b097d18cac9832def1b8423119b1a16
MD5 565666a5bac2b2ccc12d0a3be894461a
BLAKE2b-256 e62090f6f232690b20f3f6fea098d9c6c42da0d95e4831abcd11e36180f2476a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c49453dde48e33ae284bc329f1e0015ac2719e44e54fd5a25e9cf508c14c204b
MD5 cad21e7579c1e3190c2ed2c390e93e0b
BLAKE2b-256 897692b3a57320278fa984a541c4d8bea8d2676137979627f9aa4909475a4fae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 ed79fbbb3211a7edf4d97e84115f05fb4548eae3b43e2ed4ebbb6805244cd7d6
MD5 b004eb25ae7f18a784118dbcca4da0b8
BLAKE2b-256 10a1e2ad5d33ae6ff5149080581a7e6b217e6d45b9dc6f5b271d79ec5ca95212

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6ca3f933d228184db34326424702254ff0c509c4195709c3be44d498913529e7
MD5 a2e95f791e2a5978c14952aee7a64da1
BLAKE2b-256 35b1fd5f229f20c7bee96ef851398efe002527b2308539e06eeb10d75d04d0e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a0db0486affbadb9bc6fb025ab399a39318ebc567fe5f42dd072e23eb8910c64
MD5 60d00754cd3b7543b72875a6e03a8947
BLAKE2b-256 1508a6e519fe21d37d8c55c5c733c6fc78e35c995f0b782dd3e3b16cfcb89391

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.24.8-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d34567d813185eb7be5463c1955ba73ce7d961762df96f0526ac9dce018e70bc
MD5 0c761a6308cfcde612df07a14b24928a
BLAKE2b-256 827516c0047c8152e69c184cab7753a5c32be7f4ab02bbb8f77dbaa8a5bf32ba

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