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.5.1 (2021-11-01)

  • Add storage_area to calculation nodes.

  • Added ds1d_half to nodes.

  • Added has_embedded to attrs.

0.5.0 (2021-10-21)

  • Fixed nodes.is_manhole in the gridadmin output.

  • Handle user-supplied 1D-2D lines (connected point / calculation point).

  • Write initial_waterlevel for 1D nodes and add ‘has_initial_waterlevels’ to meta.

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

This version

0.5.1

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.5.1-cp39-cp39-win_amd64.whl (862.3 kB view details)

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

threedigrid_builder-0.5.1-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.5.1-cp38-cp38-win_amd64.whl (881.0 kB view details)

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

threedigrid_builder-0.5.1-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.5.1-cp37-cp37m-win_amd64.whl (879.3 kB view details)

Uploaded CPython 3.7m Windows x86-64

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

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

threedigrid_builder-0.5.1-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.5.1-cp36-cp36m-win_amd64.whl (879.4 kB view details)

Uploaded CPython 3.6m Windows x86-64

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

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

threedigrid_builder-0.5.1-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.5.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: threedigrid_builder-0.5.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 862.3 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.5.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2f4fba484f991e00bba3e06fe359813a4ae640cb15140ad6f8516c77972b4b97
MD5 4249480780a1fbc4f1368693bedfdb53
BLAKE2b-256 13c43dd92607dbc37578b8d018cda628a0327590423cbb279c44db2c570189a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.1-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.5.1-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e5037b816bd5ebeb93487f8b79c2caf74f03979e176e296e78abd1326c47567c
MD5 1009a9888cd69dadf1379f5f33d4cb5c
BLAKE2b-256 87b718cf6d1625102d4753e63c082737dc463f823bad788f4042e5ff5c9809b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.1-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.5.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 91619fdcf420ef0bb4ce78bff58cd2bc93053e045a004fb9bd0383f5e189797b
MD5 210ad6f73d2dcb90d47d4446908459d4
BLAKE2b-256 b9661aadabd18d670755a2c598373126ca93287d23e11430171e73bc1a6e41d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 881.0 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.5.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 653c3164766aad1f0833ba162ebd89c0c6b26b69920eff0a440097f87c5b58b3
MD5 855a108dd7ede41b1f7a90d3fc235189
BLAKE2b-256 ee731d2bc9b466311789db3d651e855a0f143b7c44706648da9705516ca45bba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.1-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.5.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d06c4c45db63bc84396d7634354335d4b6664693686859a59ad8cb3961a94f3f
MD5 b5c0445ed35a8be2eb21912465b605b8
BLAKE2b-256 543e3a8c7c31c5be5fc952da5d4c2a86ab9f1043a8d1b3ef1904697ce4272518

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.1-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.5.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fd35b5edf4a32491533f6e48a6bab073756ed8de083b5466c33e09ac8f4a688b
MD5 158a774889bb5cf1229ac034ac9a2f2b
BLAKE2b-256 27daadfc3c91d527ebb49b8b20cce1ceb0ae9471b2acc7bfcb5f8d4032e10ac6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 879.3 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.5.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 bab334d1014c6df6ee54a28b9f63aacb38509d5cbbb7769eaaa840b119fbc4ba
MD5 0b2760dc48debf1621ced1632034fd79
BLAKE2b-256 5645ff0cd60313dc68ee0e220c4c9f4d6cdb79e82f9c42db709d9eed925ca15b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.1-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.5.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 9ea17bba725d0fd0696ab0a6bff7ed2be8c932aa06d805a93cf2c782cada81a4
MD5 19bdf32cdc70c465b85a707e02f70884
BLAKE2b-256 65c7e91eb4289e2329f705e86a7558e8f89828d3ee40cdec53165cd3e9e69903

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.1-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.5.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8e0bdb040b7ce66aa07cdc3a1d322d1e05adc8158e082b3dab1e3bdf493f6089
MD5 2f2ec8df0488a2a75e80e8c8302e7a63
BLAKE2b-256 0c2929e6d5110a0c474443e7a118b66f3617c0af1ad07e115f61ee2279d2efea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 879.4 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.5.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 fa6675ffe8b324c5b0efa4467193f126c834e3524b9210f1238e25e0802d8d69
MD5 b15c487cff0e4a5083799b2c8b57452e
BLAKE2b-256 bdc01bad9ad47f46c59491a129b4598479329bfaf6b14c0999cf323c41be51a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.1-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.5.1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 bb3a3efa407a4f1968e560fbe7e7f6ccbb9854fa53ffcc791605cc469d49d68d
MD5 9c526353ce396711f9baa8407eaf5b27
BLAKE2b-256 7df4030b464a89888392cfea2b7c16b033ba861da032aa7b193b86592432fb2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.1-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.5.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 434ac4295ab93727b9fb46557ff61d96a236977e2b0927260f139567d03e758f
MD5 6c0aff63c66279545937d3057f46ea98
BLAKE2b-256 cd1d8a1f18f8090e72886f8b751e3ba8dc6ef4a941cc3bfed38ee16fe52b4c29

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