Skip to main content

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

Metadata

Release files for threedigrid-builder 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for threedigrid-builder 0.5.0
File
threedigrid_builder-0.5.0-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
threedigrid_builder-0.5.0-cp39-cp39-manylinux2010_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.12+ x86-64 Details
threedigrid_builder-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details
threedigrid_builder-0.5.0-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
threedigrid_builder-0.5.0-cp38-cp38-manylinux2010_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.12+ x86-64 Details
threedigrid_builder-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details
threedigrid_builder-0.5.0-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
threedigrid_builder-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 Details
threedigrid_builder-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 Details
threedigrid_builder-0.5.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
threedigrid_builder-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64 Details
threedigrid_builder-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ x86-64 Details

Total release size: 17.9 MB

Release files / threedigrid_builder-0.5.0-cp39-cp39-win_amd64.whl

Download URL threedigrid_builder-0.5.0-cp39-cp39-win_amd64.whl
Size 862.0 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
d403a27c7ffb2a5788ea4bd6c347a31a978e9422a8209a033e971e4b99d7b98c
BLAKE2b-256 checksum
How to use checksums
ee3ee3a69f883f39415b9bd01b7d38d8e1fe56ce1ff9c3eededadebb83b7e769
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / threedigrid_builder-0.5.0-cp39-cp39-manylinux2010_x86_64.whl

Download URL threedigrid_builder-0.5.0-cp39-cp39-manylinux2010_x86_64.whl
Size 2.0 MB
Tags CPython 3.9 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
6bfc3367f6200326d37c8d0e13ce22436534e81a6a4255430054c569416e021d
BLAKE2b-256 checksum
How to use checksums
2b6591fe7d6a7de0b1edc8a68f9a5a65405f6cdb9669deef4edfc80a8c888e56
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / threedigrid_builder-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl

Download URL threedigrid_builder-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl
Size 1.6 MB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
415435e92a02171147af732fab5661fc9f7278f24dcdc54b654b682df3fb60c0
BLAKE2b-256 checksum
How to use checksums
c673369adb7b4bf06fa1d3147f39b59457aae0ab8d61185cc3f855af292ff9a4
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / threedigrid_builder-0.5.0-cp38-cp38-win_amd64.whl

Download URL threedigrid_builder-0.5.0-cp38-cp38-win_amd64.whl
Size 880.7 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
80cac87f53feb22d8d9ff2de5903ad0d6b8dc278510e446899a9bd0237dae4bb
BLAKE2b-256 checksum
How to use checksums
a73725682a3e8c09638428140a613baa877bbcc71731e539ee7c4afd771d29b7
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / threedigrid_builder-0.5.0-cp38-cp38-manylinux2010_x86_64.whl

Download URL threedigrid_builder-0.5.0-cp38-cp38-manylinux2010_x86_64.whl
Size 2.0 MB
Tags CPython 3.8 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
bfaf0383c36c16fec6b9d2a2dbc0c582d6144ceb6b16b5b57df382d6a9b675a8
BLAKE2b-256 checksum
How to use checksums
0b95da272ff15d28697f741341c338dbf3b5289032088bd1091cbf186d02db5f
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / threedigrid_builder-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl

Download URL threedigrid_builder-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl
Size 1.6 MB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
d53807257e80383db2c6b57eef3ba3dd353b8728bd53da13317b10ea30c22c48
BLAKE2b-256 checksum
How to use checksums
27d3d9fbbc2b80497596ed9b360155a2ffc07aca0dbef156dd32a3f086df41c1
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / threedigrid_builder-0.5.0-cp37-cp37m-win_amd64.whl

Download URL threedigrid_builder-0.5.0-cp37-cp37m-win_amd64.whl
Size 879.0 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
41fed025578a74ab02effe0783e2224013ac7754071dc9c794c43e19f2e0d716
BLAKE2b-256 checksum
How to use checksums
d5af5de2612c89b2b0230dc7ed8063ae5465cf32dd67ff6b95f8dc0481448eb6
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / threedigrid_builder-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl

Download URL threedigrid_builder-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl
Size 1.9 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
cf4a31fd0c1f2fc5a02bc408c3a1794d1480544d93054b26b44558304766b5f9
BLAKE2b-256 checksum
How to use checksums
51a789213272717572dc8c83cc676e2f70921a5990511f2872deb66e2be8584c
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / threedigrid_builder-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl

Download URL threedigrid_builder-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
Size 1.6 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
513091b1d6810f62fb5db93da3e881e7972b52155ca5ac7439c3c242d83253c1
BLAKE2b-256 checksum
How to use checksums
041fa867f8402c62d42b76e69331fbb33508b93adcaed8f81ebc604154169c19
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / threedigrid_builder-0.5.0-cp36-cp36m-win_amd64.whl

Download URL threedigrid_builder-0.5.0-cp36-cp36m-win_amd64.whl
Size 879.0 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
9c53500d124a610fe2841284155e2b97327cbddbbf564db9741698493652ed87
BLAKE2b-256 checksum
How to use checksums
925b3dce51e02bddd713f8627ab04d8f2285a84e946524b81940a5f3d80722bb
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / threedigrid_builder-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl

Download URL threedigrid_builder-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl
Size 1.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
044ef4b3f45b7089c3b04aa857c083da12220344f5481d6f77d6d9fb5589ef6e
BLAKE2b-256 checksum
How to use checksums
4632dddc58e9bd9f0ad2dabcf523bc66a55064f7e051fda8dd5fce976c95bfdf
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / threedigrid_builder-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl

Download URL threedigrid_builder-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl
Size 1.6 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
a02c96b3322894de2ab1c56441d70b48d90ae61ee98865f27e1d9b3ae23ca102
BLAKE2b-256 checksum
How to use checksums
895cc18c997d76a92ab430e8d6dc59505acf8342414cfde56840967e0e9b5202
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

1.8.0

13 release files

1.7.1

13 release files

1.7.0

13 release files

1.5.0

13 release files

1.4.0

13 release files

1.3.5

12 release files

1.3.4

12 release files

1.3.3

12 release files

1.2.1

12 release files

1.2.0

12 release files

1.1.0

12 release files

1.0.2

12 release files

1.0.1

12 release files

1.0.0

12 release files

0.9.2

12 release files

0.9.1

12 release files

0.9.0

12 release files

0.8.0

12 release files

0.7.0

12 release files

0.6.1

12 release files

This release

0.5.0 This release

12 release files

0.4.0

12 release files

0.3.1

8 release files

0.3.0

8 release files

0.2.1

8 release files

0.2.0

8 release files

0.1.2

8 release files

0.1.1

8 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page