.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tutorials/z_other_tutorials/video_tutorial_model_3_onlap.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_video_tutorial_model_3_onlap.py: Video Tutorial "code-along": Onlap relations ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 8-11 This tutorial demonstrates step-by-step how to incorporate onlap relations to our geological models created with gempy. It follows the Video tutorial series available on the [gempy YouTube channel](https://www.youtube.com/@GemPy3D). Please follow the first and second part of the tutorials to learn the basics of modeling with gempy before diving into this tutorial. .. GENERATED FROM PYTHON SOURCE LINES 13-15 Video tutorial 11: Basic onlap scenario """""""""""""""""""""""""""""""""""" .. GENERATED FROM PYTHON SOURCE LINES 18-29 .. raw:: html .. GENERATED FROM PYTHON SOURCE LINES 31-37 .. code-block:: Python # Required imports import gempy as gp import gempy_viewer as gpv import numpy as np .. GENERATED FROM PYTHON SOURCE LINES 38-43 .. code-block:: Python # Path to input data data_path = "https://raw.githubusercontent.com/cgre-aachen/gempy_data/master/" path_to_data = data_path + "/data/input_data/video_tutorials_v3/" .. GENERATED FROM PYTHON SOURCE LINES 44-57 .. code-block:: Python # Create instance of geomodel geo_model_onlap = gp.create_geomodel( project_name = 'tutorial_model_onlap_1', extent=[0,2000,0,1000,0,1000], resolution=[100,50,50], importer_helper=gp.data.ImporterHelper( path_to_orientations=path_to_data+"tutorial_model_onlap_1_orientations.csv", path_to_surface_points=path_to_data+"tutorial_model_onlap_1_surface_points.csv" ) ) .. rst-class:: sphx-glr-script-out .. code-block:: none Surface points hash: 2de2814bb46c6cbaa69572685aff54886e4ce3e3620384a0c70e3c52b71c0bd1 Orientations hash: 059fe82183b03d9c50b4eb8249e2ea99297a704ce85138678a7d93e7d19b7b12 .. GENERATED FROM PYTHON SOURCE LINES 58-78 .. code-block:: Python # Map geological series to surfaces gp.map_stack_to_surfaces( gempy_model=geo_model_onlap, mapping_object={ "Young_Series": ("basin_fill_2", "basin_fill_1"), "Old_Series": ("basin_top", "basin_bottom") } ) # Alternative way of mapping geological series to surfaces # gp.map_stack_to_surfaces( # gempy_model=geo_model_onlap, # mapping_object={ # "Young_Series": ("basin_fill_2", "basin_fill_1"), # "Onlap_Series": ("basin_top"), # "Old_Series": ("basin_bottom") # } # ) .. raw:: html
Structural Groups: StructuralGroup:
Name:Young_Series
Structural Relation:StackRelationType.ERODE
Elements:
StructuralElement:
Name:basin_fill_2

StructuralElement:
Name:basin_fill_1

StructuralGroup:
Name:Old_Series
Structural Relation:StackRelationType.ERODE
Elements:
StructuralElement:
Name:basin_top

StructuralElement:
Name:basin_bottom
Fault Relations:
Young_Seri...Old_Series
Young_Series
Old_Series
True
False


.. GENERATED FROM PYTHON SOURCE LINES 79-83 .. code-block:: Python # Display a basic cross section of input data gpv.plot_2d(geo_model_onlap, show_data=True) .. image-sg:: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_001.png :alt: Cell Number: mid Direction: y :srcset: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 84-88 .. code-block:: Python # Compute a solution for the model gp.compute_model(geo_model_onlap) .. rst-class:: sphx-glr-script-out .. code-block:: none Setting Backend To: AvailableBackends.numpy Chunking done: 10 chunks /home/leguark/TeamCity/work/3a8738c25f60c3c9/venv/lib/python3.10/site-packages/gempy_engine/modules/activator/_soft_segment.py:95: RuntimeWarning: overflow encountered in exp return 1.0 / (1.0 + bt.t.exp(x)) Chunking done: 19 chunks /home/leguark/TeamCity/work/3a8738c25f60c3c9/venv/lib/python3.10/site-packages/gempy_engine/modules/activator/_soft_segment.py:95: RuntimeWarning: overflow encountered in exp return 1.0 / (1.0 + bt.t.exp(x)) .. raw:: html
Solutions: 4 Octree Levels, 4 DualContouringMeshes


.. GENERATED FROM PYTHON SOURCE LINES 89-93 .. code-block:: Python # Display the result in 2d section gpv.plot_2d(geo_model_onlap, show_boundaries=False) .. image-sg:: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_002.png :alt: Cell Number: mid Direction: y :srcset: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 94-99 .. code-block:: Python # Set the relation of the youngest group to Onlap from gempy_engine.core.data.stack_relation_type import StackRelationType geo_model_onlap.structural_frame.structural_groups[0].structural_relation = StackRelationType.ONLAP .. GENERATED FROM PYTHON SOURCE LINES 100-104 .. code-block:: Python # Display updated strucutral frame geo_model_onlap.structural_frame .. raw:: html
Structural Groups: StructuralGroup:
Name:Young_Series
Structural Relation:StackRelationType.ONLAP
Elements:
StructuralElement:
Name:basin_fill_2

StructuralElement:
Name:basin_fill_1

StructuralGroup:
Name:Old_Series
Structural Relation:StackRelationType.ERODE
Elements:
StructuralElement:
Name:basin_top

StructuralElement:
Name:basin_bottom
Fault Relations:
Young_Seri...Old_Series
Young_Series
Old_Series
True
False


.. GENERATED FROM PYTHON SOURCE LINES 105-109 .. code-block:: Python # Compute a solution for the model gp.compute_model(geo_model_onlap) .. rst-class:: sphx-glr-script-out .. code-block:: none Setting Backend To: AvailableBackends.numpy Chunking done: 10 chunks /home/leguark/TeamCity/work/3a8738c25f60c3c9/venv/lib/python3.10/site-packages/gempy_engine/modules/activator/_soft_segment.py:95: RuntimeWarning: overflow encountered in exp return 1.0 / (1.0 + bt.t.exp(x)) Chunking done: 19 chunks /home/leguark/TeamCity/work/3a8738c25f60c3c9/venv/lib/python3.10/site-packages/gempy_engine/modules/activator/_soft_segment.py:95: RuntimeWarning: overflow encountered in exp return 1.0 / (1.0 + bt.t.exp(x)) .. raw:: html
Solutions: 4 Octree Levels, 4 DualContouringMeshes


.. GENERATED FROM PYTHON SOURCE LINES 110-114 .. code-block:: Python # Display the result in 2d section gpv.plot_2d(geo_model_onlap, show_boundaries=False) .. image-sg:: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_003.png :alt: Cell Number: mid Direction: y :srcset: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 115-117 Video tutorial 12: Advanced onlap - Subduction zone """""""""""""""""""""""""""" .. GENERATED FROM PYTHON SOURCE LINES 119-130 .. raw:: html .. GENERATED FROM PYTHON SOURCE LINES 132-144 .. code-block:: Python # Create instance of geomodel geo_model_subduction = gp.create_geomodel( project_name = 'tutorial_model_onlap_2', extent=[0,2000,0,1000,0,1000], resolution=[100,50,50], importer_helper=gp.data.ImporterHelper( path_to_orientations=path_to_data+"tutorial_model_onlap_2_orientations.csv?", path_to_surface_points=path_to_data+"tutorial_model_onlap_2_surface_points.csv?" ) ) .. rst-class:: sphx-glr-script-out .. code-block:: none Surface points hash: d0999adb1b7cfca54abd040f517aeba042d7f43a69b507c69ac6ad8cd6682e13 Orientations hash: ebada610b5a68730bf1d03323594e755fbe986cd07857ee99d8b758716e3dfaa .. GENERATED FROM PYTHON SOURCE LINES 145-149 .. code-block:: Python # Display a basic cross section of input data gpv.plot_2d(geo_model_subduction) .. image-sg:: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_004.png :alt: Cell Number: mid Direction: y :srcset: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 150-161 .. code-block:: Python # Map geological series to surfaces gp.map_stack_to_surfaces( gempy_model=geo_model_subduction, mapping_object={ "Top": ("continental_top"), "Continental_Series": ("continental_shallow", "continental_deep"), "Oceanic_Series": ("oceanic_top", "oceanic_bottom") } ) .. raw:: html
Structural Groups: StructuralGroup:
Name:Top
Structural Relation:StackRelationType.ERODE
Elements:
StructuralElement:
Name:continental_top

StructuralGroup:
Name:Continental_Series
Structural Relation:StackRelationType.ERODE
Elements:
StructuralElement:
Name:continental_shallow

StructuralElement:
Name:continental_deep

StructuralGroup:
Name:Oceanic_Series
Structural Relation:StackRelationType.ERODE
Elements:
StructuralElement:
Name:oceanic_top

StructuralElement:
Name:oceanic_bottom
Fault Relations:
TopContinenta...Oceanic_Se...
Top
Continental_Series
Oceanic_Series
True
False


.. GENERATED FROM PYTHON SOURCE LINES 162-167 .. code-block:: Python # Set the realtion of the youngest and second youngest group to Onlap geo_model_subduction.structural_frame.structural_groups[0].structural_relation = StackRelationType.ONLAP geo_model_subduction.structural_frame.structural_groups[1].structural_relation = StackRelationType.ONLAP .. GENERATED FROM PYTHON SOURCE LINES 168-172 .. code-block:: Python # Display updated structural frame geo_model_subduction.structural_frame .. raw:: html
Structural Groups: StructuralGroup:
Name:Top
Structural Relation:StackRelationType.ONLAP
Elements:
StructuralElement:
Name:continental_top

StructuralGroup:
Name:Continental_Series
Structural Relation:StackRelationType.ONLAP
Elements:
StructuralElement:
Name:continental_shallow

StructuralElement:
Name:continental_deep

StructuralGroup:
Name:Oceanic_Series
Structural Relation:StackRelationType.ERODE
Elements:
StructuralElement:
Name:oceanic_top

StructuralElement:
Name:oceanic_bottom
Fault Relations:
TopContinenta...Oceanic_Se...
Top
Continental_Series
Oceanic_Series
True
False


.. GENERATED FROM PYTHON SOURCE LINES 173-193 .. code-block:: Python # Create a simple topography using numpy # Define grid spacing spacing = 20 # Generate grid x = np.arange(geo_model_subduction.grid.regular_grid.extent[0], geo_model_subduction.grid.regular_grid.extent[1] + spacing, spacing) y = np.arange(geo_model_subduction.grid.regular_grid.extent[2], geo_model_subduction.grid.regular_grid.extent[3] + spacing, spacing) X, Y = np.meshgrid(x, y) # Define elevation (z) based on x, creating a simple mountain range Z = np.ones_like(X) * 590 # Default elevation Z[(X >= 570) & (X < 1000)] = 590 + (200 * (X[(X >= 570) & (X < 1000)] - 600) / 400) Z[(X >= 1000) & (X < 1300)] = 810 - (250 * (X[(X >= 1000) & (X < 1300)] - 1000) / 300) Z[X >= 1300] = 540 # Flatten the data into (N,3) shape topography_points = np.vstack((X.ravel(), Y.ravel(), Z.ravel())).T .. GENERATED FROM PYTHON SOURCE LINES 194-198 .. code-block:: Python # Set topography from numpy array gp.set_topography_from_arrays(grid=geo_model_subduction.grid, xyz_vertices=topography_points) .. rst-class:: sphx-glr-script-out .. code-block:: none Active grids: GridTypes.NONE|TOPOGRAPHY|DENSE .. GENERATED FROM PYTHON SOURCE LINES 199-203 .. code-block:: Python # Compute a solution for the model gp.compute_model(geo_model_subduction) .. rst-class:: sphx-glr-script-out .. code-block:: none Setting Backend To: AvailableBackends.numpy Chunking done: 14 chunks /home/leguark/TeamCity/work/3a8738c25f60c3c9/venv/lib/python3.10/site-packages/gempy_engine/modules/activator/_soft_segment.py:95: RuntimeWarning: overflow encountered in exp return 1.0 / (1.0 + bt.t.exp(x)) Chunking done: 10 chunks Chunking done: 12 chunks /home/leguark/TeamCity/work/3a8738c25f60c3c9/venv/lib/python3.10/site-packages/gempy_engine/modules/activator/_soft_segment.py:95: RuntimeWarning: overflow encountered in exp return 1.0 / (1.0 + bt.t.exp(x)) /home/leguark/TeamCity/work/3a8738c25f60c3c9/venv/lib/python3.10/site-packages/gempy_engine/modules/activator/_soft_segment.py:95: RuntimeWarning: overflow encountered in exp return 1.0 / (1.0 + bt.t.exp(x)) .. raw:: html
Solutions: 4 Octree Levels, 5 DualContouringMeshes


.. GENERATED FROM PYTHON SOURCE LINES 204-208 .. code-block:: Python # Display the result in 2d section gpv.plot_2d(geo_model_subduction, show_topography=True, show_boundaries=False) .. image-sg:: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_005.png :alt: Cell Number: mid Direction: y :srcset: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_005.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 209-215 .. code-block:: Python # Display 3d plot of final model gpv.plot_3d(geo_model_subduction, show_topography=True, image=True) # sphinx_gallery_thumbnail_number = -1 .. image-sg:: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_006.png :alt: video tutorial model 3 onlap :srcset: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_006.png :class: sphx-glr-single-img .. image-sg:: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_007.png :alt: video tutorial model 3 onlap :srcset: /tutorials/z_other_tutorials/images/sphx_glr_video_tutorial_model_3_onlap_007.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 35.931 seconds) .. _sphx_glr_download_tutorials_z_other_tutorials_video_tutorial_model_3_onlap.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: video_tutorial_model_3_onlap.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: video_tutorial_model_3_onlap.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: video_tutorial_model_3_onlap.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_