Skip to main content
https://img.shields.io/github/actions/workflow/status/deltares/pandamesh/ci.yml?style=flat-square https://img.shields.io/codecov/c/github/deltares/pandamesh.svg?style=flat-square https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square

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

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()
https://raw.githubusercontent.com/Deltares/pandamesh/main/docs/_static/pandamesh-demo.png

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:

For completeness, the source code of both projects can be found at:

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

pip install pandamesh

Documentation

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

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

Metadata

Release files for pandamesh 0.2.3

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

Source distribution (sdist)

Source distribution for pandamesh 0.2.3
File Size Uploaded
pandamesh-0.2.3.tar.gz 46.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pandamesh 0.2.3
File Interpreter ABI Platform
pandamesh-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 86.9 kB

Release files / pandamesh-0.2.3.tar.gz

Download URL pandamesh-0.2.3.tar.gz
Size 46.7 kB
Tags Source
SHA-256 checksum
How to use checksums
67272322b65a71c929f2c53c2019540d946bc8b0aeb311444457e115c0ffc616
BLAKE2b-256 checksum
How to use checksums
2f4286a22290a9916354b74d5b4b32af754b72fa07a3e5974b2c0f9883e68737
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / pandamesh-0.2.3-py3-none-any.whl

Download URL pandamesh-0.2.3-py3-none-any.whl
Size 40.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc1f5b3c976acaa49634c6e694e966fb94ae7ea6e26757dc16e4fad011e5858d
BLAKE2b-256 checksum
How to use checksums
4489e652fe65c440582111afb542d4ac6fa6ef80126476abdbbb5d4620bae70f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1.0

2 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