geomesher


Namegeomesher JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryMeshing a GeoDataFrame using Gmsh.
upload_time2023-09-17 05:17:23
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.
            .. image:: https://raw.githubusercontent.com/cheginit/geomesher/main/doc/source/_static/logo-text.png
    :target: https://geomesher.readthedocs.io

|

GeoMesher: Meshing a GeoDataFrame using Gmsh
============================================

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

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

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

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

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

|

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

.. image:: https://www.codefactor.io/repository/github/cheginit/geomesher/badge/main
    :target: https://www.codefactor.io/repository/github/cheginit/geomesher/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
--------

GeoMesher is a fork of `pandamesh <https://github.com/Deltares/pandamesh>`__. The original
package included two mesh generators: `Triangle <https://www.cs.cmu.edu/~quake/triangle.html>`__
and `Gmsh <https://gmsh.info/>`__. This fork only includes the Gmsh mesh generator since
Triangle seems to be not maintained anymore. Also, GeoMesher adds the following new
functionalities:

* A new method for returning the generated mesh as a GeoDataFrame.
* A new function called ``gdf_mesher`` that can generate a mesh from a GeoDataFrame
  with a single function call and with sane defaults for the mesh generator.
* Remap a scalar field from the source GeoDataFrame to the generated mesh,
  using an area weighted interpolation method
  (based on `Tobler <https://github.com/pysal/tobler>`__).
* Handle ``MultiPolygon`` geometries in the source GeoDataFrame.

Note that the remapping functionality of GeoMesher is a simple areal interpolation method.
For more advanced interpolation methods, please use `Tobler <https://pysal.org/tobler/index.html>`__.

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

You can install GeoMesher using ``pip``:

.. code-block:: console

    $ pip install geomesher

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

.. code-block:: console

    $ conda install -c conda-forge geomesher

Quick start
-----------

The following example shows how to generate a mesh from a GeoDataFrame
using both the ``gdf_mesher`` function and the ``Mesher`` class.

We start by getting a GeoDataFrame of South America from the Natural Earth website.
Then, we reproject it to a projected coordinate system (UTM zone 20S).
Finally, we add a new column called ``cellsize`` that will be used to set the
maximum size of the mesh elements.

We use the ``gdf_mesher`` function to generate the mesh with default parameters
and use ``Mesher`` to generate the mesh with ``MESH_ADAPT`` algorithm.
We also use the ``area_interpolate`` function to remap the ``POP_EST`` column
from the source GeoDataFrame to the generated mesh.

.. code:: python

    import geopandas as gpd
    import geomesher as gm

    world = gpd.read_file(
        "https://naciscdn.org/naturalearth/110m/cultural/ne_110m_admin_0_countries.zip"
    )

    south_america = world[world["CONTINENT"] == "South America"]
    south_america = south_america.explode(ignore_index=True).to_crs(32620)
    south_america["cellsize"] = 500_000.0

    mesh_auto = gm.gdf_mesher(south_america, intensive_variables=["POP_EST"])

    mesher = gm.Mesher(south_america)
    mesher.mesh_algorithm = "MESH_ADAPT"
    mesh_adapt = mesher.generate()
    mesh_adapt = gm.area_interpolate(south_america, mesh_adapt, intensive_variables=["POP_EST"])

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

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

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

Credits
-------

