.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tutorials/z_other_tutorials/a1_fold.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_tutorials_z_other_tutorials_a1_fold.py: Modeling step by step ^^^^^^^^^^^^^^^^^^^^^ This tutorial demonstrates step-by-step geological modeling using the `gempy` and `gempy_viewer` libraries. We will start by importing the necessary packages, loading input data, creating a geological model, and then visualizing the results. .. GENERATED FROM PYTHON SOURCE LINES 9-11 Import minimal requirements We need to import the `gempy` library for geological modeling and `gempy_viewer` for visualization. .. GENERATED FROM PYTHON SOURCE LINES 11-14 .. code-block:: Python import gempy as gp import gempy_viewer as gpv .. GENERATED FROM PYTHON SOURCE LINES 15-18 Define the path to input data Here, we provide two ways to define the path to the input data: using a URL or a local path. Uncomment the first two lines if you want to use the online data source. .. GENERATED FROM PYTHON SOURCE LINES 18-26 .. code-block:: Python # data_path = 'https://raw.githubusercontent.com/cgre-aachen/gempy_data/master/' # path_to_data = data_path + "/data/input_data/jan_models/" # For this tutorial, we will use the local path: data_path = '../../' path_to_data = data_path + "/data/input_data/jan_models/" .. GENERATED FROM PYTHON SOURCE LINES 27-30 Create a GeoModel instance We create a GeoModel instance with a specified project name and extent. The ImporterHelper class is used to specify the paths to the orientation and surface points data. .. GENERATED FROM PYTHON SOURCE LINES 30-41 .. code-block:: Python geo_model = gp.create_geomodel( project_name='tutorial_model', extent=[0, 2500, 0, 1000, 0, 1110], refinement=4, importer_helper=gp.data.ImporterHelper( path_to_orientations=path_to_data + "tutorial_model_orientations.csv", path_to_surface_points=path_to_data + "tutorial_model_surface_points.csv" ) ) .. GENERATED FROM PYTHON SOURCE LINES 42-44 Displaying simple data cross section We use the `gempy_viewer` to visualize the initial cross-section of our geological model. .. GENERATED FROM PYTHON SOURCE LINES 44-46 .. code-block:: Python gpv.plot_2d(geo_model) .. image-sg:: /tutorials/z_other_tutorials/images/sphx_glr_a1_fold_001.png :alt: Cell Number: mid Direction: y :srcset: /tutorials/z_other_tutorials/images/sphx_glr_a1_fold_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 47-49 Map geological series to surfaces Here, we map the geological series to specific surfaces. This step is crucial for defining the stratigraphic relationships in our model. .. GENERATED FROM PYTHON SOURCE LINES 49-57 .. code-block:: Python gp.map_stack_to_surfaces( gempy_model=geo_model, mapping_object={ "Strat_Series1": ('rock3'), "Strat_Series2": ('rock2', 'rock1'), } ) .. raw:: html
Structural Groups: StructuralGroup:
Name:Strat_Series1
Structural Relation:StackRelationType.ERODE
Elements:
StructuralElement:
Name:rock3

StructuralGroup:
Name:Strat_Series2
Structural Relation:StackRelationType.ERODE
Elements:
StructuralElement:
Name:rock2

StructuralElement:
Name:rock1
Fault Relations:
Strat_Seri...Strat_Seri...
Strat_Series1
Strat_Series2
True
False


.. GENERATED FROM PYTHON SOURCE LINES 58-60 Update transformation and interpolation options We update the model with anisotropy settings and specify various interpolation options to refine the model's accuracy. .. GENERATED FROM PYTHON SOURCE LINES 60-66 .. code-block:: Python geo_model.update_transform(auto_anisotropy=gp.data.GlobalAnisotropy.CUBE) interpolation_options: gp.data.InterpolationOptions = geo_model.interpolation_options .. rst-class:: sphx-glr-script-out .. code-block:: none /home/leguark/gempy_engine/gempy_engine/core/data/transforms.py:113: RuntimeWarning: Interpolation is being done with the default transform. If you do not know what you are doing you should probably call GeoModel.update_transform() first. warnings.warn( .. GENERATED FROM PYTHON SOURCE LINES 67-69 Compute the geological model We use the specified backend (in this case, PyTorch) to compute the model. .. GENERATED FROM PYTHON SOURCE LINES 69-77 .. code-block:: Python gp.compute_model( gempy_model=geo_model, engine_config=gp.data.GemPyEngineConfig( backend=gp.data.AvailableBackends.numpy, dtype="float64" ) ) .. rst-class:: sphx-glr-script-out .. code-block:: none Setting Backend To: AvailableBackends.numpy .. raw:: html
Solutions: 4 Octree Levels, 3 DualContouringMeshes


.. GENERATED FROM PYTHON SOURCE LINES 78-80 Visualize the model: 2D cross-section without scalar field After computing the model, we visualize it again in 2D without the scalar field. .. GENERATED FROM PYTHON SOURCE LINES 80-82 .. code-block:: Python gpv.plot_2d(geo_model, show_scalar=False, series_n=1) .. image-sg:: /tutorials/z_other_tutorials/images/sphx_glr_a1_fold_002.png :alt: Cell Number: mid Direction: y :srcset: /tutorials/z_other_tutorials/images/sphx_glr_a1_fold_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 83-86 Visualize the model: 2D cross-section with scalar field In this cell, we visualize the 2D cross-section with the scalar field enabled. %% .. GENERATED FROM PYTHON SOURCE LINES 86-88 .. code-block:: Python gpv.plot_2d(geo_model, show_scalar=True, series_n=1) .. image-sg:: /tutorials/z_other_tutorials/images/sphx_glr_a1_fold_003.png :alt: Cell Number: mid Direction: y :srcset: /tutorials/z_other_tutorials/images/sphx_glr_a1_fold_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 89-91 Visualize the model in 3D Finally, we create a 3D visualization of the geological model without lithological coloring and image. .. GENERATED FROM PYTHON SOURCE LINES 91-94 .. code-block:: Python gpv.plot_3d(geo_model, show_lith=False, image=False) # sphinx_gallery_thumbnail_number = -1 .. image-sg:: /tutorials/z_other_tutorials/images/sphx_glr_a1_fold_004.png :alt: a1 fold :srcset: /tutorials/z_other_tutorials/images/sphx_glr_a1_fold_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 95-98 ### Coming up next Additional: Manually adding data (optional) Here is an example of how you can manually add surface points to the model. Uncomment and modify the code as needed. .. GENERATED FROM PYTHON SOURCE LINES 98-109 .. code-block:: Python ''' gp.add_surface_points( geo_model=geo_model, x=[458, 612], y=[0, 0], z=[-107, -14], elements_names=['surface1', 'surface1'] ) ''' .. rst-class:: sphx-glr-script-out .. code-block:: none "\ngp.add_surface_points(\n geo_model=geo_model,\n x=[458, 612],\n y=[0, 0],\n z=[-107, -14],\n elements_names=['surface1', 'surface1']\n)\n" .. GENERATED FROM PYTHON SOURCE LINES 110-114 Displaying data cross section (optional) You can re-plot the 2D cross-section if needed. gpv.plot_2d(geo_model) %% .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 3.085 seconds) .. _sphx_glr_download_tutorials_z_other_tutorials_a1_fold.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: a1_fold.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: a1_fold.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_