curviriver


Namecurviriver JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryGenerate curvilinear mesh from river outline polygons
upload_time2023-10-20 01:31:47
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT
keywords curvilinear grid mesh shapely
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://raw.githubusercontent.com/cheginit/curviriver/main/doc/source/_static/logo-text.png
    :target: https://curviriver.readthedocs.io

|

CurviRiver: Curvilinear Mesh Generator for Rivers
=================================================

.. image:: https://github.com/cheginit/curviriver/actions/workflows/test.yml/badge.svg
   :target: https://github.com/cheginit/curviriver/actions/workflows/test.yml
   :alt: CI

.. image:: https://img.shields.io/pypi/v/curviriver.svg
    :target: https://pypi.python.org/pypi/curviriver
    :alt: PyPi

.. image:: https://img.shields.io/conda/vn/conda-forge/curviriver.svg
    :target: https://anaconda.org/conda-forge/curviriver
    :alt: Conda Version

.. image:: https://codecov.io/gh/cheginit/curviriver/graph/badge.svg
    :target: https://codecov.io/gh/cheginit/curviriver
    :alt: CodeCov

.. image:: https://img.shields.io/pypi/pyversions/curviriver.svg
    :target: https://pypi.python.org/pypi/curviriver
    :alt: Python Versions

|

.. image:: https://static.pepy.tech/badge/curviriver
    :target: https://pepy.tech/project/curviriver
    :alt: Downloads

.. image:: https://www.codefactor.io/repository/github/cheginit/curviriver/badge/main
    :target: https://www.codefactor.io/repository/github/cheginit/curviriver/overview/main
    :alt: CodeFactor

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: black

.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
    :target: https://github.com/pre-commit/pre-commit
    :alt: pre-commit

|

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``:

.. code-block:: console

    $ pip install curviriver

or using ``conda`` (``mamba``):

.. code-block:: console

    $ 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 <https://www.sam.usace.army.mil/Missions/Spatial-Data-Branch/eHYDRO/>`__
topobathy data on to the generated mesh vertices. Please visit the
`example gallery <https://curviriver.readthedocs.io/en/latest/gallery.html>`__
for more examples.

First, we use `PyGeoHydro <https://docs.hyriver.io/readme/pygeohydro.html>`__
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.

.. code:: python

    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)

.. image:: https://raw.githubusercontent.com/cheginit/curviriver/main/doc/source/_static/curvilinear.png
  :target: https://github.com/cheginit/curviriver

Contributing
------------

Contributions are very welcomed. Please read
`CONTRIBUTING.rst <https://github.com/cheginit/curviriver/blob/main/CONTRIBUTING.rst>`__
file for instructions.

Support
-------

