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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 14.0+ ARM64

threedigrid_builder-1.25.0-cp312-cp312-win_amd64.whl (72.0 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 14.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 14.0+ ARM64

threedigrid_builder-1.25.0-cp310-cp310-win_amd64.whl (71.9 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

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

File metadata

  • Download URL: threedigrid_builder-1.25.0.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.25.0.tar.gz
Algorithm Hash digest
SHA256 c0fa1f59683be9da8d41627bc4f67d0de85b3c1a1f7ccbebd2dad76ccc118245
MD5 3f43b7694dac00295589c39d40d93427
BLAKE2b-256 0bb2181099661d8e1a88a0952af5db8e958bedb3a5941ea9dd8cd45c5c6386c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9fe1bf498769450f229a12684ded625d066c50ec6fc365fc3214336037ec4938
MD5 4bd1e80fe8a0b3990865975bd01c60e3
BLAKE2b-256 00962ff9190574af0c2b45d7ef2b67a4d9b460113d457766ca648b3498b39b9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7fa5f42fe36d1a63073a28b009c7856d3bf9583abb49e303ad2feee85c05ee69
MD5 3e7ef2b32d1035edc3502bd648f6c654
BLAKE2b-256 4a8be63f684828f86a7e4c388d12b36102343f33b3b2209273b8517812b6f0a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 7ba448dd682fdc08998b36bc8c0e5d263e76b9437c75fec7f96267bb187aaf00
MD5 4778411111ca16819f9bdd4d291834a2
BLAKE2b-256 258bcfcbc67d9a23b417ded29be46242d58f5e15f8a2e12702d2267239a61ec4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b963b2a93e837ca2a56ef75500ae209c5f9fb36c973e484ce6a612116f9065c0
MD5 c7463832accba6fa0dab1d92f3d9dcc3
BLAKE2b-256 21895eb2d0d66e4814970708d9f858be6c9fee9c305a11f6b3fe4d7f10324063

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 411e47c814ec762c59d592ec564abcffe33329c2aed27f3c4c500436d61cdc3e
MD5 d5efe953a1bc4c7a2e2f35b8220c97c3
BLAKE2b-256 8e0edad273f228ccb088c2b7061eee06c44883ab58a26c9b48cf85b6fadf997c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 946791ccc50a3e652e9396027ae0bbaf3b5b07438d973ef9d0317d71e1628b70
MD5 ee40c3dd441bf13b02e795988f1c6577
BLAKE2b-256 97de40620460d864d64b280908afbbaa06d0a1d665f64df5e0ad98c952b31c4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 497daca9bea6adabfc3fcfad5e7b0ac720c636c7ae8241be1b2901b26aff6f38
MD5 ccebe1d8fdb3a46a83cab303ca388c28
BLAKE2b-256 ca6ddddac54034ccda168b3300f827b8caa2ce9aaed74dde27fe20407edad913

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 76e2d9cc702e9dd6049868093132faa0710ddca157dc8c5805eefe5c2a7e8a2e
MD5 6ecdf2316019a0a26fecd40fdd9d873b
BLAKE2b-256 c470c8b67c686b94ff4d1921da078d4e5b1070488c97b3b4f0cf56357014b480

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 468641f67beb4bcc2e9338f64fdb7ddc7ce1e126a4fa84134a393b205e70b31f
MD5 4c0a93f69a4d35bcd7e561796d5cc1fe
BLAKE2b-256 8026b6c4d8382302d79e504109f31f3b252a4bf5bd94f2b7cd7616296ebcf55f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0d4dec09bd348425857f603fe0f058c67085ba538637e28afd952133c73fb6c3
MD5 36ab2d57d888a81126f95f1863eee697
BLAKE2b-256 8cbd739faa79f3f96fad6506581798bb7efcfe82c61b623ec79d39e92859effb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 630529e18282a688b819d1b0bb1f48c019d4dd916229648ba2dcb0e4e9dd8b14
MD5 7663f3e7ba7588d8d7f9b525d9e41c66
BLAKE2b-256 76674ed67a92c7b8f92d1adb5ae4e3e8429f0df1111b97bdd7eeb62c0dc703fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.0-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 71387ef6935b3102ae6c0e227b8fd61e4b1efc6f8df27e1fbb90c54bf9118487
MD5 a8ca295faf6a23a13620d81450d645b7
BLAKE2b-256 b56063621ae5c30c54076a8834a46b9e472e9c42399e08a2280f8b510bf42245

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