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.6.1 (2021-11-10)

  • Fixed l1dtot (exclude 1D boundaries).

0.6.0 (2021-11-09)

  • Raise SchematisationError on embedding linear objects that begin/end outside of 2D domain. Added tests for edge cases.

  • Fixed exchange_level (dpumax) for 1D2D lines attached to non-manhole connection nodes. The exchange_level is now derived from the bank_levels of attached channels.

  • Add discharge_coefficients for structures.

  • Swap the order in lines.line for 1D2D lines. The order is now (2D, 1D).

  • Fixed kcu for lines attached to 1D boundary conditions.

  • Copy crest_level from v2_levee if a v2_connected_point refers to one.

0.5.2 (2021-11-02)

  • Consistently write NaN (and not -9999.0) in gridadmin float datasets.

  • Fix tests with GEOS 3.10.0

  • Make ‘meta’ group complete.

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

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

Uploaded CPython 3.9 Windows x86-64

threedigrid_builder-0.6.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.6.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.6.1-cp38-cp38-win_amd64.whl (883.1 kB view details)

Uploaded CPython 3.8 Windows x86-64

threedigrid_builder-0.6.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.6.1-cp38-cp38-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

threedigrid_builder-0.6.1-cp37-cp37m-win_amd64.whl (881.5 kB view details)

Uploaded CPython 3.7m Windows x86-64

threedigrid_builder-0.6.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.6.1-cp37-cp37m-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

threedigrid_builder-0.6.1-cp36-cp36m-win_amd64.whl (881.5 kB view details)

Uploaded CPython 3.6m Windows x86-64

threedigrid_builder-0.6.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.6.1-cp36-cp36m-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: threedigrid_builder-0.6.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 864.4 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for threedigrid_builder-0.6.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f4efca16ddfc0852a0732ce0eb4f5c5687f4d48e6919337b99632aa8afe45a7b
MD5 986f9d3166094c47963ee99f17f4df44
BLAKE2b-256 833405f72cb75a004d950d7429ef2168fd0885a6f40d7a5c54bad9e2d5ae6631

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.6.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.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for threedigrid_builder-0.6.1-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 aeb2a47fbd7d2ff44237d2047cd10d5b9bae065e6a0ae0bbc2d255da0371018b
MD5 73a532f7da064a2e619feeb33bd6b204
BLAKE2b-256 27dc77b384e570d00a07dd8c778b62a9a264154eb3becc98fcdb594d8c40aff7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.6.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.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for threedigrid_builder-0.6.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ef53b47227217383524db46a124dca4acc7248d86c06b7779a452237f07a7855
MD5 4e46fb292b4bae774ba86998f7d86a4a
BLAKE2b-256 f3bd3399f57613b7269dcfb69f1a9ff4ebb103b5df0b53ad61c15bcdfc975774

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.6.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 883.1 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for threedigrid_builder-0.6.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e27d7d222f2b1c29740a3908fe61a555193a0cdedf518af748ca737c1480a8d3
MD5 3ce4e018ed55803afa8b8777fe982de2
BLAKE2b-256 5212588344f338b7382a1235e173a7636a5f309e21caa4b27f24f685fc79bba2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.6.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.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for threedigrid_builder-0.6.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b28301c67d065a840cc1ed01ef308d28e21517be6cd373eb0f95a03c06e356fb
MD5 a566ab2730106b250a1aef63a792b1e2
BLAKE2b-256 c3a87cbe06ea31772da02366d185a9030cf53db4b3d3c94734bedb4a0999efee

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for threedigrid_builder-0.6.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f350fc479f5a99cf66c7289ccf7ac48a123487b0919cf12aaa104b014497a04a
MD5 e4fc97a19387768b2e5e9d49b9c51203
BLAKE2b-256 785d4651b1408ffca486b9c7bf59dc96b2c6ec73744225daee1020f7cdf429a1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for threedigrid_builder-0.6.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 ed5211366428db3c0cd094d81f7091a3f81f2228d8bfe8e547fe15ab340a9959
MD5 c73b5ec3af540a96470ccf35f1271559
BLAKE2b-256 000574f79e307e2151ed02825d4cfca42600fb59349f9786806ae4758024f879

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.6.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.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for threedigrid_builder-0.6.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 df3324ee1e4e2f086072fa5dbcdb29f44f3dcd79fa2f03cadada6d9d97a43c94
MD5 cd4d2f3e6e87395a090c596a8e87ad85
BLAKE2b-256 3e498617c4e3a29e2cbbc8e55a93a78de3b4faced169998843f5bb39014aa5d9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for threedigrid_builder-0.6.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 eee0213cdf5704aba13d7d5f39b37553bd87901645592d295f0771bc5f42f458
MD5 ca06b921dbdc67f98a0c4bc77130cd04
BLAKE2b-256 39946e852565816b2199934735cb54ea7a9e21399d5192027d84a018c1d0f235

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for threedigrid_builder-0.6.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 700a8434d80928a1e80dfdffc8003bb2174e9aeffe05e35425149544bb0e2726
MD5 c3c32f429f5a36c7e1f60ed703ecfde3
BLAKE2b-256 1c38cd4fbd746cd5e440dfc08fedb5e0843902443de1e80a386aca03cabf6e05

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.6.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.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for threedigrid_builder-0.6.1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a51ac4f37ef7c7192dfff46042372caba5a34f9663c549050bd25e5e2a5b26ee
MD5 346add3bc6f1d4bd701422fb9dc49cdd
BLAKE2b-256 d1ea7e3020365a88ae4de31e26043938d24d021ece7a562fbbbaebb14eb7e82d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for threedigrid_builder-0.6.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c7afb67055100fa77539e49d065aa776d2376fb5329dca0554f3509106bce3cd
MD5 2e21721d650b8fc79a2aae47618a81dd
BLAKE2b-256 b2cc340121d461815c63175a3c5b0041af863f223e1ec5c0ea5c425bc03d18b1

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