threedigrid-builder


Namethreedigrid-builder JSON
Version 1.24.0 PyPI version JSON
download
home_pagehttps://docs.3di.lizard.net/
SummaryGenerate a 3Di simulation grid from a model schematisation.
upload_time2025-01-24 06:54:12
maintainerNone
docs_urlNone
authorMartijn Siemerink
requires_python>=3.9
licenseGNU General Public License v3.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            threedigrid-builder
===================

.. image:: https://github.com/nens/threedigrid-builder/actions/workflows/test.yml/badge.svg
	:alt: Github Actions status
	:target: https://github.com/nens/threedigrid-builder/actions/workflows/test.yml

.. image:: https://img.shields.io/pypi/v/threedigrid-builder.svg
	:alt: PyPI
	:target: https://pypi.org/project/threedigrid-builder/


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:

.. code:: python

  >>> 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:

.. code:: python

  >>> 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, for Python 3.10 with numpy 1::

  $ pip install --upgrade pip wheel scikit-build
  $ pip install setuptools==63.*
  $ pip install numpy==1.23.*
  $ pip install -e .[test,gridadmin] --no-build-isolation h5py==3.7.* sqlalchemy==1.4.40 shapely==2.0.* pyproj==3.4.* "pygdal==$(gdal-config --version).*"

