pandamesh


Namepandamesh JSON
Version 0.1.5 PyPI version JSON
download
home_page
SummaryFrom geodataframe to mesh
upload_time2024-02-06 09:34:20
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords geopandas mesh unstructured grid
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            pandamesh
=========

.. image:: https://img.shields.io/github/actions/workflow/status/deltares/pandamesh/ci.yml?style=flat-square
   :target: https://github.com/deltares/pandamesh/actions?query=workflows%3Aci
.. image:: https://img.shields.io/codecov/c/github/deltares/pandamesh.svg?style=flat-square
   :target: https://app.codecov.io/gh/deltares/pandamesh
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square
   :target: https://github.com/psf/black

This package translates geospatial vector data (points, lines, or polygons) to
unstructured meshes.

.. code:: python

   import pandamesh as pm

   # Get some sample data in geopandas form.
   south_america = pm.data.south_america()

   # Explode any multi-polygon, and project it to UTM20.
   south_america = south_america.explode(index_parts=True).reset_index().to_crs(epsg=32620)

   # Set a maximum cell size of 500 km and generate a mesh.
   south_america["cellsize"] = 500_000.0
   mesher = pm.TriangleMesher(south_america)
   vertices, faces = mesher.generate()
   
.. image:: https://raw.githubusercontent.com/Deltares/pandamesh/main/docs/_static/pandamesh-demo.png
  :target: https://github.com/deltares/pandamesh

The package converts geospatial data, presented as
`geopandas`_ `GeoDataFrames`_, to unstructured meshes using the open source
high quality mesh generators:

* Christophe Geuzaine and Jean-François Remacle's `Gmsh`_
* Jonathan Shewchuk's `Triangle`_

utilizing the respective Python API's, available at:

* https://pypi.org/project/gmsh/
* https://pypi.org/project/triangle/
  
For completeness, the source code of both projects can be found at:

* https://gitlab.onelab.info/gmsh/gmsh, under ``api/gmsh.py``
* https://github.com/drufat/triangle

These APIs are wrapped in two lightweight classes: ``pandamesh.TriangleMesher``
and ``pandamesh.GmshMesher``. Both are initialized with a GeoDataFrame defining
the geometry features of the mesh. During initialization, geometries are
checked for overlaps and intersections, as the mesh generators cannot deal with
these.  Generated meshes are returned as two numpy arrays: the coordinates of
the vertices, and the connectivity of the mesh faces to these vertices (as is
`usual`_ for many unstructured grid representations).

GeoPandas is not suited for geometries that "wrap around" the world.
Consequently, this package cannot generate meshes for e.g. a sphere.

Installation
------------

.. code:: console

    pip install pandamesh
    
Documentation
-------------

.. image:: https://img.shields.io/github/actions/workflow/status/deltares/pandamesh/ci.yml?style=flat-square
   :target: https://deltares.github.io/pandamesh/

The documentation can be found `here`_.
   
Other projects
--------------

Pandamesh has been developed because none of the existing packages provide a
straightforward scripting based approach to converting 2D vector geometries to
2D unstructured grids.

Examples of other packages which work with unstructured meshes are listed below.

See also `this list`_ for many other mesh generation tools.

pygmsh
******

The `pygmsh Python package`_  provides useful abstractions from Gmsh's own
Python interface so you can create complex geometries more easily. It also
provides tools for 3D operations (e.g. extrusions).

qgis-gsmh
*********

qgis-gmsh generates geometry input files for the GMSH mesh generator and
converts the Gmsh mesh files to shapefiles that can be imported into QGIS.

* Lambrechts, J., Comblen, R., Legat, V., Geuzaine, C., & Remacle, J. F. (2008).
  Multiscale mesh generation on the sphere. Ocean Dynamics, 58(5-6), 461-473.
* Remacle, J. F., & Lambrechts, J. (2018). Fast and robust mesh generation on
  the sphere—Application to coastal domains. Computer-Aided Design, 103, 14-23.
  https://doi.org/10.1016/j.cad.2018.03.002  

Source: https://github.com/ccorail/qgis-gmsh

Shingle
*******

Shingle provides generalised self-consistent and automated domain
discretisation for multi-scale geophysical models.

