.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/02_structural_modeling/04_model_spremberg_building.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_examples_02_structural_modeling_04_model_spremberg_building.py: Construct Spremberg: Building initial model -------------------------------------------- This example demonstrates... # sphinx_gallery_thumbnail_number = -1 .. GENERATED FROM PYTHON SOURCE LINES 9-16 .. code-block:: default import numpy as np import gempy as gp import gempy_viewer as gpv from subsurface.modules.visualization import to_pyvista_line, to_pyvista_points from vector_geology.model_contructor.spremberg import generate_spremberg_model, get_spremberg_borehole_set, add_wells_plot .. rst-class:: sphx-glr-script-out .. code-block:: none Python-dotenv could not parse statement starting at line 13 Python-dotenv could not parse statement starting at line 14 Python-dotenv could not parse statement starting at line 15 Python-dotenv could not parse statement starting at line 16 Python-dotenv could not parse statement starting at line 17 .. GENERATED FROM PYTHON SOURCE LINES 17-48 .. code-block:: default vertical_exaggeration = 3 elements_to_gempy = { "Buntsandstein" : { "id" : 53_300, "color": "#983999" }, "Werra-Anhydrit" : { "id" : 61_730, "color": "#00923f" }, # "Kupferschiefer" : { # "id" : 61_760, # "color": "#da251d" # }, "Zechsteinkonglomerat": { "id" : 61_770, "color": "#f8c300" }, "Rotliegend" : { "id" : 62_000, "color": "#bb825b" } } spremberg_boreholes = get_spremberg_borehole_set() geo_model: gp.data.GeoModel = generate_spremberg_model( borehole_set=spremberg_boreholes, elements_to_gempy=elements_to_gempy, plot=False ) .. image-sg:: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_001.png :alt: 04 model spremberg building :srcset: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_001.png :class: sphx-glr-single-img .. image-sg:: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_002.png :alt: 04 model spremberg building :srcset: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/leguark/subsurface/subsurface/modules/reader/wells/_read_to_df.py:16: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support sep=None with delim_whitespace=False; you can avoid this warning by specifying engine='python'. d = reader( /home/leguark/subsurface/subsurface/modules/reader/wells/read_borehole_interface.py:129: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy lith_df['top'] = np.abs(lith_df['top']) /home/leguark/subsurface/subsurface/modules/reader/wells/read_borehole_interface.py:130: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy lith_df['base'] = np.abs(lith_df['base']) /home/leguark/subsurface/subsurface/modules/reader/wells/_read_to_df.py:16: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support sep=None with delim_whitespace=False; you can avoid this warning by specifying engine='python'. d = reader( Well '13E_56' does not exist in the attributes DataFrame. Well '4_56' does not exist in the attributes DataFrame. Well '64_59' does not exist in the attributes DataFrame. Well 'DOE104_63' does not exist in the attributes DataFrame. Well 'H3_71' does not exist in the attributes DataFrame. Well 'H4_71' does not exist in the attributes DataFrame. Well 'H5_71' does not exist in the attributes DataFrame. Well 'H6_71' does not exist in the attributes DataFrame. Well 'H7_71' does not exist in the attributes DataFrame. Well 'MUSK1_00' does not exist in the attributes DataFrame. Well 'MUSK1_62' does not exist in the attributes DataFrame. Well 'N1_71' does not exist in the attributes DataFrame. Well 'N10_71' does not exist in the attributes DataFrame. Well 'N11_71' does not exist in the attributes DataFrame. Well 'N2_71' does not exist in the attributes DataFrame. Well 'N3_71' does not exist in the attributes DataFrame. Well 'N8_71' does not exist in the attributes DataFrame. Well 'N9_71' does not exist in the attributes DataFrame. ('cell',) are not coordinates with an index xarray dataset must include 'cell' key (KeyError) or xarray 'cell' has no index (ValueError). /home/leguark/subsurface/subsurface/modules/reader/wells/_read_to_df.py:16: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support sep=None with delim_whitespace=False; you can avoid this warning by specifying engine='python'. d = reader( /home/leguark/.virtualenvs/gempy_2024.2/lib/python3.10/site-packages/gempy/core/data/grid_modules/grid_types.py:248: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown plt.show() /home/leguark/gempy_viewer/gempy_viewer/API/_plot_3d_API.py:213: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown plt.show(block=False) .. GENERATED FROM PYTHON SOURCE LINES 49-50 Add one orientation to the model .. GENERATED FROM PYTHON SOURCE LINES 50-63 .. code-block:: default rotliegend: gp.data.StructuralElement = geo_model.structural_frame.get_element_by_name("Rotliegend") gp.add_orientations( geo_model=geo_model, x=[5_460_077.527386775, 5_450_077.527386775], y=[5_720_030.2446156405, 5_710_030.2446156405], z=[-600, -600], elements_names=["Rotliegend", "Rotliegend"], pole_vector=[ np.array([.7, 0.7, 0.2]), np.array([-1, 0, 0.2]) ], ) .. raw:: html
Structural Groups: StructuralGroup:
Name:Stratigraphic Pile
Structural Relation:StackRelationType.ERODE
Elements:
StructuralElement:
Name:Buntsandstein

