gempy-project / gempy

GemPy is an open-source, Python-based 3-D structural geological modeling software, which allows the implicit (i.e. automatic) creation of complex geological models from interface and orientation data. It also offers support for stochastic modeling to address parameter and model uncertainties.
https://gempy.org
European Union Public License 1.2
965 stars 232 forks source link

3D visualizations make Google Colab kernel crash #901

Closed JoostGevaert closed 4 months ago

JoostGevaert commented 4 months ago

I put the 1.1 - Basics of geological modeling with GemPy Jupyter Notebook in my Google Drive and then opened it with Google Colab.

Installation of GemPy and PyVista was successful. Unfortunately, 3D visualizations seem to make the Google Colab kernel crash:

gpv.plot_3d(geo_model, image=False, plotter_type='basic')
gpv.plot_3d(geo_model, show_data=False, image=False, plotter_type='basic')

To Reproduce Run this Google Colab: https://drive.google.com/file/d/1gnIs9azy8wYQHuYatSziNYaea2lr5_x9/view

javoha commented 4 months ago

Hi, so I think the problem here is that the default 3D gempy plot/pyvista wants to open an interactive plot in a new window. To my knowledge this does not currently work with Google Colab. Other plotting options ("notebook" for example) have not yet been implemented in gempy_v3 (but will hopefully be available in the close future). For now this piece of code worked for me to get a static 3D plot in Colab:

import pyvista

pyvista.set_jupyter_backend('static')
pyvista.global_theme.notebook = True
pyvista.start_xvfb()

gpv.plot_3d(data, image=True)
JoostGevaert commented 4 months ago

Great. Thanks Jan!