In [1]:
# Importing GemPy
import gempy as gp
# Embedding matplotlib figures in the notebooks
%matplotlib inline
# Importing auxiliary libraries
import numpy as np
import matplotlib.pyplot as plt
In [2]:
data_path = 'https://raw.githubusercontent.com/cgre-aachen/gempy_data/master/'
geo_model = gp.create_data('viz_3d',
[0, 2000, 0, 2000, 0, 1600],
[50, 50, 50],
path_o=data_path + "data/input_data/lisa_models/foliations" + str(7) + ".csv",
path_i=data_path + "data/input_data/lisa_models/interfaces" + str(7) + ".csv"
)
gp.map_stack_to_surfaces(
geo_model,
{"Fault_1": 'Fault_1', "Fault_2": 'Fault_2',
"Strat_Series": ('Sandstone', 'Siltstone', 'Shale', 'Sandstone_2', 'Schist', 'Gneiss')}
)
geo_model.set_is_fault(['Fault_1', 'Fault_2'])
geo_model.set_topography()
gp.set_interpolator(geo_model)
gp.compute_model(geo_model, compute_mesh=True)
Out[2]:
In [3]:
gp.plot_3d(geo_model, show_surfaces=False, notebook=True)
Out[3]:
In [4]:
gp.plot_3d(geo_model, notebook=True)
Out[4]:
In [5]:
gp.plot_3d(geo_model, notebook=False)
Out[5]:
In [6]:
geo_model.surfaces
Out[6]:
In [17]:
gpv = gp.plot_3d(geo_model, show_data=False, show_results=False, plotter_type='background')
In [18]:
# Plotting all surfaces...
gpv.plot_surfaces()
Out[18]:
In [19]:
# ... masked by topography
gpv.plot_topography()
Out[19]:
In [20]:
# Just few surfaces
gpv.plot_surfaces(['Siltstone', 'Gneiss'])
Out[20]:
In [21]:
gpv.plot_surfaces(["Fault_1"])
gpv.plot_surfaces(["Shale"], clear=False)
Out[21]:
In [22]:
gpv.plot_surface_points()
gpv.plot_orientations()
Out[22]:
In [23]:
mesh = gpv.surface_points_mesh
mesh
Out[23]:
In [24]:
mesh.points[:, -1]
Out[24]:
In [25]:
mesh.n_arrays
Out[25]:
In [26]:
gpv.plot_structured_grid("scalar", series = 'Strat_Series')
Out[26]:
In [4]:
gp.plot.plot_interactive_3d(geo_model, show_topography=True)
Out[4]:
GemPy supports interactive plotting, meaning that you can drag & drop the input data and GemPy will update the geomodel live. This does not work in the static notebook plotter, but instead you have to pass the notebook=False
argument to open an interactive plotting window. When running the next cell you can freely move the surface points (spheres) and orientations (arrows) of the Shale horizon and see how it updates the model.
Note: Everytime you move a data point, GemPy will recompute the geomodel. This works best whe running GemPy on a dedicated graphics card (GPU).
In [29]:
gpv = gp.plot_3d(geo_model, show_data=False, show_results=False, plotter_type='background')
gpv.plot_surface_points()
gpv.plot_orientations()
gpv.plot_surfaces()
Out[29]:
In [30]:
gpv.toggle_live_updating()
Out[30]:
Now if you move the data the model updates!
To go back to static models:
In [31]:
gpv.toggle_live_updating()
Out[31]:
In [32]:
gpv.live_updating = True
gpv.plot_surface_points()
gpv.plot_orientations()
Out[32]:
In [33]:
geo_model.modify_surface_points(0, X=-100, plot_object=gpv)
Out[33]:
In [34]:
geo_model.add_surface_points(-200, 1500, 600, 'Schist', plot_object=gpv)
Out[34]:
In [35]:
geo_model.delete_surface_points(22, plot_object=gpv)
Out[35]: