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.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

This version

0.5.2

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

Uploaded CPython 3.9 Windows x86-64

threedigrid_builder-0.5.2-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.2-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.2-cp38-cp38-win_amd64.whl (881.4 kB view details)

Uploaded CPython 3.8 Windows x86-64

threedigrid_builder-0.5.2-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.2-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.2-cp37-cp37m-win_amd64.whl (879.7 kB view details)

Uploaded CPython 3.7m Windows x86-64

threedigrid_builder-0.5.2-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.2-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.5.2-cp36-cp36m-win_amd64.whl (879.7 kB view details)

Uploaded CPython 3.6m Windows x86-64

threedigrid_builder-0.5.2-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.2-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.5.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: threedigrid_builder-0.5.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 862.7 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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2daa8e19a7bdc8c9974f5fe62737071db3d2dd6dbbd3a98ca78a55c050fc14cf
MD5 912f545ddd5fdba63e8367c6dc271adf
BLAKE2b-256 029694208e190b9415abb8e22427b4a4f3c6f8a26ded4ff70f2adba28446cc84

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.2-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.2-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 107a318626fb66a21187a075d3d46844054ed49275e460fe696055eda21457fb
MD5 a6c5332c2546d554fb06ddd19373b4c8
BLAKE2b-256 ccff8054ac965ad9dea556fdc296cf67a27fc918056334f834269d1e4941af43

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.2-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.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b0f4644020024f84978c6645a37907d09729daf5a5c67d8aa6a15192cc060eb1
MD5 01d5ee50d4d84f2ba595a8df9dd79d55
BLAKE2b-256 0fac8bc4b663dadcd1950f34080a71fc5d994bda77b4f89e4163dd4342591221

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 881.4 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.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e4dd6703c56da0b7a0b7e9fae5f798b5f597708e830d532e48bece7fbfc7d1e0
MD5 e21b5dfe2a1e5bcece42acd66305af3e
BLAKE2b-256 aaa9070c52b78da1763c6b139e644d10c32616f8bca60fcbb5c5f3d12f8b80a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.2-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.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 9fb115fb0a80f7ecc702f5813238a6efa80a5f712df84179e7231e542f4dddd0
MD5 7fef91d209bc282016d7e34d285f8940
BLAKE2b-256 02fa74864dd4bc4ade117594be70c562a4a762615b76c2bbaa285986a0b5c7ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.2-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.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1170125e20996ddf8ed1eb92a10fe98601ceb53a37d265b2a3964cf92d0a58ea
MD5 48fcd39c905141a663f84fedd31534b4
BLAKE2b-256 580fa56174f423764bf9540c0d032912275f48a67605426c64bb43839fbe7702

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 879.7 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.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 20aebbc18081a32951b8959595056c983fdd5619a8651e3db66be126827f96e6
MD5 4c1aa0eba79ff916a30308a26e0f82e1
BLAKE2b-256 4c2969625910275450806528965178afc4eabaa5737c1b6ca02ca9374ddf46db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.2-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.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f598c4be44822edabc6634ddb63b88d77dcc91174299648104d92643e8909aed
MD5 bbaffed3c4525ef21452b9aebaf5b0b9
BLAKE2b-256 8a2135c20adba47cc0b79d8bd817e0b03ae6fe99c939576c8f77d0adcbae879f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.2-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.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.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 898abd7e01f75399e1b57338176f0b90f767196277fd8b70e13519ee0099b686
MD5 bc5dd34924b7e1a87028719dbeaaba98
BLAKE2b-256 168b4651dcaf52340ad45dd4e6af8c958c97aa2b8b27952b225ceea2aefa9e72

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 879.7 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.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 cff01f2e8f7e0c7b917b531de829507944e05e0312a88cf8c05a0a116102cb01
MD5 4208e73436ffa9745a414cb62d1032d0
BLAKE2b-256 473825ff4b9d3c5ad3e16357f71af44bc0f41674e40e08f81881341bc95ce9d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.2-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.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 5f5ae7aa81f6a86b3f9769b15cac85016bc33d9d15f6f93a6c26a47a81d5ec37
MD5 91352d7418ae8c82d0bc1299ad6b0bef
BLAKE2b-256 aea6266f96ec9f716b0a76d00c7c71fd045bc1990be95ff976f192be813f0aec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threedigrid_builder-0.5.2-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.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.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f77175e75b9f9c0977bcd430bab2727f51f79198859babd3f889b2d8ddf80a95
MD5 fd74a58b8b18b8115da4ee73e8bc0469
BLAKE2b-256 dc09d6e4bffcd28da854905b4b6da95e49a1f4491e4e07ba272e40397ff72f4f

See more details on using hashes here.

Supported by

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