Note
Go to the end to download the full example code.
1.7: 3-D Visualization¶
Importing GemPy
import gempy as gp
import gempy_viewer as gpv
from gempy import generate_example_model
from gempy.core.data.enumerators import ExampleModel
# sphinx_gallery_thumbnail_number = -1
Loading an example geomodel¶
geo_model = generate_example_model(ExampleModel.GRABEN)
gp.compute_model(geo_model)
Surface points hash: 8c72af50fc56389b620c6458a6af23915b121b5e655b3ce179a790636dc529a5
Orientations hash: 87cf30b08b5be03b38c5e6d288fa7bb8855263704efb62c7c3cd77673eaae96d
Setting Backend To: AvailableBackends.numpy
Chunking done: 19 chunks
Chunking done: 36 chunks
Chunking done: 34 chunks
Setting Backend To: AvailableBackends.numpy
Chunking done: 19 chunks
Chunking done: 36 chunks
Chunking done: 34 chunks
Basic plotting API¶
Data plot¶
gpv.plot_3d(
model=geo_model,
show_surfaces=False,
show_data=True,
show_lith=False,
image=False
)

<gempy_viewer.modules.plot_3d.vista.GemPyToVista object at 0x7fc8ec5c0f40>
Geomodel plot¶
gpv.plot_3d(geo_model, image=False)

<gempy_viewer.modules.plot_3d.vista.GemPyToVista object at 0x7fc8ed2e5d20>
LiquidEarth Integration¶
Beyond the classical plotting capabilities introduced in GemPy v3, users can now also upload models to LiquidEarth. LiquidEarth is a collaborative platform designed for 3D visualization, developed by many of the main gempy maintainers, with a strong focus on collaboration and sharing. This makes it an excellent tool for sharing your models with others and viewing them across different platforms. To upload a model to LiquidEarth, you must have an account and a user token. Once your model is uploaded, you can easily share the link with anyone.
link = gpv.plot_to_liquid_earth(
geo_model=geo_model,
space_name="[PUBLIC] GemPy Tutorial 1.7: 3-D Visualization",
file_name="gempy_model",
user_token=None, # If None, it will try to grab it from the environment
grab_link=True,
)
print(f"Generated Link: {link}")
Traceback (most recent call last):
File "/Users/flow/git/gempy/examples/tutorials/ch1_fundamentals/ch1_7_3d_visualization.py", line 67, in <module>
link = gpv.plot_to_liquid_earth(
File "/Users/flow/opt/anaconda3/envs/gempy3_pre/lib/python3.10/site-packages/gempy_viewer/API/_plot_LiquidEarth.py", line 19, in plot_to_liquid_earth
raise ValueError("No user token provided and no token found in the environment")
ValueError: No user token provided and no token found in the environment
Now we can use this link to visualize the model in Liquid Earth.

Total running time of the script: (3 minutes 49.146 seconds)