StructuralElement:
Name:Werra-Anhydrit

StructuralElement:
Name:Zechsteinkonglomerat

StructuralElement:
Name:Rotliegend
Fault Relations:
Stratigrap...
Stratigraphic Pile
True
False


.. GENERATED FROM PYTHON SOURCE LINES 64-74 .. code-block:: default pivot = [5_478_256.5, 5_698_528.946534388] point_2 = [5_483_077.527386775, 5_710_030.2446156405] point_3 = [5_474_977.5974836275, 5_712_059.373443342] section_dict = { 'section1': (pivot, point_2, [100, 100]), 'section2': (pivot, point_3, [100, 100]), 'section3': (point_2, point_3, [100, 100]) } .. GENERATED FROM PYTHON SOURCE LINES 75-78 .. code-block:: default gp.set_section_grid(geo_model.grid, section_dict) gpv.plot_section_traces(geo_model) .. image-sg:: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_003.png :alt: Cell Number: -1 Direction: z :srcset: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Active grids: GridTypes.NONE|SECTIONS|OCTREE /home/leguark/gempy_viewer/gempy_viewer/API/_plot_2d_API.py:202: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown plot.fig.show() .. GENERATED FROM PYTHON SOURCE LINES 79-93 .. code-block:: default _ = gpv.plot_3d( model=geo_model, ve=vertical_exaggeration, image=True, transformed_data=True, kwargs_pyvista_bounds={ 'show_xlabels': False, 'show_ylabels': False, }, kwargs_plot_data={ 'arrow_size': 0.001000 } ) .. image-sg:: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_004.png :alt: 04 model spremberg building :srcset: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_004.png :class: sphx-glr-single-img .. image-sg:: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_005.png :alt: 04 model spremberg building :srcset: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_005.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/leguark/gempy_viewer/gempy_viewer/API/_plot_3d_API.py:213: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown plt.show(block=False) .. GENERATED FROM PYTHON SOURCE LINES 94-113 .. code-block:: default # * Ignore curvature for now geo_model.interpolation_options.kernel_options.range = 3 geo_model.interpolation_options.compute_scalar_gradient = False geo_model.interpolation_options.evaluation_options.octree_curvature_threshold = 0.4 geo_model.interpolation_options.evaluation_options.number_octree_levels_surface = 6 geo_model.interpolation_options.evaluation_options.octree_error_threshold = 1 geo_model.interpolation_options.evaluation_options.verbose = True gp.compute_model( gempy_model=geo_model, engine_config=gp.data.GemPyEngineConfig( backend=gp.data.AvailableBackends.PYTORCH, dtype="float64", ) ) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_006.png :alt: Voxel Scalar Values with Refinement Status :srcset: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_006.png :class: sphx-glr-multi-img * .. image-sg:: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_007.png :alt: Voxel Scalar Values with Refinement Status :srcset: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_007.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none Setting Backend To: AvailableBackends.PYTORCH Chunking done: 9 chunks /home/leguark/.virtualenvs/gempy_2024.2/lib/python3.10/site-packages/gempy_engine/modules/octrees_topology/_octree_internals.py:205: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown plt.show() Number of voxels marked by stats: 353 of torch.Size([512]). Number of voxels marked by corners : 248 Total voxels: 353 Dense Grid would be 512 voxels Chunking done: 8 chunks /home/leguark/.virtualenvs/gempy_2024.2/lib/python3.10/site-packages/gempy_engine/modules/octrees_topology/_octree_internals.py:205: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown plt.show() Number of voxels marked by stats: 1681 of torch.Size([3024]). Number of voxels marked by corners : 1306 Total voxels: 1681 Dense Grid would be 4096 voxels Chunking done: 35 chunks Chunking done: 14 chunks .. raw:: html
Solutions: 5 Octree Levels, 4 DualContouringMeshes


