.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tutorials/ch1_fundamentals/ch1_6_2d_visualization.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_ch1_fundamentals_ch1_6_2d_visualization.py: 1.6: 2D Visualization. ====================== .. GENERATED FROM PYTHON SOURCE LINES 7-21 .. code-block:: Python import os # Importing auxiliary libraries import numpy as np # Importing GemPy import gempy as gp import gempy_viewer as gpv # sphinx_gallery_thumbnail_number = -1 np.random.seed(1515) .. GENERATED FROM PYTHON SOURCE LINES 22-25 Model interpolation ~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 27-28 Data Preparation .. GENERATED FROM PYTHON SOURCE LINES 28-43 .. code-block:: Python data_path = os.path.abspath('../../') geo_data: gp.data.GeoModel = gp.create_geomodel( project_name='viz_2d', extent=[0, 1000, 0, 1000, 0, 1000], resolution=[10, 10, 10], refinement=4, importer_helper=gp.data.ImporterHelper( path_to_orientations=data_path + "/data/input_data/jan_models/model5_orientations.csv", path_to_surface_points=data_path + "/data/input_data/jan_models/model5_surface_points.csv", ) ) gp.set_topography_from_random(grid=geo_data.grid, d_z=np.array([500, 1000])) .. rst-class:: sphx-glr-script-out .. code-block:: none Active grids: ['regular' 'topography'] .. GENERATED FROM PYTHON SOURCE LINES 44-46 .. code-block:: Python gpv.plot_2d(geo_data) .. image-sg:: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_001.png :alt: Cell Number: mid Direction: y :srcset: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 47-51 .. code-block:: Python section_dict = {'section1': ([0, 0], [1000, 1000], [100, 80]), 'section2': ([800, 0], [800, 1000], [150, 100]), 'section3': ([50, 200], [100, 500], [200, 150])} .. GENERATED FROM PYTHON SOURCE LINES 52-55 .. code-block:: Python gp.set_section_grid(geo_data.grid, section_dict) gpv.plot_section_traces(geo_data) .. image-sg:: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_002.png :alt: Cell Number: -1 Direction: z :srcset: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Active grids: ['regular' 'topography' 'sections'] .. GENERATED FROM PYTHON SOURCE LINES 56-58 .. code-block:: Python geo_data.grid.sections .. raw:: html
start stop resolution dist
section1 [0, 0] [1000, 1000] [100, 80] 1414.213562
section2 [800, 0] [800, 1000] [150, 100] 1000.000000
section3 [50, 200] [100, 500] [200, 150] 304.138127


.. GENERATED FROM PYTHON SOURCE LINES 61-74 .. code-block:: Python gp.map_stack_to_surfaces( gempy_model=geo_data, mapping_object={ "Fault_Series": 'fault', "Strat_Series": ('rock2', 'rock1') } ) gp.set_is_fault( frame=geo_data.structural_frame, fault_groups=['Fault_Series'] ) .. raw:: html
Structural Groups: StructuralGroup:
Name:Fault_Series
Structural Relation:StackRelationType.FAULT
Elements:
StructuralElement:
Name:fault

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

StructuralElement:
Name:rock1
Fault Relations:
Fault_Seri...Strat_Seri...
Fault_Series
Strat_Series
True
False


.. GENERATED FROM PYTHON SOURCE LINES 75-77 .. code-block:: Python geo_data.grid.active_grids .. rst-class:: sphx-glr-script-out .. code-block:: none array(['regular', 'topography', 'sections'], dtype=' Solutions: 4 Octree Levels, 3 DualContouringMeshes

.. GENERATED FROM PYTHON SOURCE LINES 81-82 new plotting api .. GENERATED FROM PYTHON SOURCE LINES 82-84 .. code-block:: Python gpv.plot_2d(geo_data, section_names=['section1']) .. image-sg:: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_003.png :alt: section1 :srcset: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/leguark/gempy_viewer/gempy_viewer/API/_plot_2d_sections_api.py:104: UserWarning: Section contacts not implemented yet. We need to pass scalar field for the sections grid warnings.warn( .. GENERATED FROM PYTHON SOURCE LINES 85-88 Plot API -------- .. GENERATED FROM PYTHON SOURCE LINES 91-94 If nothing is passed, a Plot2D object is created and therefore you are in the same situation as above: .. GENERATED FROM PYTHON SOURCE LINES 96-98 .. code-block:: Python p3 = gpv.plot_2d(geo_data) .. image-sg:: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_004.png :alt: Cell Number: mid Direction: y :srcset: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_004.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 99-102 Alternatively you can pass section\_names, cell\_numbers + direction or any combination of the above: .. GENERATED FROM PYTHON SOURCE LINES 104-106 .. code-block:: Python gpv.plot_2d(geo_data, section_names=['topography']) .. image-sg:: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_005.png :alt: Geological map :srcset: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_005.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/leguark/gempy_viewer/gempy_viewer/API/_plot_2d_sections_api.py:104: UserWarning: Section contacts not implemented yet. We need to pass scalar field for the sections grid warnings.warn( .. GENERATED FROM PYTHON SOURCE LINES 107-109 .. code-block:: Python gpv.plot_2d(geo_data, section_names=['section1']) .. image-sg:: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_006.png :alt: section1 :srcset: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_006.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/leguark/gempy_viewer/gempy_viewer/API/_plot_2d_sections_api.py:104: UserWarning: Section contacts not implemented yet. We need to pass scalar field for the sections grid warnings.warn( .. GENERATED FROM PYTHON SOURCE LINES 110-112 .. code-block:: Python gpv.plot_2d(geo_data, section_names=['section1', 'section2']) .. image-sg:: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_007.png :alt: section1, section2 :srcset: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_007.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/leguark/gempy_viewer/gempy_viewer/API/_plot_2d_sections_api.py:104: UserWarning: Section contacts not implemented yet. We need to pass scalar field for the sections grid warnings.warn( .. GENERATED FROM PYTHON SOURCE LINES 113-114 .. code-block:: Python gpv.plot_2d(geo_data, figsize=(15, 15), section_names=['section1', 'section2', 'topography'], cell_number='mid') .. image-sg:: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_008.png :alt: section1, section2, Geological map, Cell Number: mid Direction: y :srcset: /tutorials/ch1_fundamentals/images/sphx_glr_ch1_6_2d_visualization_008.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/leguark/gempy_viewer/gempy_viewer/API/_plot_2d_sections_api.py:104: UserWarning: Section contacts not implemented yet. We need to pass scalar field for the sections grid warnings.warn( .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.410 seconds) .. _sphx_glr_download_tutorials_ch1_fundamentals_ch1_6_2d_visualization.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ch1_6_2d_visualization.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ch1_6_2d_visualization.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_