Generate curvilinear mesh from river outline polygons
Project description
CurviRiver: Curvilinear Mesh Generator for Rivers
Features
CurviRiver takes as input a Polygon of a river segment and generates a 2D or 3D curvilinear mesh that can be used for hydrodynamic or hydrological modeling. The mesh is generated in three main steps:
Determining the centerline of the input Polygon using Voroni diagram Dijkstra’s algorithm,
Smoothing the generated centerline with a B-spline curve,
Computing the tangent angles of the centerline at each point along the centerline and generating cross-sections perpendicular to the centerline at given intervals,
Generating a 2D mesh from vertices of the cross-sections,
Generating a 3D mesh if depth data is provided, by determining the depth of 2D mesh vertices from the depth data using Inverse Distance Weighting (IDW).
Installation
You can install CurviRiver using pip:
$ pip install curviriver
or using conda (mamba):
$ conda install -c conda-forge curviriver
Quick start
We demonstrate capabilities of CurviRiver by generating a curvilinear mesh along a portion of the Columbia River and interpolating eHydro topobathy data on to the generated mesh vertices. Please visit the example gallery for more examples.
First, we use PyGeoHydro to retrieve eHydro data for a part of the Columbia River that topobathy data are available. We get both the survey outline and the bathymetry data. Then, we use the survey outline polygon to generate a curvilinear mesh. We use the poly_segmentize function for this purpose that has two parameters: Spacing in streamwise direction and number of points in cross-stream direction. The function returns a geopandas.GeoSeries of the cross-sections, vertices of which are the mesh points.
from pygeohydro import EHydro
import curviriver as cr
ehydro = EHydro("outlines")
geom = ehydro.survey_grid.loc[ehydro.survey_grid["OBJECTID"] == 210, "geometry"].iloc[0]
outline = ehydro.bygeom(geom, ehydro.survey_grid.crs)
poly = outline.convex_hull.unary_union
spacing_streamwise = 2000
xs_npts = 5
stream = cr.poly_segmentize(poly, outline.crs, spacing_streamwise, xs_npts)
Contributing
Contributions are very welcomed. Please read CONTRIBUTING.rst file for instructions.
Support
The work for this project is funded by USGS through Water Resources Research Institutes (WRRI).
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 Distribution
Built Distribution
File details
Details for the file curviriver-0.1.0.tar.gz
.
File metadata
- Download URL: curviriver-0.1.0.tar.gz
- Upload date:
- Size: 999.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8693a816d65b18c79efc843bbaafaf4bcf7c50e1e2b713e813fe27ffa075cc4e |
|
MD5 | a7cafbf56618bd810dbc0d6060f58b6c |
|
BLAKE2b-256 | afc7e42da867511d1e5d3b15c05681a98bdc0f96cf0d871a3c09b04427cc0bd6 |
File details
Details for the file curviriver-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: curviriver-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1eea53239fe305722e634eb67267fc80475c17fb0b5949ad7f8669d2ed32c56 |
|
MD5 | af5096c810ad579b9da55161dab4f339 |
|
BLAKE2b-256 | a4c4b43b58c98eb0a2aa07e5adbca1d3a283bfc6c736d447ca1d673189722e97 |