GeoMesher is a fork of `pandamesh <https://github.com/Deltares/pandamesh>`__ (MIT License)
and uses one of the modules in
`Tobler <https://pysal.org/tobler/index.html>`__ (BSD-3-Clause License).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "geomesher",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Taher Chegini <cheginit@gmail.com>",
    "keywords": "geopandas,mesh,unstructured grid",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/11/46/961f992e44af753658acd88ca0bc244de7804e386704e3d7aea7095b3ce6/geomesher-0.1.0.tar.gz",
    "platform": "any",
    "description": ".. image:: https://raw.githubusercontent.com/cheginit/geomesher/main/doc/source/_static/logo-text.png\n    :target: https://geomesher.readthedocs.io\n\n|\n\nGeoMesher: Meshing a GeoDataFrame using Gmsh\n============================================\n\n.. image:: https://github.com/cheginit/geomesher/actions/workflows/test.yml/badge.svg\n   :target: https://github.com/cheginit/geomesher/actions/workflows/test.yml\n   :alt: CI\n\n.. image:: https://img.shields.io/pypi/v/geomesher.svg\n    :target: https://pypi.python.org/pypi/geomesher\n    :alt: PyPi\n\n.. image:: https://img.shields.io/conda/vn/conda-forge/geomesher.svg\n    :target: https://anaconda.org/conda-forge/geomesher\n    :alt: Conda Version\n\n.. image:: https://codecov.io/gh/cheginit/geomesher/graph/badge.svg\n    :target: https://codecov.io/gh/cheginit/geomesher\n    :alt: CodeCov\n\n.. image:: https://img.shields.io/pypi/pyversions/geomesher.svg\n    :target: https://pypi.python.org/pypi/geomesher\n    :alt: Python Versions\n\n|\n\n.. image:: https://static.pepy.tech/badge/geomesher\n    :target: https://pepy.tech/project/geomesher\n    :alt: Downloads\n\n.. image:: https://www.codefactor.io/repository/github/cheginit/geomesher/badge/main\n    :target: https://www.codefactor.io/repository/github/cheginit/geomesher/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\nGeoMesher is a fork of `pandamesh <https://github.com/Deltares/pandamesh>`__. The original\npackage included two mesh generators: `Triangle <https://www.cs.cmu.edu/~quake/triangle.html>`__\nand `Gmsh <https://gmsh.info/>`__. This fork only includes the Gmsh mesh generator since\nTriangle seems to be not maintained anymore. Also, GeoMesher adds the following new\nfunctionalities:\n\n* A new method for returning the generated mesh as a GeoDataFrame.\n* A new function called ``gdf_mesher`` that can generate a mesh from a GeoDataFrame\n  with a single function call and with sane defaults for the mesh generator.\n* Remap a scalar field from the source GeoDataFrame to the generated mesh,\n  using an area weighted interpolation method\n  (based on `Tobler <https://github.com/pysal/tobler>`__).\n* Handle ``MultiPolygon`` geometries in the source GeoDataFrame.\n\nNote that the remapping functionality of GeoMesher is a simple areal interpolation method.\nFor more advanced interpolation methods, please use `Tobler <https://pysal.org/tobler/index.html>`__.\n\nInstallation\n------------\n\nYou can install GeoMesher using ``pip``:\n\n.. code-block:: console\n\n    $ pip install geomesher\n\nor using ``conda`` (``mamba``):\n\n.. code-block:: console\n\n    $ conda install -c conda-forge geomesher\n\nQuick start\n-----------\n\nThe following example shows how to generate a mesh from a GeoDataFrame\nusing both the ``gdf_mesher`` function and the ``Mesher`` class.\n\nWe start by getting a GeoDataFrame of South America from the Natural Earth website.\nThen, we reproject it to a projected coordinate system (UTM zone 20S).\nFinally, we add a new column called ``cellsize`` that will be used to set the\nmaximum size of the mesh elements.\n\nWe use the ``gdf_mesher`` function to generate the mesh with default parameters\nand use ``Mesher`` to generate the mesh with ``MESH_ADAPT`` algorithm.\nWe also use the ``area_interpolate`` function to remap the ``POP_EST`` column\nfrom the source GeoDataFrame to the generated mesh.\n\n.. code:: python\n\n    import geopandas as gpd\n    import geomesher as gm\n\n    world = gpd.read_file(\n        \"https://naciscdn.org/naturalearth/110m/cultural/ne_110m_admin_0_countries.zip\"\n    )\n\n    south_america = world[world[\"CONTINENT\"] == \"South America\"]\n    south_america = south_america.explode(ignore_index=True).to_crs(32620)\n    south_america[\"cellsize\"] = 500_000.0\n\n    mesh_auto = gm.gdf_mesher(south_america, intensive_variables=[\"POP_EST\"])\n\n    mesher = gm.Mesher(south_america)\n    mesher.mesh_algorithm = \"MESH_ADAPT\"\n    mesh_adapt = mesher.generate()\n    mesh_adapt = gm.area_interpolate(south_america, mesh_adapt, intensive_variables=[\"POP_EST\"])\n\n.. image:: https://raw.githubusercontent.com/cheginit/geomesher/main/doc/source/_static/demo.png\n  :target: https://github.com/cheginit/geomesher\n\nContributing\n------------\n\nContributions are very welcomed. Please read\n`CONTRIBUTING.rst <https://github.com/cheginit/pygeoogc/blob/main/CONTRIBUTING.rst>`__\nfile for instructions.\n\nCredits\n-------\n\nGeoMesher is a fork of `pandamesh <https://github.com/Deltares/pandamesh>`__ (MIT License)\nand uses one of the modules in\n`Tobler <https://pysal.org/tobler/index.html>`__ (BSD-3-Clause License).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Meshing a GeoDataFrame using Gmsh.",
    "version": "0.1.0",
    "project_urls": {
        "Code": "https://github.com/deltares/geomesher",
        "Home": "https://github.com/deltares/geomesher",
        "Issues": "https://github.com/deltares/geomesher/issues"
    },
    "split_keywords": [
        "geopandas",
        "mesh",
        "unstructured grid"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "64b9d51c5e2cd76fe43ba6066feec05a5b6977a3346dc0f7b157b3c53609bf6a",
                "md5": "5816ff08b814b94af15fdde03a505fe7",
                "sha256": "c32143b6117dd71de6e4d8fe2ba6e0a47fe387fb96b00bb8dacd6231edb91634"
            },
            "downloads": -1,
            "filename": "geomesher-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5816ff08b814b94af15fdde03a505fe7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 21508,
            "upload_time": "2023-09-17T05:17:21",
            "upload_time_iso_8601": "2023-09-17T05:17:21.883913Z",
            "url": "https://files.pythonhosted.org/packages/64/b9/d51c5e2cd76fe43ba6066feec05a5b6977a3346dc0f7b157b3c53609bf6a/geomesher-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1146961f992e44af753658acd88ca0bc244de7804e386704e3d7aea7095b3ce6",
                "md5": "1430e26e06b9de4a5a98c378b72b5e80",
                "sha256": "049218ad13f42f7d223a8526acd0b516f98fb6ad8b24df31d1e7f960a9a00e4c"
            },
            "downloads": -1,
            "filename": "geomesher-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1430e26e06b9de4a5a98c378b72b5e80",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1703677,
            "upload_time": "2023-09-17T05:17:23",
            "upload_time_iso_8601": "2023-09-17T05:17:23.743814Z",
            "url": "https://files.pythonhosted.org/packages/11/46/961f992e44af753658acd88ca0bc244de7804e386704e3d7aea7095b3ce6/geomesher-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-17 05:17:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "deltares",
    "github_project": "geomesher",
    "github_not_found": true,
    "lcname": "geomesher"
}
        
Elapsed time: 0.11083s