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

Uploaded CPython 3.9 Windows x86-64

threedigrid_builder-0.5.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.5.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.5.0-cp38-cp38-win_amd64.whl (880.7 kB view details)

Uploaded CPython 3.8 Windows x86-64

threedigrid_builder-0.5.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.5.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.5.0-cp37-cp37m-win_amd64.whl (879.0 kB view details)

Uploaded CPython 3.7m Windows x86-64

threedigrid_builder-0.5.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.5.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.5.0-cp36-cp36m-win_amd64.whl (879.0 kB view details)

Uploaded CPython 3.6m Windows x86-64

threedigrid_builder-0.5.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.5.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.5.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: threedigrid_builder-0.5.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 862.0 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.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d403a27c7ffb2a5788ea4bd6c347a31a978e9422a8209a033e971e4b99d7b98c
MD5 bb764a247a9edce6d5e95cc3b1c05dbf
BLAKE2b-256 ee3ee3a69f883f39415b9bd01b7d38d8e1fe56ce1ff9c3eededadebb83b7e769

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.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.5.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6bfc3367f6200326d37c8d0e13ce22436534e81a6a4255430054c569416e021d
MD5 dacd780f6d83ab16fa76ba274531d3eb
BLAKE2b-256 2b6591fe7d6a7de0b1edc8a68f9a5a65405f6cdb9669deef4edfc80a8c888e56

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.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.5.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 415435e92a02171147af732fab5661fc9f7278f24dcdc54b654b682df3fb60c0
MD5 9e29b794b01256b6da435f081e0a2a62
BLAKE2b-256 c673369adb7b4bf06fa1d3147f39b59457aae0ab8d61185cc3f855af292ff9a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 880.7 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.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 80cac87f53feb22d8d9ff2de5903ad0d6b8dc278510e446899a9bd0237dae4bb
MD5 8281b4583afa7cb3779359cc1f976adb
BLAKE2b-256 a73725682a3e8c09638428140a613baa877bbcc71731e539ee7c4afd771d29b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.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.5.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 bfaf0383c36c16fec6b9d2a2dbc0c582d6144ceb6b16b5b57df382d6a9b675a8
MD5 4675603510728fc9b681eecd99669aa1
BLAKE2b-256 0b95da272ff15d28697f741341c338dbf3b5289032088bd1091cbf186d02db5f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.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.5.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d53807257e80383db2c6b57eef3ba3dd353b8728bd53da13317b10ea30c22c48
MD5 3dcfeb43d466e1b1a2fdfc96584c816a
BLAKE2b-256 27d3d9fbbc2b80497596ed9b360155a2ffc07aca0dbef156dd32a3f086df41c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 879.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.5.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 41fed025578a74ab02effe0783e2224013ac7754071dc9c794c43e19f2e0d716
MD5 22fe94ebd1b47e7c8607dbaaa0b46fd6
BLAKE2b-256 d5af5de2612c89b2b0230dc7ed8063ae5465cf32dd67ff6b95f8dc0481448eb6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.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.5.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 cf4a31fd0c1f2fc5a02bc408c3a1794d1480544d93054b26b44558304766b5f9
MD5 538ea959365a0d2bc6f691edb8864b8d
BLAKE2b-256 51a789213272717572dc8c83cc676e2f70921a5990511f2872deb66e2be8584c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.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.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 513091b1d6810f62fb5db93da3e881e7972b52155ca5ac7439c3c242d83253c1
MD5 f3f2e2ec1991383a82b9a4fed4b90913
BLAKE2b-256 041fa867f8402c62d42b76e69331fbb33508b93adcaed8f81ebc604154169c19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 879.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.5.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 9c53500d124a610fe2841284155e2b97327cbddbbf564db9741698493652ed87
MD5 2ffff0329cdca8a2291bb078efb428e9
BLAKE2b-256 925b3dce51e02bddd713f8627ab04d8f2285a84e946524b81940a5f3d80722bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.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.5.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 044ef4b3f45b7089c3b04aa857c083da12220344f5481d6f77d6d9fb5589ef6e
MD5 caa792b21b25560336b63f096885a28e
BLAKE2b-256 4632dddc58e9bd9f0ad2dabcf523bc66a55064f7e051fda8dd5fce976c95bfdf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.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.5.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a02c96b3322894de2ab1c56441d70b48d90ae61ee98865f27e1d9b3ae23ca102
MD5 c5765e1de0027335ab7eccf020008c63
BLAKE2b-256 895cc18c997d76a92ab430e8d6dc59505acf8342414cfde56840967e0e9b5202

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