In case the Fortan code needs to be recompiled::

  $ python setup.py develop

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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://docs.3di.lizard.net/",
    "name": "threedigrid-builder",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Martijn Siemerink",
    "author_email": "martijn.siemerink@nelen-schuurmans.nl",
    "download_url": "https://files.pythonhosted.org/packages/7d/87/5fe09c80722485ab9c79eeff2f6ddc318d12b7c0f42b5c1e0262756b56d4/threedigrid_builder-1.24.0.tar.gz",
    "platform": null,
    "description": "threedigrid-builder\n===================\n\n.. image:: https://github.com/nens/threedigrid-builder/actions/workflows/test.yml/badge.svg\n\t:alt: Github Actions status\n\t:target: https://github.com/nens/threedigrid-builder/actions/workflows/test.yml\n\n.. image:: https://img.shields.io/pypi/v/threedigrid-builder.svg\n\t:alt: PyPI\n\t:target: https://pypi.org/project/threedigrid-builder/\n\n\nGenerate a 3Di simulation grid from a model schematisation.\n\n\nUsage\n-----\n\nThis library converts a model schematisation to a 3Di simulation grid. This can be done\nusing a single function that reads data from an SQLite and TIFF and then outputs the\ngenerated grid into a Geopackage or HDF5 file:\n\n.. code:: python\n\n  >>> from threedigrid_builder import make_gridadmin\n  >>> sqlite_path = \"/path/to/model.sqlite\"\n  >>> dem_path = \"/path/to/dem.tiff\"\n  >>> out_path = \"grid.gpkg\"  # or \"something.h5\" for HDF5 output\n  >>> make_gridadmin(sqlite_path, dem_path, out_path)\n\n\nAlternatively, the generated grid can be output in-memory:\n\n.. code:: python\n\n  >>> make_gridadmin(sqlite_path, dem_path)\n  {'nodes': {'id': array([   1,    2,    3, ..., 7903, 7904, 7905], dtype=int32), ...}\n\n\nInstallation\n------------\n\nThis package is distributed as source and binary wheels on PyPI. The currently supported platforms are Windows, Linux, and OSX, all\n64 bit versions only.\n\nFirst install sqlite and spatialite libraries, e.g. on Ubuntu::\n\n  $ sudo apt-get install sqlite3 libsqlite3-mod-spatialite\n\nFor raster input, GDAL is required to be present. We omitted these from the dependencies\nbecause installation of GDAL depends on your platform an on your personal perference.\nOne option is to install gdal using apt-get, and then pygdal with a matching version:\n\n  $ sudo apt-get libgdal-dev\n  $ pip install pygdal=={your gdal version}.*\n\nThe current platform version of GDAL can be retrieved by:\n\n  $ gdalinfo --version\n\nInstall the threedigrid-builder::\n\n  $ pip install threedigrid-builder\n\nFor output into a file for the 3Di calculationcore, enable gridadmin output::\n\n  $ pip install threedigrid-builder[gridadmin]\n\nFor output into Geopackage for display in e.g. QGis, enable gpkg output::\n\n  $ pip install threedigrid-builder[gpkg]\n\nThe command line interface requires Typer::\n\n  $ pip install threedigrid-builder[cli]\n\nDevelopment\n-----------\n\nClone the repo and fetch the LFS objects::\n\n  $ git lfs fetch origin refs/remotes/origin/master\n\nInstall the build tools::\n\n  $ sudo apt install cmake gfortran\n\nInstall platform dependencies::\n  \n  $ sudo apt-get update && sudo apt-get install --yes --no-install-recommends libgdal-dev sqlite3 libsqlite3-mod-spatialite\n\nCreate and activate a virtual environment::\n\n  $ python -m venv ./venv\n  $ source ./venv/bin/activate\n\nInstall the dependencies. For your distribution, check the dependency matrix in .github/workflows/test.yml. For example, for Python 3.10 with numpy 1::\n\n  $ pip install --upgrade pip wheel scikit-build\n  $ pip install setuptools==63.*\n  $ pip install numpy==1.23.*\n  $ pip install -e .[test,gridadmin] --no-build-isolation h5py==3.7.* sqlalchemy==1.4.40 shapely==2.0.* pyproj==3.4.* \"pygdal==$(gdal-config --version).*\"\n\nIn case the Fortan code needs to be recompiled::\n\n  $ python setup.py develop\n\nNow you should be able to run the tests::\n\n  $ pytest\n  $ pytest integration_tests\n\nFor VSCode, optionally select the python interpreter corresponding to the virtual environment.\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3.0",
    "summary": "Generate a 3Di simulation grid from a model schematisation.",
    "version": "1.24.0",
    "project_urls": {
        "Homepage": "https://docs.3di.lizard.net/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "48771c2aa0b51e37ebe0f0f1149942d7be408b13af6cdfbaf7834da9ef8596b8",
                "md5": "4e679f3da231e6bf3719e695921a1401",
                "sha256": "28f74cb609cdb25f01984b350e24d0591c9d67cccaa40ab3c51f191d62969a2d"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp310-cp310-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "4e679f3da231e6bf3719e695921a1401",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.9",
            "size": 1611853,
            "upload_time": "2025-01-24T06:53:48",
            "upload_time_iso_8601": "2025-01-24T06:53:48.356590Z",
            "url": "https://files.pythonhosted.org/packages/48/77/1c2aa0b51e37ebe0f0f1149942d7be408b13af6cdfbaf7834da9ef8596b8/threedigrid_builder-1.24.0-cp310-cp310-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "10078cac304df78f158930282df9efacd17c13c53def91e674bac0346135419c",
                "md5": "0ba4debb2a35c4041f952fd87c87050d",
                "sha256": "c9d2cf33e5791b910fb05a946fe4bf44ca5c731b5b504ef67e9a6e7c5988fb3d"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "0ba4debb2a35c4041f952fd87c87050d",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.9",
            "size": 1287353,
            "upload_time": "2025-01-24T06:53:51",
            "upload_time_iso_8601": "2025-01-24T06:53:51.414409Z",
            "url": "https://files.pythonhosted.org/packages/10/07/8cac304df78f158930282df9efacd17c13c53def91e674bac0346135419c/threedigrid_builder-1.24.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c970e516f6cabfb277d3ec46d386d341658d51660337640dd9295f57c7f2a388",
                "md5": "7ca1c60dca29026a7503ddd8483043d8",
                "sha256": "89d5f45315d94edaa26d6d5d0d7ee5e77d0aef01d6f2f0fad554ccfa5b7504c8"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "7ca1c60dca29026a7503ddd8483043d8",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.9",
            "size": 630386,
            "upload_time": "2025-01-24T06:53:53",
            "upload_time_iso_8601": "2025-01-24T06:53:53.075021Z",
            "url": "https://files.pythonhosted.org/packages/c9/70/e516f6cabfb277d3ec46d386d341658d51660337640dd9295f57c7f2a388/threedigrid_builder-1.24.0-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ebf4109c7e10fae45807a327476c2e682fe649f7445310360c3abf1844974822",
                "md5": "818d968cc893d61323e2aa0a97ef0640",
                "sha256": "5e18c61da20cad2eb7fbb320cc83bc5da99833cc2c27434878aea267cca7fd2f"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp311-cp311-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "818d968cc893d61323e2aa0a97ef0640",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.9",
            "size": 1612984,
            "upload_time": "2025-01-24T06:53:54",
            "upload_time_iso_8601": "2025-01-24T06:53:54.777518Z",
            "url": "https://files.pythonhosted.org/packages/eb/f4/109c7e10fae45807a327476c2e682fe649f7445310360c3abf1844974822/threedigrid_builder-1.24.0-cp311-cp311-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6dafd29eefc5fc466510aad2c3e5291fbcfbf23b7d4f6b034f562f78de4f6e19",
                "md5": "5ec893bc0ccbd372d135e661a6c41c14",
                "sha256": "8ecbeddbd624fb9dffb97676e3b94db921d68d943477bf462d03b7cdd63ab803"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "5ec893bc0ccbd372d135e661a6c41c14",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.9",
            "size": 1286393,
            "upload_time": "2025-01-24T06:53:57",
            "upload_time_iso_8601": "2025-01-24T06:53:57.192459Z",
            "url": "https://files.pythonhosted.org/packages/6d/af/d29eefc5fc466510aad2c3e5291fbcfbf23b7d4f6b034f562f78de4f6e19/threedigrid_builder-1.24.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0554e03e4302ec248af8f5b059f40392b4e3dd51d08d659a1301f38128cd438b",
                "md5": "1708cb445e77e393dc4caec251414190",
                "sha256": "3d343e59e9e125feb672679d4c3ca08acce86bf8009610d414904a41cbd0b114"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "1708cb445e77e393dc4caec251414190",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.9",
            "size": 628953,
            "upload_time": "2025-01-24T06:53:59",
            "upload_time_iso_8601": "2025-01-24T06:53:59.113306Z",
            "url": "https://files.pythonhosted.org/packages/05/54/e03e4302ec248af8f5b059f40392b4e3dd51d08d659a1301f38128cd438b/threedigrid_builder-1.24.0-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2c0e1e8db362c870ad2509bb630c90f9a644252a88bc7f63d0f12c4275f5bd2c",
                "md5": "2ffefb067029b25e7bf4eed6222952e7",
                "sha256": "570168235f76f4c17dc749aa95a11f55e439ca62f5dca9f89adb4272f5d6e719"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp312-cp312-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "2ffefb067029b25e7bf4eed6222952e7",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.9",
            "size": 1613341,
            "upload_time": "2025-01-24T06:54:00",
            "upload_time_iso_8601": "2025-01-24T06:54:00.585061Z",
            "url": "https://files.pythonhosted.org/packages/2c/0e/1e8db362c870ad2509bb630c90f9a644252a88bc7f63d0f12c4275f5bd2c/threedigrid_builder-1.24.0-cp312-cp312-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f754d6beb88bf21298c36a1fc86f622026b568c9d39d6380cfdb0f419f745194",
                "md5": "0f87453439e28a4df3643d2aea0ea853",
                "sha256": "e4fad6ddb127dc4b6557fd7fa88d15f1562b52a6de95ce047604191956b367a7"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "0f87453439e28a4df3643d2aea0ea853",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.9",
            "size": 1286402,
            "upload_time": "2025-01-24T06:54:02",
            "upload_time_iso_8601": "2025-01-24T06:54:02.379214Z",
            "url": "https://files.pythonhosted.org/packages/f7/54/d6beb88bf21298c36a1fc86f622026b568c9d39d6380cfdb0f419f745194/threedigrid_builder-1.24.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9deb4f373b92089dbb7e8772b1a80f3e850b9e98dc15805c82449d46424d73de",
                "md5": "fd3f8e06a2b99366ec64ec956fc2dfcf",
                "sha256": "dbf0a4909d7d77d34e1db51c5e5c3baa2408b9e92ef8539a5f8f7f669ed08e10"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp312-cp312-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "fd3f8e06a2b99366ec64ec956fc2dfcf",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.9",
            "size": 628936,
            "upload_time": "2025-01-24T06:54:03",
            "upload_time_iso_8601": "2025-01-24T06:54:03.998646Z",
            "url": "https://files.pythonhosted.org/packages/9d/eb/4f373b92089dbb7e8772b1a80f3e850b9e98dc15805c82449d46424d73de/threedigrid_builder-1.24.0-cp312-cp312-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "720ff3e3d64edd647bac80e36f4026324cb6a1a10178080b8fe8b73fc9f2411f",
                "md5": "719f28376f9b713533684aeea8a222c3",
                "sha256": "993754eee658232a9d1b92cdd780cf8f71e7eda9aad494cd7c135b9a65da6c19"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp39-cp39-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "719f28376f9b713533684aeea8a222c3",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.9",
            "size": 1611301,
            "upload_time": "2025-01-24T06:54:05",
            "upload_time_iso_8601": "2025-01-24T06:54:05.939605Z",
            "url": "https://files.pythonhosted.org/packages/72/0f/f3e3d64edd647bac80e36f4026324cb6a1a10178080b8fe8b73fc9f2411f/threedigrid_builder-1.24.0-cp39-cp39-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b778096789ce8b488efbedd889c0fb2c318f103cdfe0af38dad3aef67088ec5a",
                "md5": "219e256093976f0733b2575c640bbd44",
                "sha256": "cce345fa91c3d95e5c582e46f06f56755a6211c97d7348766eab95909d32b4f4"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "219e256093976f0733b2575c640bbd44",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.9",
            "size": 1286788,
            "upload_time": "2025-01-24T06:54:08",
            "upload_time_iso_8601": "2025-01-24T06:54:08.416832Z",
            "url": "https://files.pythonhosted.org/packages/b7/78/096789ce8b488efbedd889c0fb2c318f103cdfe0af38dad3aef67088ec5a/threedigrid_builder-1.24.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "31bf17962857bb5ccaab55837cba85dfa3d26bf94be1674582781dc4460fb0ca",
                "md5": "82d755e0b7c4868cee33d61d7e3b100f",
                "sha256": "5fa00e96623760fb3aebe25df51b3b878b317da750a40b97852f55ec546dff23"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "82d755e0b7c4868cee33d61d7e3b100f",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.9",
            "size": 630721,
            "upload_time": "2025-01-24T06:54:09",
            "upload_time_iso_8601": "2025-01-24T06:54:09.885724Z",
            "url": "https://files.pythonhosted.org/packages/31/bf/17962857bb5ccaab55837cba85dfa3d26bf94be1674582781dc4460fb0ca/threedigrid_builder-1.24.0-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7d875fe09c80722485ab9c79eeff2f6ddc318d12b7c0f42b5c1e0262756b56d4",
                "md5": "8e3f498157051a2ede2f891697ec9249",
                "sha256": "9e0e55f56956c02fa04f286ee94609a6383049ea08f0ded800212ffb72ec85fc"
            },
            "downloads": -1,
            "filename": "threedigrid_builder-1.24.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8e3f498157051a2ede2f891697ec9249",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 159126,
            "upload_time": "2025-01-24T06:54:12",
            "upload_time_iso_8601": "2025-01-24T06:54:12.392840Z",
            "url": "https://files.pythonhosted.org/packages/7d/87/5fe09c80722485ab9c79eeff2f6ddc318d12b7c0f42b5c1e0262756b56d4/threedigrid_builder-1.24.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-24 06:54:12",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "threedigrid-builder"
}
        
Elapsed time: 1.44866s