.. GENERATED FROM PYTHON SOURCE LINES 114-121 .. code-block:: default gpv.plot_2d( model=geo_model, figsize=(15, 15), ve=vertical_exaggeration, section_names=['section1', 'section2', 'section3'] ) .. image-sg:: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_008.png :alt: section1, section2, section3 :srcset: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_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:106: UserWarning: Section contacts not implemented yet. We need to pass scalar field for the sections grid warnings.warn( /home/leguark/gempy_viewer/gempy_viewer/API/_plot_2d_API.py:176: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown p.fig.show() .. GENERATED FROM PYTHON SOURCE LINES 122-172 .. code-block:: default gempy_plot = gpv.plot_3d( model=geo_model, show_lith=False, ve=vertical_exaggeration, show=False, image=False, transformed_data=False, kwargs_pyvista_bounds={ 'show_xlabels': False, 'show_ylabels': False, 'show_zlabels': False, 'show_xaxis': False, 'show_yaxis': False, }, kwargs_plot_data={ 'arrow_size': 40.001000 } ) well_mesh = to_pyvista_line( line_set=spremberg_boreholes.combined_trajectory, active_scalar="lith_ids", radius=10 ) units_limit = [0, 20] collars = to_pyvista_points(spremberg_boreholes.collars.collar_loc) gempy_plot.p.add_mesh( well_mesh.threshold(units_limit), cmap="tab20c", clim=units_limit ) gempy_plot.p.add_mesh( collars, point_size=10, render_points_as_spheres=True ) gempy_plot.p.add_point_labels( points=spremberg_boreholes.collars.collar_loc.points, labels=spremberg_boreholes.collars.ids, point_size=3, shape_opacity=0.5, font_size=12, bold=True ) gempy_plot.p.show() .. image-sg:: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_009.png :alt: 04 model spremberg building :srcset: /examples/02_structural_modeling/images/sphx_glr_04_model_spremberg_building_009.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 173-181 LiquidEarth Integration ~~~~~~~~~~~~~~~~~~~~~~~ Beyond the classical plotting capabilities introduced in GemPy v3, users can now also upload models to LiquidEarth. `LiquidEarth `_ is a collaborative platform designed for 3D visualization, developed by many of the main `gempy` maintainers, with a strong focus on collaboration and sharing. This makes it an excellent tool for sharing your models with others and viewing them across different platforms. To upload a model to LiquidEarth, you must have an account and a user token. Once your model is uploaded, you can easily share the link with anyone. .. GENERATED FROM PYTHON SOURCE LINES 181-193 .. code-block:: default # # %% if False: link = gpv.plot_to_liquid_earth( geo_model=geo_model, space_name="Spremberg", file_name="gempy_model", user_token=None, # If None, it will try to grab it from the environment grab_link=True, ) print(f"Generated Link: {link}") .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 13.795 seconds) .. _sphx_glr_download_examples_02_structural_modeling_04_model_spremberg_building.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 04_model_spremberg_building.py <04_model_spremberg_building.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 04_model_spremberg_building.ipynb <04_model_spremberg_building.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_