Skip to main content

Generate a 3Di simulation grid from a model schematisation.

Project description

threedigrid-builder

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_grid
>>> sqlite_path = "/path/to/model.sqlite"
>>> dem_path = "/path/to/dem.tiff"
>>> out_path = "grid.gpkg"  # or "something.h5" for HDF5 output
>>> make_grid(sqlite_path, dem_path, out_path)

Installation

This package is distributed as binary only, because its (Fortran) source code is proprietary. 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

Then install the threedigrid-builder:

$ pip install threedigrid-builder[rasters]

For output into a file for the 3Di calculationcore, enable gridadmin output:

$ pip install threedigrid-builder[rasters,gridadmin]

For output into Geopackage for display in e.g. QGis, enable gpkg output:

$ pip install threedigrid-builder[rasters,gpkg]

Changelog of threedigrid-builder

0.4.0 (2021-09-23)

  • Added 1D boundary conditions.

  • Added 2D boundary conditions.

  • Enable compression in HDF5 output.

  • Fixed 2D lines that connect a larger to a smaller cell in south east direction.

0.3.1 (2021-08-16)

  • Handle embedded connection nodes. These are removed from the grid and written to a new dataset “nodes_embedded”.

  • Fixed bug with cross sections tables being None in Grid instance

  • Handle embedded channels, pipes and culverts. Embedded objects result in embedded nodes and and lines with kcu LINE_1D_EMBEDDED between between 2D cells.

  • Fixed a bug with lines that connect nodes to themselves in quadtree generation.

  • Fixed a bug with wrong usage of lines.ds1d in bottom level and cross section weights computation. The added attribute lines.s1d is now used, and for clarity nodes.ds1d was renamed to nodes.s1d.

  • Added invert_level_start_point and invert_level_end_point attributes to lines.

  • Fixed coordinate order in lines.line_geometries field in gridadmin.h5.

0.3.0 (2021-07-28)

  • Read and convert cross section definitions.

  • Solve gridadmin off-by-one errors for pumps.

  • Add ‘dmax’ to nodes output.

  • Changed external API function name to “make_gridadmin”.

0.2.1 (2021-07-20)

  • Fixed issue when reprojecting 0 grid refinements with pyproj 2.*

  • Fixed issue when writing 0 pumps with h5py 2.*

  • Fixed missing transpose when writing pumps.coordinates to HDF5.

  • Added obstacles.

0.2.0 (2021-07-15)

  • Added threedigrid_builder.grid.geo_utils with segmentize and line_substring functions. These are used to compute the Lines.line_geometries for channel lines.

  • Fixed a bug in the refinement areas code (Fortran) on Ubuntu 20.04.

  • Added the Pipes model that is able to compute Nodes & Lines from Pipes. Pipes are also included in the calculation_type and bottom_level computations.

  • Added 1D-2D lines for connection nodes, manholes, and channels.

  • Added culverts, orifices, and weirs.

  • Added pumps (pumpstations).

  • Settings and metadata are read from the SQLite. Some metadata (like model_slug) can also be provided via the main (make_grid) function. The metadata is written to the root ‘attrs’ of the output gridadmin.h5. The settings are written into datasets inside newly addres groups “grid_settings” and “tables_settings”.

  • Fixes for models with no channels.

  • Add an optional progress callback.

0.1.2 (2021-04-28)

  • Added public API with 1 function: threedigrid_builder.make_grid.

0.1.1 (2021-04-20)

  • Fixed automatic PyPI upload.

0.1.0 (2021-04-20)

  • Partially ported functionality from inpy (generate 3di files, makegrid): 1D channel grid (including calculation_type and bottom_level), and 2D open water grid.

  • Added gridadmin and geopackage output.

  • Breaking change: the interpolation between cross section locations (channels) now also extrapolates for lines and nodes that are not in between two connection nodes. This happens only if the channel has at least 2 cross section locations. When extrapolatic, the line.cross_weight is less than 0 or greater than 1.

  • Breaking change: missing or empty values in float datasets in the output gridadmin are now denoted by NaN (not-a-number) instead of -9999.0.

  • Breaking change: integers in the output gridadmin are now always 32-bit (instead of sometimes 32-bit and sometimes 64-bit).

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

