<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Interactive 3-D Visualization
Step1:  Loading an example geomodel
Step2:  Basic plotting API
Data plot
Step3:  Geomodel plot
Step4:  Interactive plot
Passing the notebook=False keyword argument will run the pyvista visualization in an external window, allowing for interactivity
Step5:  Granular 3-D Visualization
Plotting surfaces
Step6:  Plotting individual surfaces
Step7:  Plotting input data
Step8:  Plot structured grids
Step9:  Interactive Block with cross sections
Step10:  Interactive Plotting
Step11:  Now if you move the data the model updates!
To go back to static models
Step12:  Interactive Plotting
<ASSISTANT_TASK:>
Python Code:
# 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
Explanation: Interactive 3-D Visualization
End of explanation
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)
Explanation: Loading an example geomodel
End of explanation
gp.plot_3d(geo_model, show_surfaces=False, notebook=True)
Explanation: Basic plotting API
Data plot
End of explanation
gp.plot_3d(geo_model, notebook=True)
Explanation: Geomodel plot
End of explanation
gp.plot_3d(geo_model, notebook=False)
Explanation: Interactive plot
Passing the notebook=False keyword argument will run the pyvista visualization in an external window, allowing for interactivity:
End of explanation
geo_model.surfaces
gpv = gp.plot_3d(geo_model, show_data=False, show_results=False, plotter_type='background')
# Plotting all surfaces...
gpv.plot_surfaces()
# ... masked by topography
gpv.plot_topography()
# Just few surfaces
gpv.plot_surfaces(['Siltstone', 'Gneiss'])
Explanation: Granular 3-D Visualization
Plotting surfaces
End of explanation
gpv.plot_surfaces(["Fault_1"])
gpv.plot_surfaces(["Shale"], clear=False)
Explanation: Plotting individual surfaces
End of explanation
gpv.plot_surface_points()
gpv.plot_orientations()
mesh = gpv.surface_points_mesh
mesh
mesh.points[:, -1]
mesh.n_arrays
Explanation: Plotting input data
End of explanation
gpv.plot_structured_grid("scalar", series = 'Strat_Series')
Explanation: Plot structured grids
End of explanation
gp.plot.plot_interactive_3d(geo_model, show_topography=True)
Explanation: Interactive Block with cross sections
End of explanation
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()
gpv.toggle_live_updating()
Explanation: Interactive Plotting: Drag and drop
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).
End of explanation
gpv.toggle_live_updating()
Explanation: Now if you move the data the model updates!
To go back to static models:
End of explanation
gpv.live_updating = True
gpv.plot_surface_points()
gpv.plot_orientations()
geo_model.modify_surface_points(0, X=-100, plot_object=gpv)
geo_model.add_surface_points(-200, 1500, 600, 'Schist', plot_object=gpv)
geo_model.delete_surface_points(22, plot_object=gpv)
Explanation: Interactive Plotting: Programatically
If the model is in live_updating model. It is also possible to change the model by passing the plotting object to the typical methods:
End of explanation
<END_TASK>