Open-source software for implicit 3D structural geological modeling in Python.


GemPy is a Python-based, community-driven, open-source geomodeling library. It is capable of constructing complex 3D geological models including various features such as fold structures, fault networks and unconformities, based on an underlying powerful implicit approach. From the ground up, GemPy was designed to be easily embedded in probabilistic frameworks for conducting uncertainty analysis regarding subsurface structures.

3D models created with GemPy may look like this:




Geological features

GemPy is capable of modeling complex 3D geological scenarios, including:

  • Multiple conformal layers (e.g. sequences of sedimentary layers)

  • Several sequences of layers, with conformal continuation or unconformities

  • Magmatic bodies of (almost) arbitrary shapes

  • Faults (offset calculated automatically from affected geological objects)

  • Full fault networks (faults affecting faults)

  • Folds (affecting single layers or entire layer stacks, including overturned and recumbent folds)

Combining these elements in GemPy allows for the generation of realistic 3D geological models, on a par with most commercial geomodeling software.

Interpolation approach

The generation of complex structural settings is based on the powerful interpolation algorithm underlying GemPy, a unviersal cokriging method devoised by Lajaunie et al. (1997) and extended by Calcagno et al. (2008). This method is used to interpolate a 3D scalar field, such that geologically significant interfaces are isosurfces in this field.

The algorithm allows for a direct integration of two of the most relevant geological input data types:

  • Surface contact points: 3D coordinates of points marking the boundaries between different features (e.g. layer interfaces, fault planes, unconformities).

  • Orientation measurements: Orientation of the poles perpendicular to the dipping of surfaces at any point in the 3D space.

GemPy also allows for the definition of topological elements such as combining multiple stratigraphic sequences and complex fault networks to be considered in the modeling process.


Integrated visualization

Models generated with GemPy can be visualized in several ways:

  • direct visualization of 2D model sections (or geological maps) using matplotlib, including hillshading and other options for intuitive representation of results;

  • interactive 3D visualization and model input manipulation using the Visualization Toolkit (VTK);

  • We also actively develop a link to the fantastic pyvista project for even better visualization and model interaction in 3D.

In addition to visualization, the generated models can be exported in a variety of ways:

  • Export of VTK files for further visualization and processing in other software such as ParaView;

  • Export of triangulated surface meshes (e.g. for further processing in meshing programs);

  • Export of images (e.g. geological maps).

We are also currently working on a tighter integration with several meshing libraries, notably CGAL and gmesh. In addition, we have established links to several other open-source libraries, including pygiml for geophysical modeling and inversion. In the current state, however, these links have to be considered as highly experimental and they are not yet part of the stable release. If you are interested in these features, feel free to contact us.


Stochastic geological modeling

One of the most advanced features that sets GemPy also apart from available commercial packages is the full integration of stochastic geological modeling methods. GemPy was designed from the ground up to support stochastic geological modeling for uncertainty analysis (e.g. Monte Carlo simulations, Bayesian inference). This was achieved by writing GemPy’s core architecture using the numerical computation library aesara to couple it with the probabilistic programming framework PyMC3. This enables the use of advanced sampling methods (e.g. Hamiltonian Monte Carlo) and is of particular relevance when considering uncertainties in the model input data and making use of additional secondary information in a Bayesian inference framework.

We can, for example, include uncertainties with respect to the z-position of layer boundaries in the model space. Simple Monte Carlo simulation via PyMC will then result in different model realizations.

aesara allows the automated computation of gradients, opening the door to the use of advanced gradient-based sampling methods coupling GemPy and PyMC3 for advanced stochastic modeling. Also, the use of aesara allows making use of GPUs through cuda (see the aesara documentation for more information.

Making use of vtk interactivity and Qgrid , GemPy provides a functional interface to interact with input data and models.

For a more detailed elaboration of the theory behind GemPy, we refer to the open access scientific publication: “GemPy 1.0: open-source stochastic geological modeling and inversion” by de la Varga et al. (2019).


  • de la Varga, M., Schaaf, A., and Wellmann, F.: GemPy 1.0: open-source stochastic geological modeling and inversion, Geosci. Model Dev., 12, 1–32, https://doi.org/10.5194/gmd-12-1-2019, 2019.

  • Calcagno, P., Chilès, J. P., Courrioux, G., & Guillen, A. (2008). Geological modelling from field data and geological knowledge: Part I. Modelling method coupling 3D potential-field interpolation and geological rules. Physics of the Earth and Planetary Interiors, 171(1-4), 147-157.

  • Lajaunie, C., Courrioux, G., & Manuel, L. (1997). `Foliation fields and 3D cartography in geology: principles of a method based on potential interpolation. Mathematical Geology, 29(4), 571-584.

Indices and tables

_images/logo_CGRE.png _images/Terranigma.png