* Candy, A. S., & Pietrzak, J. D. (2018). Shingle 2.0: generalising
  self-consistent and automated domain discretisation for multi-scale
  geophysical models. Geoscientific Model Development, 11(1), 213-234.
  https://doi.org/10.5194/gmd-11-213-2018

Source: https://github.com/shingleproject/Shingle 

Website: http://shingleproject.org/index_shingle1.0.html

.. _here: https://deltares.github.io/pandamesh/
.. _geopandas: https://geopandas.org/
.. _GeoDataFrames: https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.html
.. _Gmsh: https://gmsh.info/
.. _Triangle: https://www.cs.cmu.edu/~quake/triangle.html
.. _usual: https://ugrid-conventions.github.io/ugrid-conventions/
.. _pygmsh Python package: https://github.com/nschloe/pygmsh
.. _this list: https://github.com/nschloe/awesome-scientific-computing#meshing

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pandamesh",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Huite Bootsma <huite.bootsma@deltares.nl>",
    "keywords": "geopandas,mesh,unstructured grid",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/10/20/9d9723178ac74a712da098c2d10ae0c546c2ab342954eba64c8ef429a707/pandamesh-0.1.5.tar.gz",
    "platform": null,
    "description": "pandamesh\n=========\n\n.. image:: https://img.shields.io/github/actions/workflow/status/deltares/pandamesh/ci.yml?style=flat-square\n   :target: https://github.com/deltares/pandamesh/actions?query=workflows%3Aci\n.. image:: https://img.shields.io/codecov/c/github/deltares/pandamesh.svg?style=flat-square\n   :target: https://app.codecov.io/gh/deltares/pandamesh\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square\n   :target: https://github.com/psf/black\n\nThis package translates geospatial vector data (points, lines, or polygons) to\nunstructured meshes.\n\n.. code:: python\n\n   import pandamesh as pm\n\n   # Get some sample data in geopandas form.\n   south_america = pm.data.south_america()\n\n   # Explode any multi-polygon, and project it to UTM20.\n   south_america = south_america.explode(index_parts=True).reset_index().to_crs(epsg=32620)\n\n   # Set a maximum cell size of 500 km and generate a mesh.\n   south_america[\"cellsize\"] = 500_000.0\n   mesher = pm.TriangleMesher(south_america)\n   vertices, faces = mesher.generate()\n   \n.. image:: https://raw.githubusercontent.com/Deltares/pandamesh/main/docs/_static/pandamesh-demo.png\n  :target: https://github.com/deltares/pandamesh\n\nThe package converts geospatial data, presented as\n`geopandas`_ `GeoDataFrames`_, to unstructured meshes using the open source\nhigh quality mesh generators:\n\n* Christophe Geuzaine and Jean-Fran\u00e7ois Remacle's `Gmsh`_\n* Jonathan Shewchuk's `Triangle`_\n\nutilizing the respective Python API's, available at:\n\n* https://pypi.org/project/gmsh/\n* https://pypi.org/project/triangle/\n  \nFor completeness, the source code of both projects can be found at:\n\n* https://gitlab.onelab.info/gmsh/gmsh, under ``api/gmsh.py``\n* https://github.com/drufat/triangle\n\nThese APIs are wrapped in two lightweight classes: ``pandamesh.TriangleMesher``\nand ``pandamesh.GmshMesher``. Both are initialized with a GeoDataFrame defining\nthe geometry features of the mesh. During initialization, geometries are\nchecked for overlaps and intersections, as the mesh generators cannot deal with\nthese.  Generated meshes are returned as two numpy arrays: the coordinates of\nthe vertices, and the connectivity of the mesh faces to these vertices (as is\n`usual`_ for many unstructured grid representations).\n\nGeoPandas is not suited for geometries that \"wrap around\" the world.\nConsequently, this package cannot generate meshes for e.g. a sphere.\n\nInstallation\n------------\n\n.. code:: console\n\n    pip install pandamesh\n    \nDocumentation\n-------------\n\n.. image:: https://img.shields.io/github/actions/workflow/status/deltares/pandamesh/ci.yml?style=flat-square\n   :target: https://deltares.github.io/pandamesh/\n\nThe documentation can be found `here`_.\n   \nOther projects\n--------------\n\nPandamesh has been developed because none of the existing packages provide a\nstraightforward scripting based approach to converting 2D vector geometries to\n2D unstructured grids.\n\nExamples of other packages which work with unstructured meshes are listed below.\n\nSee also `this list`_ for many other mesh generation tools.\n\npygmsh\n******\n\nThe `pygmsh Python package`_  provides useful abstractions from Gmsh's own\nPython interface so you can create complex geometries more easily. It also\nprovides tools for 3D operations (e.g. extrusions).\n\nqgis-gsmh\n*********\n\nqgis-gmsh generates geometry input files for the GMSH mesh generator and\nconverts the Gmsh mesh files to shapefiles that can be imported into QGIS.\n\n* Lambrechts, J., Comblen, R., Legat, V., Geuzaine, C., & Remacle, J. F. (2008).\n  Multiscale mesh generation on the sphere. Ocean Dynamics, 58(5-6), 461-473.\n* Remacle, J. F., & Lambrechts, J. (2018). Fast and robust mesh generation on\n  the sphere\u2014Application to coastal domains. Computer-Aided Design, 103, 14-23.\n  https://doi.org/10.1016/j.cad.2018.03.002  \n\nSource: https://github.com/ccorail/qgis-gmsh\n\nShingle\n*******\n\nShingle provides generalised self-consistent and automated domain\ndiscretisation for multi-scale geophysical models.\n\n* Candy, A. S., & Pietrzak, J. D. (2018). Shingle 2.0: generalising\n  self-consistent and automated domain discretisation for multi-scale\n  geophysical models. Geoscientific Model Development, 11(1), 213-234.\n  https://doi.org/10.5194/gmd-11-213-2018\n\nSource: https://github.com/shingleproject/Shingle \n\nWebsite: http://shingleproject.org/index_shingle1.0.html\n\n.. _here: https://deltares.github.io/pandamesh/\n.. _geopandas: https://geopandas.org/\n.. _GeoDataFrames: https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.html\n.. _Gmsh: https://gmsh.info/\n.. _Triangle: https://www.cs.cmu.edu/~quake/triangle.html\n.. _usual: https://ugrid-conventions.github.io/ugrid-conventions/\n.. _pygmsh Python package: https://github.com/nschloe/pygmsh\n.. _this list: https://github.com/nschloe/awesome-scientific-computing#meshing\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "From geodataframe to mesh",
    "version": "0.1.5",
    "project_urls": {
        "Code": "https://github.com/deltares/pandamesh",
        "Home": "https://github.com/deltares/pandamesh",
        "Issues": "https://github.com/deltares/pandamesh/issues"
    },
    "split_keywords": [
        "geopandas",
        "mesh",
        "unstructured grid"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "522eb8a5dc2d0fe82dd36e56841008029978ad75b784787ccf5afaed40f423b6",
                "md5": "300d728a0bb3644a644957d04c12770e",
                "sha256": "66d5dc44dec52341dac0ba6faf7306b450a34a0fcf06e1c6267ce4c2c27f48ec"
            },
            "downloads": -1,
            "filename": "pandamesh-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "300d728a0bb3644a644957d04c12770e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 22031,
            "upload_time": "2024-02-06T09:34:18",
            "upload_time_iso_8601": "2024-02-06T09:34:18.203635Z",
            "url": "https://files.pythonhosted.org/packages/52/2e/b8a5dc2d0fe82dd36e56841008029978ad75b784787ccf5afaed40f423b6/pandamesh-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "10209d9723178ac74a712da098c2d10ae0c546c2ab342954eba64c8ef429a707",
                "md5": "ce25ac89b7b267cdc679340b50572c54",
                "sha256": "a9c3aea024da407f231274d8f1d183a01f3caa89d0a8a77b446b0a50f9eb7c42"
            },
            "downloads": -1,
            "filename": "pandamesh-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "ce25ac89b7b267cdc679340b50572c54",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 21967,
            "upload_time": "2024-02-06T09:34:20",
            "upload_time_iso_8601": "2024-02-06T09:34:20.192356Z",
            "url": "https://files.pythonhosted.org/packages/10/20/9d9723178ac74a712da098c2d10ae0c546c2ab342954eba64c8ef429a707/pandamesh-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-06 09:34:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "deltares",
    "github_project": "pandamesh",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pandamesh"
}
        
Elapsed time: 0.18873s