The work for this project is funded by USGS through Water Resources Research Institutes
(`WRRI <https://water.usgs.gov/wrri/index.php>`__).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "curviriver",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Taher Chegini <cheginit@gmail.com>",
    "keywords": "curvilinear grid,mesh,shapely",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/af/c7/e42da867511d1e5d3b15c05681a98bdc0f96cf0d871a3c09b04427cc0bd6/curviriver-0.1.0.tar.gz",
    "platform": "any",
    "description": ".. image:: https://raw.githubusercontent.com/cheginit/curviriver/main/doc/source/_static/logo-text.png\n    :target: https://curviriver.readthedocs.io\n\n|\n\nCurviRiver: Curvilinear Mesh Generator for Rivers\n=================================================\n\n.. image:: https://github.com/cheginit/curviriver/actions/workflows/test.yml/badge.svg\n   :target: https://github.com/cheginit/curviriver/actions/workflows/test.yml\n   :alt: CI\n\n.. image:: https://img.shields.io/pypi/v/curviriver.svg\n    :target: https://pypi.python.org/pypi/curviriver\n    :alt: PyPi\n\n.. image:: https://img.shields.io/conda/vn/conda-forge/curviriver.svg\n    :target: https://anaconda.org/conda-forge/curviriver\n    :alt: Conda Version\n\n.. image:: https://codecov.io/gh/cheginit/curviriver/graph/badge.svg\n    :target: https://codecov.io/gh/cheginit/curviriver\n    :alt: CodeCov\n\n.. image:: https://img.shields.io/pypi/pyversions/curviriver.svg\n    :target: https://pypi.python.org/pypi/curviriver\n    :alt: Python Versions\n\n|\n\n.. image:: https://static.pepy.tech/badge/curviriver\n    :target: https://pepy.tech/project/curviriver\n    :alt: Downloads\n\n.. image:: https://www.codefactor.io/repository/github/cheginit/curviriver/badge/main\n    :target: https://www.codefactor.io/repository/github/cheginit/curviriver/overview/main\n    :alt: CodeFactor\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: black\n\n.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white\n    :target: https://github.com/pre-commit/pre-commit\n    :alt: pre-commit\n\n|\n\nFeatures\n--------\n\nCurviRiver takes as input a Polygon of a river segment and generates a 2D or 3D\ncurvilinear mesh that can be used for hydrodynamic or hydrological modeling.\nThe mesh is generated in three main steps:\n\n- Determining the centerline of the input Polygon using Voroni diagram\n  Dijkstra's algorithm,\n- Smoothing the generated centerline with a B-spline curve,\n- Computing the tangent angles of the centerline at each point along\n  the centerline and generating cross-sections perpendicular to the\n  centerline at given intervals,\n- Generating a 2D mesh from vertices of the cross-sections,\n- Generating a 3D mesh if depth data is provided, by determining the depth of\n  2D mesh vertices from the depth data using Inverse Distance Weighting (IDW).\n\nInstallation\n------------\n\nYou can install CurviRiver using ``pip``:\n\n.. code-block:: console\n\n    $ pip install curviriver\n\nor using ``conda`` (``mamba``):\n\n.. code-block:: console\n\n    $ conda install -c conda-forge curviriver\n\nQuick start\n-----------\n\nWe demonstrate capabilities of CurviRiver by generating a\ncurvilinear mesh along a portion of the Columbia River and\ninterpolating\n`eHydro <https://www.sam.usace.army.mil/Missions/Spatial-Data-Branch/eHYDRO/>`__\ntopobathy data on to the generated mesh vertices. Please visit the\n`example gallery <https://curviriver.readthedocs.io/en/latest/gallery.html>`__\nfor more examples.\n\nFirst, we use `PyGeoHydro <https://docs.hyriver.io/readme/pygeohydro.html>`__\nto retrieve eHydro data for a part of the Columbia River that topobathy data are\navailable. We get both the survey outline and the bathymetry data.\nThen, we use the survey outline polygon to generate a curvilinear mesh.\nWe use the ``poly_segmentize`` function for this purpose that has two\nparameters: Spacing in streamwise direction and number of points in\ncross-stream direction. The function returns a ``geopandas.GeoSeries``\nof the cross-sections, vertices of which are the mesh points.\n\n.. code:: python\n\n    from pygeohydro import EHydro\n    import curviriver as cr\n\n    ehydro = EHydro(\"outlines\")\n    geom = ehydro.survey_grid.loc[ehydro.survey_grid[\"OBJECTID\"] == 210, \"geometry\"].iloc[0]\n    outline = ehydro.bygeom(geom, ehydro.survey_grid.crs)\n\n    poly = outline.convex_hull.unary_union\n    spacing_streamwise = 2000\n    xs_npts = 5\n    stream = cr.poly_segmentize(poly, outline.crs, spacing_streamwise, xs_npts)\n\n.. image:: https://raw.githubusercontent.com/cheginit/curviriver/main/doc/source/_static/curvilinear.png\n  :target: https://github.com/cheginit/curviriver\n\nContributing\n------------\n\nContributions are very welcomed. Please read\n`CONTRIBUTING.rst <https://github.com/cheginit/curviriver/blob/main/CONTRIBUTING.rst>`__\nfile for instructions.\n\nSupport\n-------\n\nThe work for this project is funded by USGS through Water Resources Research Institutes\n(`WRRI <https://water.usgs.gov/wrri/index.php>`__).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generate curvilinear mesh from river outline polygons",
    "version": "0.1.0",
    "project_urls": {
        "Code": "https://github.com/cheginit/curviriver",
        "Home": "https://curviriver.readthedocs.io",
        "Issues": "https://github.com/cheginit/curviriver/issues"
    },
    "split_keywords": [
        "curvilinear grid",
        "mesh",
        "shapely"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a4c4b43b58c98eb0a2aa07e5adbca1d3a283bfc6c736d447ca1d673189722e97",
                "md5": "af5096c810ad579b9da55161dab4f339",
                "sha256": "d1eea53239fe305722e634eb67267fc80475c17fb0b5949ad7f8669d2ed32c56"
            },
            "downloads": -1,
            "filename": "curviriver-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "af5096c810ad579b9da55161dab4f339",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 16994,
            "upload_time": "2023-10-20T01:31:46",
            "upload_time_iso_8601": "2023-10-20T01:31:46.230235Z",
            "url": "https://files.pythonhosted.org/packages/a4/c4/b43b58c98eb0a2aa07e5adbca1d3a283bfc6c736d447ca1d673189722e97/curviriver-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "afc7e42da867511d1e5d3b15c05681a98bdc0f96cf0d871a3c09b04427cc0bd6",
                "md5": "a7cafbf56618bd810dbc0d6060f58b6c",
                "sha256": "8693a816d65b18c79efc843bbaafaf4bcf7c50e1e2b713e813fe27ffa075cc4e"
            },
            "downloads": -1,
            "filename": "curviriver-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a7cafbf56618bd810dbc0d6060f58b6c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 999825,
            "upload_time": "2023-10-20T01:31:47",
            "upload_time_iso_8601": "2023-10-20T01:31:47.671461Z",
            "url": "https://files.pythonhosted.org/packages/af/c7/e42da867511d1e5d3b15c05681a98bdc0f96cf0d871a3c09b04427cc0bd6/curviriver-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-20 01:31:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cheginit",
    "github_project": "curviriver",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "curviriver"
}
        
Elapsed time: 0.12619s