.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/examples/gempy_model.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_examples_gempy_model.py: Reading Simple GemPy model in Subsurface ======================================== .. GENERATED FROM PYTHON SOURCE LINES 5-13 .. code-block:: default import sys sys.path.insert(0, 'subsurface/') import pooch import subsurface as ss import subsurface.reader.read_netcdf .. GENERATED FROM PYTHON SOURCE LINES 14-16 Single surface -------------- .. GENERATED FROM PYTHON SOURCE LINES 16-29 .. code-block:: default # Pull gempy model model_files = pooch.retrieve( url="https://github.com/cgre-aachen/gempy_data/raw/master/" "data/subsurface/example1.zip", known_hash="fb79a63eeb874cf0cdca557106c62c67eace23811db5935e57c3448fed7f8978", processor=pooch.Unzip() ) # # %% fname, = [i for i in model_files if "meshes.nc" in i] dataset = ss.reader.read_netcdf.read_unstruct(fname) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Downloading data from 'https://github.com/cgre-aachen/gempy_data/raw/master/data/subsurface/example1.zip' to file '/home/runner/.cache/pooch/2ff36b994aa925b842ddd264256335a9-example1.zip'. Unzipping contents of '/home/runner/.cache/pooch/2ff36b994aa925b842ddd264256335a9-example1.zip' to '/home/runner/.cache/pooch/2ff36b994aa925b842ddd264256335a9-example1.zip.unzip' /home/runner/work/subsurface/subsurface/subsurface/reader/read_netcdf.py:18: UserWarning: Trying loading legacy files. warnings.warn("Trying loading legacy files.") .. GENERATED FROM PYTHON SOURCE LINES 30-37 .. code-block:: default obj = ss.TriSurf(dataset) print(obj.mesh.points_attributes_to_dict) mesh = ss.visualization.to_pyvista_mesh(obj) ss.visualization.pv_plot([mesh]) .. image-sg:: /examples/examples/images/sphx_glr_gempy_model_001.png :alt: gempy model :srcset: /examples/examples/images/sphx_glr_gempy_model_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none {} /opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pyvista/core/dataset.py:1332: PyvistaDeprecationWarning: Use of `cell_arrays` is deprecated. Use `cell_data` instead. warnings.warn( /opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pyvista/core/dataset.py:1192: PyvistaDeprecationWarning: Use of `point_arrays` is deprecated. Use `point_data` instead. warnings.warn( .. GENERATED FROM PYTHON SOURCE LINES 38-40 Four Layers ----------- .. GENERATED FROM PYTHON SOURCE LINES 40-48 .. code-block:: default # Pull gempy model model_files_2 = pooch.retrieve( url="https://github.com/cgre-aachen/gempy_data/raw/master/data/gempy_models/Kim.zip", known_hash="f530a88351ed0e38673c6937161c59a2f69df92202e14c1e5d5729ed5d72a323", processor=pooch.Unzip() ) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Downloading data from 'https://github.com/cgre-aachen/gempy_data/raw/master/data/gempy_models/Kim.zip' to file '/home/runner/.cache/pooch/823c7ed465808f92b59f69c1da6e242b-Kim.zip'. Unzipping contents of '/home/runner/.cache/pooch/823c7ed465808f92b59f69c1da6e242b-Kim.zip' to '/home/runner/.cache/pooch/823c7ed465808f92b59f69c1da6e242b-Kim.zip.unzip' .. GENERATED FROM PYTHON SOURCE LINES 49-51 Triangular meshes +++++++++++++++++ .. GENERATED FROM PYTHON SOURCE LINES 53-59 .. code-block:: default fname, = [i for i in model_files_2 if "meshes.nc" in i] gempy_tri_mesh_unstruct = ss.reader.read_netcdf.read_unstruct(fname) tri_surf = ss.TriSurf(gempy_tri_mesh_unstruct) mesh = ss.visualization.to_pyvista_mesh(tri_surf) ss.visualization.pv_plot([mesh]) .. image-sg:: /examples/examples/images/sphx_glr_gempy_model_002.png :alt: gempy model :srcset: /examples/examples/images/sphx_glr_gempy_model_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pyvista/core/dataset.py:1332: PyvistaDeprecationWarning: Use of `cell_arrays` is deprecated. Use `cell_data` instead. warnings.warn( /opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pyvista/core/dataset.py:1192: PyvistaDeprecationWarning: Use of `point_arrays` is deprecated. Use `point_data` instead. warnings.warn( .. GENERATED FROM PYTHON SOURCE LINES 60-62 Regular grid ++++++++++++ .. GENERATED FROM PYTHON SOURCE LINES 62-67 .. code-block:: default fname, = [i for i in model_files_2 if "regular_grid.nc" in i] gempy_struct = ss.reader.read_netcdf.read_struct(fname) regular_grid = ss.StructuredGrid(gempy_struct) .. GENERATED FROM PYTHON SOURCE LINES 68-78 .. code-block:: default pyvista_mesh = ss.visualization.to_pyvista_grid(regular_grid, data_set_name='property_matrix', attribute_slice={'Properties': 'id'} ) ss.visualization.pv_plot([pyvista_mesh]) .. image-sg:: /examples/examples/images/sphx_glr_gempy_model_003.png :alt: gempy model :srcset: /examples/examples/images/sphx_glr_gempy_model_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pyvista/core/dataset.py:1192: PyvistaDeprecationWarning: Use of `point_arrays` is deprecated. Use `point_data` instead. warnings.warn( .. GENERATED FROM PYTHON SOURCE LINES 79-86 .. code-block:: default pyvista_mesh = ss.visualization.to_pyvista_grid(regular_grid, data_set_name='block_matrix', attribute_slice={'Properties': 'id', 'Features': 'Default series'}) ss.visualization.pv_plot([pyvista_mesh]) .. image-sg:: /examples/examples/images/sphx_glr_gempy_model_004.png :alt: gempy model :srcset: /examples/examples/images/sphx_glr_gempy_model_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pyvista/core/dataset.py:1192: PyvistaDeprecationWarning: Use of `point_arrays` is deprecated. Use `point_data` instead. warnings.warn( .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 10.621 seconds) .. _sphx_glr_download_examples_examples_gempy_model.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: gempy_model.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: gempy_model.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_