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 only currently supported platform is Linux.

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

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]

Changelog of threedigrid-builder

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

File details

Details for the file threedigrid_builder-0.3.1-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.3.1-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for threedigrid_builder-0.3.1-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9313aad223d90a81208d14d3464af8a8da42bf4d8eb51242854100dd4fd72f9e
MD5 a1ddf645edb02a053631f67a8a348ca3
BLAKE2b-256 30c2d62d316c5d8a4bbc4b4cbb69aac5dc40c1a22cab75083a75c0cdbd70be6f

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.3.1-cp39-cp39-manylinux1_i686.whl.

File metadata

  • Download URL: threedigrid_builder-0.3.1-cp39-cp39-manylinux1_i686.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for threedigrid_builder-0.3.1-cp39-cp39-manylinux1_i686.whl
Algorithm Hash digest
SHA256 2d04fb32223d0f24a09a8dafe9f2624682ed896d7dbd0f4c0f14c34038f56dfc
MD5 d3cad27f9017e795589d7f747146f298
BLAKE2b-256 fba71ac5d9a2a9fda4b089d011554e5df7354c885abdf23d6f0b5466ebe819ce

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.3.1-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.3.1-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for threedigrid_builder-0.3.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a81d23e382cb653f47403510adc3d465de9127c3a9c73e614a524144010eed32
MD5 57f3bc7f534d6696c36ef45548f4a770
BLAKE2b-256 d53b28198969dc2690d59ac1bcf7e6dc7cc039a1ec81133e57b5776db5ea48bf

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.3.1-cp38-cp38-manylinux1_i686.whl.

File metadata

  • Download URL: threedigrid_builder-0.3.1-cp38-cp38-manylinux1_i686.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for threedigrid_builder-0.3.1-cp38-cp38-manylinux1_i686.whl
Algorithm Hash digest
SHA256 32388dfcb7a2356cd8717d32c328bb3664c8804ce8b09fe053824d07b242f9cc
MD5 04d2bdc92a1198c68c3efa6d238754a5
BLAKE2b-256 c9d9a41c1fb41b5d9643bc25421b35aec21b4404513f7d8439bded8d3ab69a24

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.3.1-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.3.1-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for threedigrid_builder-0.3.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 01002b9476142b3f98cc64e3ebb09bb8b48e280c66b5f71f8ec3dd5ae29ff3ba
MD5 300839f02befe81856956f811fdf078d
BLAKE2b-256 7d0dbe4e73ba37e7986250f4bb3ac40d784ee6fcfda68bbd3f0d4437d7937ea9

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.3.1-cp37-cp37m-manylinux1_i686.whl.

File metadata

  • Download URL: threedigrid_builder-0.3.1-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for threedigrid_builder-0.3.1-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 9ead33c584a65d8e1121296d29811a84915c2d1d9aff085ce14c111ba0cb00dd
MD5 72d3c5365fc39ce13a987b7a9b4ed8aa
BLAKE2b-256 aa7b4a628044ec2a7b11e06fc8cccb1b395fe4f0e8f3c233e34803d4cb040f1e

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.3.1-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: threedigrid_builder-0.3.1-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for threedigrid_builder-0.3.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6392e5d7f4925312c7682bff09387c26546bc1caae86489f25ea39cd3ea54143
MD5 b9773d281eb574f08bd92b00ceb1ff66
BLAKE2b-256 6dfd7d96d5b617306a15a745fd5fd6ab62dac0b94cc08b53bfe54e243f9e5650

See more details on using hashes here.

File details

Details for the file threedigrid_builder-0.3.1-cp36-cp36m-manylinux1_i686.whl.

File metadata

  • Download URL: threedigrid_builder-0.3.1-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for threedigrid_builder-0.3.1-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 825b96d097fc4a26aebd7ee25959eb6ae9a89dca383e5cfede80c27b6a3be757
MD5 df9b21b40f6861f47817754ec4dcab1a
BLAKE2b-256 f1705831cb828027fda966ef2fb56d36e2189868052ee1a7a6de7e4edccc4af4

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