threedigrid_builder-0.4.0-cp39-cp39-win_amd64.whl (851.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

threedigrid_builder-0.4.0-cp39-cp39-manylinux2010_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

threedigrid_builder-0.4.0-cp39-cp39-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

threedigrid_builder-0.4.0-cp38-cp38-win_amd64.whl (870.6 kB view details)

Uploaded CPython 3.8 Windows x86-64

threedigrid_builder-0.4.0-cp38-cp38-manylinux2010_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

threedigrid_builder-0.4.0-cp38-cp38-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

threedigrid_builder-0.4.0-cp37-cp37m-win_amd64.whl (869.0 kB view details)

Uploaded CPython 3.7m Windows x86-64

threedigrid_builder-0.4.0-cp37-cp37m-manylinux2010_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

threedigrid_builder-0.4.0-cp37-cp37m-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

threedigrid_builder-0.4.0-cp36-cp36m-win_amd64.whl (869.0 kB view details)

Uploaded CPython 3.6m Windows x86-64

threedigrid_builder-0.4.0-cp36-cp36m-manylinux2010_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

threedigrid_builder-0.4.0-cp36-cp36m-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 851.9 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4515e25940b41075876c80bf87e076249c5ba3cf334b1e6e18a430d3f321b264
MD5 c1cf463872b463c1a8f7e649a247ff98
BLAKE2b-256 7f4d68c0fa528779f9f329fa9e06d47c5ed661b200b6969da28993c2c4d75d80

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.4.0-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 27e68397f6f90a70683a9c5f8a0e078800e67d68492eaa4ba9b01e689696ebb1
MD5 9beee7914afbf4f776f60c1028d916ea
BLAKE2b-256 c75770f08ca9897c157a6766742d997121d31267913cb21d32fe6f4cf39d2d0c

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.4.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ce548890f7c08adac896a43335831af41aa6af3f89f0409a0e659fccd7ac50c6
MD5 5d85d28380cb7a1923ef5ce8409f2b38
BLAKE2b-256 88c7e546c5d9bc5eb3d893df29383ef52cbe8f49837bbf2464e3313a01d37a0a

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.4.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 870.6 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 340da3e9d73aabada2368432075e1effc1a4bf3f2e15bb6895af89822fbfe70f
MD5 405d0e15d46c9be85d8975a1bcbb7f27
BLAKE2b-256 85e17cf84f91593ce524d8e431a3949df4f678ca89f228365006fb304a18f9b8

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.4.0-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 35ade1b4819244f6562496cd1a186fbd300f6bcde2fb6c260dfe467d6df614f4
MD5 9bb8f744b1449c5dab5a1ca32a25e94f
BLAKE2b-256 bf930d8c3eb45be6c42d236574a8a3762be4ade6f1a13d0a981685273f095ff7

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.4.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3831b480326c48954e0c448422efd2dc1cd7a35781184be65c3436c306bc4f73
MD5 67002d6c5085489e73b932061bec6418
BLAKE2b-256 c8bb6c903437f75446ef215c09d426c5800ba4bc27fcac00bc53e59ebf5f538b

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.4.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 869.0 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 8e6dca7ff41475531a68e7c893894fb461bd35dedd35e987bb831563095ead4f
MD5 05e4807235015b7aba7e59b0acd0a2d7
BLAKE2b-256 07a72701567c9ed4d03315c76ec3eb08c090dcfd1309b40b5284dca4c4f4c75f

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.4.0-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 93b145ba0c9bdc8ab95e31a7566d31eb2ef7301a71da1b7f81e453bad4f7f781
MD5 9c5b4afbc804e43b49c472ad73f11ca4
BLAKE2b-256 6a55d4c6c5f9981ee25969d1e7150dde968c522faaf279eff877ebda5cb5e3ae

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.4.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 89252ab950eb69c6d9a94943f5327fcb0d68448dba976cb4a9f6fd2c33b96d74
MD5 b88b19d1e99cdaaae5f580fa3ef8fe75
BLAKE2b-256 992becb05df82b4041514a6c18e619aff5b9fa9944010f72e4d0ac3420ee74de

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.4.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 869.0 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 7327922689300babb9ceac4ba46f7955a6510c3d1a5bcf480ee7a4a9d0d005ab
MD5 716a1a882ef51726f59a2364a3d8f1fe
BLAKE2b-256 7e1936f3fe1d1e1f1ea32dab11d8647463da907e3d2b959a0c3d6091f18e4d32

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.4.0-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 407160e89b535b641afc2b80ce65ea6762da5aa8bf7bddb95d790378845445b7
MD5 e778006b770f0ddbf2476e40d67412c4
BLAKE2b-256 3bd9a96cfccea1c9b2aa4ea4971e468660ed3b4c4732b7c03ea25b89d2f91b32

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.4.0-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.4.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for threedigrid_builder-0.4.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d097c4aed1b9e23365124224ae0313e0c388c5ae9825dd2e7a933de19a6fca5c
MD5 5f7709c9e73b69e5729da410e8ded373
BLAKE2b-256 ce87c0979d63ff12367bae1e86d74e42ba2d52b391db1ec4ee68ad72fed703f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page