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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 14.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 14.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 14.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

threedigrid_builder-1.25.1-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.1-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.1.tar.gz.

File metadata

  • Download URL: threedigrid_builder-1.25.1.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.1.tar.gz
Algorithm Hash digest
SHA256 efb7ec6c83ca38e963b709c96e80f5ded4ac62a62d9e001f5a23d2862c91aadf
MD5 ff88f9e6c8619894df8d1776996a0e2a
BLAKE2b-256 bc8dc7c45ad7a9204f525cf7007b88557d8dfabcc6e6b2933f13f6ac7baac0e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 02f61a812588f24c1deb2cfcccd2456fb948a2c3250979a0667fb566d08a2cf0
MD5 f1ef36082da2d4fc4a51725d1569176f
BLAKE2b-256 fcda9b96c8b7e8362726c192c7aabf07c99ab116aee09d20f6538914fa5f7a6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7412a5b434430fc197eba14fd55b3f5e1835648874b0bd6b75f45cdfca257f99
MD5 4c7c900edfc1d4be9b619d7c770cfa7a
BLAKE2b-256 08520b3756959919b5ae4e42c464ce5f3214b73966a390b5d321ae9eaf0bf14b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d914b0f5ece6498526e15171e7877b850336c279336ac215ec41fb76b08900db
MD5 4d1d86a4f6f246fc462823271ee09629
BLAKE2b-256 0ff652fd75f20ab6fcc8981489e8e1acf5abb42f3f9f094a15fabee44ee5a661

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b78946739d68a1b4e4aa042d1d77d075ad65ae02af63711e37b9cd76a4149e91
MD5 98379a5b240f1db72a528e51e00f6d1d
BLAKE2b-256 935746d03776e1a7bb91f6616c91ee826bd2852104f156ad64a323ec2c1ae10e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7e75cf515a62408f2fc2373397e189a28e5df460353479a1c7437d06d48e6270
MD5 df245edc25617c02353a7e0d7b66f1ba
BLAKE2b-256 6f634874a61cf1bddd2d00b5e22752d64ae85fe23de204f25583b4f5f70f5b29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 3d254bbdfb80c2ec4f7f9644db2e104894c725d16459d062ea81044ef380c372
MD5 afe87833a860b165eab20663c0f2ad3c
BLAKE2b-256 a3a41b7904c7458ad8a629df7c3a4e20eebdd9263a20fd9ce3bf8c8c53e60a7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 df80b776a7977ce6a85b13c0e0cc882189e54e6eb463f7b3615b1cbdbf003d9a
MD5 dcf1f85b58a3c8ab6b033c6e1e1cff2c
BLAKE2b-256 7044077eacda39a69c120bb16af735aafcc6dfd100b0774314a3bea9a67558f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3e98b30024ccaf3075b941ef6608e8420ef9086e93e3001261bf8b0ae272dbaa
MD5 3d3ab0649725edde682924c1971bb2a2
BLAKE2b-256 226c12bc7c23bf0f82a0144e9bc19df0d4aff528a0b80a8b0ee7bf9545a352df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 f9bd299e8fe4bd08c1d89590a393d291d7803422b0e5882f582194e98ec5ac28
MD5 d0061933629bc7644ac7f3e021268242
BLAKE2b-256 8596d9502dbbf30ab211425e72e661e0b7b84f66e4d3f2b0c437858a6ec918bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5304accc863afa90af1db6b88c75422007f0bbbb7ae6bb8bef19936ac6df17db
MD5 4afff155b29d9be6157630422395785e
BLAKE2b-256 f6fdd2fb0d6cb9c5681e33a95c0c68d064bb1df5a36273d737e20a6a0fe786e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fcf9c47ea9ce18f583301cb19dbc6b99d9d7ff09d3e73289211a2f51c6509d06
MD5 568fabbbe2e88717b9cfa12ee9cccbbe
BLAKE2b-256 c45d25fab19c210fe1929ee87e51ffd81facb93bbfcb15c494121cbb5d5343ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for threedigrid_builder-1.25.1-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 452c1fbc819fe21ccd9fe03891173dccfb2e02e2e42cfdd05d92b71f21637c69
MD5 e0a37292bca6a7b5bfb0984b55b1f2a6
BLAKE2b-256 c4ecd4cfbfe095329cd221d385b8ef9c0938f218babbc7681a2e89802d999951

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