Skip to main content
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

Release files for threedigrid-builder 1.25.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for threedigrid-builder 1.25.3
File Size Uploaded
threedigrid_builder-1.25.3.tar.gz 70.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for threedigrid-builder 1.25.3
File
threedigrid_builder-1.25.3-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
threedigrid_builder-1.25.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
threedigrid_builder-1.25.3-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
threedigrid_builder-1.25.3-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
threedigrid_builder-1.25.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
threedigrid_builder-1.25.3-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details
threedigrid_builder-1.25.3-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
threedigrid_builder-1.25.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
threedigrid_builder-1.25.3-cp311-cp311-macosx_14_0_arm64.whl CPython 3.11 CPython 3.11 macOS 14.0+ ARM64 Details
threedigrid_builder-1.25.3-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
threedigrid_builder-1.25.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
threedigrid_builder-1.25.3-cp310-cp310-macosx_14_0_arm64.whl CPython 3.10 CPython 3.10 macOS 14.0+ ARM64 Details

Total release size: 924.6 MB

Release files / threedigrid_builder-1.25.3.tar.gz

Download URL threedigrid_builder-1.25.3.tar.gz
Size 70.1 MB
Tags Source
SHA-256 checksum
How to use checksums
e5cd092a61031c5a678127cdd783551aad33df3d10eecbb829c2cc0ca47ec4cb
BLAKE2b-256 checksum
How to use checksums
f85fa92d48b8ad6631e1d8d6b917de96fd46a9f4055e632e4ad99cad9be152bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp313-cp313-win_amd64.whl

Download URL threedigrid_builder-1.25.3-cp313-cp313-win_amd64.whl
Size 71.7 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
6f9e250672abfb9afb2d1b11bec318d0ef5080d7ff66866fd73e9e5882aed0ec
BLAKE2b-256 checksum
How to use checksums
8fdf60079429c29964d6c82fdad1d6c0db8efabe752960c69a0bfa553361ee05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL threedigrid_builder-1.25.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 71.1 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9143589f2301bd64769f7d55b3b52a8a238aeef89fae37c523c2896074a34332
BLAKE2b-256 checksum
How to use checksums
ad2155125aedfcb5cda6b95e2b2e779df80abe757470a863815bfbbc9ddbf5d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp313-cp313-macosx_14_0_arm64.whl

Download URL threedigrid_builder-1.25.3-cp313-cp313-macosx_14_0_arm64.whl
Size 70.9 MB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
91fbd44564b1c4a076f22c6f2b8f9b1303d815ab3d38b2f5faa4c4283b30389d
BLAKE2b-256 checksum
How to use checksums
3c3fe994c5dd1511c6c269cb63c40b94e963dd7e218226bf1a739087aeeb1a90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp312-cp312-win_amd64.whl

Download URL threedigrid_builder-1.25.3-cp312-cp312-win_amd64.whl
Size 71.6 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
c1aefe3ea0692ed46df1bd63847a8998c640d1e86b598dcfd2349a11f83f964b
BLAKE2b-256 checksum
How to use checksums
281cadbdffa05271fe66bd041f29df81868ea0e01f35bf6eb39b259b8d9e218e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL threedigrid_builder-1.25.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 71.1 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
748272883c72eeec92b88e91b4229371f43da17e714fdae176740c7befd3e2c4
BLAKE2b-256 checksum
How to use checksums
387bec37e8c315c0414ecf72bc5cc5464368477bddb61fd5edd3370312560677
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp312-cp312-macosx_14_0_arm64.whl

Download URL threedigrid_builder-1.25.3-cp312-cp312-macosx_14_0_arm64.whl
Size 70.9 MB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
9d8cedffada30be5150c8155db4fbd1a93b01f03b0cbf5d439df7fe7ff836247
BLAKE2b-256 checksum
How to use checksums
a9c6d14fc395f2b8206f75e91ba4cb98e2561e85336e794c884965ee432fc678
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp311-cp311-win_amd64.whl

Download URL threedigrid_builder-1.25.3-cp311-cp311-win_amd64.whl
Size 71.6 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
bd3a0e02c6db11fb688d8710e9243d420b013e1fb9d5dbdd482881d5ea1b4cf4
BLAKE2b-256 checksum
How to use checksums
596eeff6a084b0d5c1e075bf002ab55cd68b880a68d9ffc692b6522c6a1687db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL threedigrid_builder-1.25.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 71.1 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6cd10c30b73a0c240b6b47e526ad9be425fc58458032072e2acf48a64fa53cf3
BLAKE2b-256 checksum
How to use checksums
3b162a12a80849ae404005d3a0214dd0d71dbba6919b760e8d5c29895df53d1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp311-cp311-macosx_14_0_arm64.whl

Download URL threedigrid_builder-1.25.3-cp311-cp311-macosx_14_0_arm64.whl
Size 70.9 MB
Tags CPython 3.11 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
fbdfbcd00c6897533f526bb0bd6efd7a59aa27514d736e809b2290e8743c80eb
BLAKE2b-256 checksum
How to use checksums
9e31040270f1e47fb3a268b9194cbc20a3cf3803814f7531d65678fb6bf013d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp310-cp310-win_amd64.whl

Download URL threedigrid_builder-1.25.3-cp310-cp310-win_amd64.whl
Size 71.5 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
0aac1e570b7660f71f2b61a36a80a9d99e0ab10f8917cc9e7c032d238451fa3e
BLAKE2b-256 checksum
How to use checksums
5ab0fbef0cac46d07907c7abb82713711da291f760d13c0ccc44ada2d05835a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL threedigrid_builder-1.25.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 71.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e23d7112a95267e58550d1f43b79e5aca365a45c44e55923e9b06104dab9e8a9
BLAKE2b-256 checksum
How to use checksums
a69739d55b9827a9be47c386ee6447ef684cc85367f9baf9d0bfd77bc43fbec6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / threedigrid_builder-1.25.3-cp310-cp310-macosx_14_0_arm64.whl

Download URL threedigrid_builder-1.25.3-cp310-cp310-macosx_14_0_arm64.whl
Size 70.9 MB
Tags CPython 3.10 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
13fa4f0ddc28966a7f8ac59a7f6d25ccbe0010f0b6afdf7e48de754a298676e7
BLAKE2b-256 checksum
How to use checksums
389d1674ab1509cd14c69b3d1bafd505a40de0b78d06f3e21a738d279da58df1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

1.25.3 This release

13 release files

1.8.0

13 release files

1.7.1

13 release files

1.7.0

13 release files

1.5.0

13 release files

1.4.0

13 release files

1.3.5

12 release files

1.3.4

12 release files

1.3.3

12 release files

1.2.1

12 release files

1.2.0

12 release files

1.1.0

12 release files

1.0.2

12 release files

1.0.1

12 release files

1.0.0

12 release files

0.9.2

12 release files

0.9.1

12 release files

0.9.0

12 release files

0.8.0

12 release files

0.7.0

12 release files

0.6.1

12 release files

0.5.0

12 release files

0.4.0

12 release files

0.3.1

8 release files

0.3.0

8 release files

0.2.1

8 release files

0.2.0

8 release files

0.1.2

8 release files

0.1.1

8 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page