.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/real/Moureze.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_real_Moureze.py: Moureze ~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 8-9 These two lines are necessary only if gempy is not installed .. GENERATED FROM PYTHON SOURCE LINES 9-21 .. code-block:: python3 import sys, os os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,device=cpu" # Importing gempy import gempy as gp # Aux imports import numpy as np import pandas as pn import matplotlib.pyplot as plt .. GENERATED FROM PYTHON SOURCE LINES 22-28 Loading surface points from repository: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With pandas we can do it directly from the web and with the right args we can directly tidy the data in gempy style: .. GENERATED FROM PYTHON SOURCE LINES 30-40 .. code-block:: python3 Moureze_points = pn.read_csv( 'https://raw.githubusercontent.com/Loop3D/ImplicitBenchmark/master/Moureze/Moureze_Points.csv', sep=';', names=['X', 'Y', 'Z', 'G_x', 'G_y', 'G_z', '_'], header=0, ) Sections_EW = pn.read_csv('https://raw.githubusercontent.com/Loop3D/ImplicitBenchmark/master/Moureze/Sections_EW.csv', sep=';', names=['X', 'Y', 'Z', 'ID', '_'], header=1).dropna() Sections_NS = pn.read_csv('https://raw.githubusercontent.com/Loop3D/ImplicitBenchmark/master/Moureze/Sections_NS.csv', sep=';', names=['X', 'Y', 'Z', 'ID', '_'], header=1).dropna() .. GENERATED FROM PYTHON SOURCE LINES 41-43 Extracting the orientatins: .. GENERATED FROM PYTHON SOURCE LINES 45-49 .. code-block:: python3 mask_surfpoints = Moureze_points['G_x'] < -9999 surfpoints = Moureze_points[mask_surfpoints] orientations = Moureze_points[~mask_surfpoints] .. GENERATED FROM PYTHON SOURCE LINES 50-52 Giving an arbitrary value name to the surface .. GENERATED FROM PYTHON SOURCE LINES 54-57 .. code-block:: python3 surfpoints['surface'] = '0' orientations['surface'] = '0' .. GENERATED FROM PYTHON SOURCE LINES 58-60 .. code-block:: python3 surfpoints.tail() .. raw:: html
X Y Z G_x G_y G_z _ surface
3425 177.43 155.90 -152.01 -99999.0 -99999.0 -99999.0 0.05 0
3426 89.92 86.35 -120.03 -99999.0 -99999.0 -99999.0 0.07 0
3427 75.94 116.72 -140.02 -99999.0 -99999.0 -99999.0 0.78 0
3428 177.96 233.83 -148.83 -99999.0 -99999.0 -99999.0 0.52 0
3429 46.49 17.74 -148.02 -99999.0 -99999.0 -99999.0 0.11 0


.. GENERATED FROM PYTHON SOURCE LINES 61-63 .. code-block:: python3 orientations.tail() .. raw:: html
X Y Z G_x G_y G_z _ surface
3409 47.97 129.89 -132.01 -0.45 -0.85 0.27 0.02 0
3420 175.94 293.73 -138.02 0.22 -0.88 0.41 0.44 0
3421 203.97 367.73 -150.01 0.22 -0.97 -0.10 0.71 0
3422 133.93 225.62 -146.76 0.32 -0.87 -0.37 0.13 0
3430 290.00 180.00 -103.54 0.13 -0.19 0.97 0.68 0


.. GENERATED FROM PYTHON SOURCE LINES 64-75 Data initialization: ~~~~~~~~~~~~~~~~~~~~ Suggested size of the axis-aligned modeling box: Origin: -5 -5 -200 Maximum: 305 405 -50 Suggested resolution: 2m (grid size 156 x 206 x 76) .. GENERATED FROM PYTHON SOURCE LINES 78-81 Only using one orientation because otherwhise it gets a mess ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 83-84 Number voxels .. GENERATED FROM PYTHON SOURCE LINES 84-86 .. code-block:: python3 np.array([156, 206, 76]).prod() .. rst-class:: sphx-glr-script-out Out: .. code-block:: none 2442336 .. GENERATED FROM PYTHON SOURCE LINES 87-97 .. code-block:: python3 resolution_requ = [156, 206, 76] resolution = [77, 103, 38] resolution_low = [45, 51, 38] geo_model = gp.create_model('Moureze') geo_model = gp.init_data(geo_model, extent=[-5, 305, -5, 405, -200, -50], resolution=resolution_low, surface_points_df=surfpoints, orientations_df=orientations, surface_name='surface', add_basement=True) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Active grids: ['regular'] .. GENERATED FROM PYTHON SOURCE LINES 98-100 Now we can see how the data looks so far: .. GENERATED FROM PYTHON SOURCE LINES 102-104 .. code-block:: python3 gp.plot_2d(geo_model, direction='y') .. image:: /examples/real/images/sphx_glr_Moureze_001.png :alt: Cell Number: mid Direction: y :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 105-108 .. code-block:: python3 gp.set_interpolator(geo_model, theano_optimizer='fast_run', dtype='float64') .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Setting kriging parameters to their default values. Compiling theano function... Level of Optimization: fast_run Device: cpu Precision: float64 Number of faults: 0 Compilation Done! Kriging values: values range 535.44 $C_o$ 6826.19 drift equations [3, 3] .. GENERATED FROM PYTHON SOURCE LINES 109-113 The default range is always the diagonal of the extent. Since in this model data is very close we will need to reduce the range to 5-10% of that value: .. GENERATED FROM PYTHON SOURCE LINES 115-119 .. code-block:: python3 new_range = geo_model.get_additional_data().loc[('Kriging', 'range'), 'values'] * 0.2 geo_model.modify_kriging_parameters('range', new_range) .. raw:: html
values
range 107.09
$C_o$ 6826.19
drift equations [3, 3]


.. GENERATED FROM PYTHON SOURCE LINES 120-122 .. code-block:: python3 gp.compute_model(geo_model, set_solutions=True, sort_surfaces=False) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Lithology ids [2. 2. 2. ... 1. 1. 1.] .. GENERATED FROM PYTHON SOURCE LINES 123-148 Time ~~~~ 300k voxels 3.5k points ^^^^^^^^^^^^^^^^^^^^^^^ - Nvidia 2080: 500 ms ± 1.3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each), Memory 1 Gb - CPU 14.2 s ± 82.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each), Memory: 1.3 Gb 2.4 M voxels, 3.5k points ^^^^^^^^^^^^^^^^^^^^^^^^^ - CPU 2min 33s ± 216 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) Memory: 1.3 GB - Nvidia 2080: 1.92 s ± 6.74 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 1 Gb 2.4 M voxels, 3.5k points 3.5 k orientations ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Nvidia 2080: 2.53 s ± 1.31 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) .. GENERATED FROM PYTHON SOURCE LINES 150-152 .. code-block:: python3 gp.plot_2d(geo_model, cell_number=[16], series_n=0, show_scalar=True) .. image:: /examples/real/images/sphx_glr_Moureze_002.png :alt: Cell Number: 16 Direction: y :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 153-155 .. code-block:: python3 gp.plot_2d(geo_model, cell_number=16, show_data=True, direction='y') .. image:: /examples/real/images/sphx_glr_Moureze_003.png :alt: Cell Number: 16 Direction: y :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 156-157 sphinx_gallery_thumbnail_number = 4 .. GENERATED FROM PYTHON SOURCE LINES 157-160 .. code-block:: python3 gp.plot_3d(geo_model) .. image:: /examples/real/images/sphx_glr_Moureze_004.png :alt: Moureze :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 161-166 |image0| .. |image0| image:: ./Moureze.png .. GENERATED FROM PYTHON SOURCE LINES 169-176 Export data: ~~~~~~~~~~~~ The solution is stored in a numpy array of the following shape. Axis 0 are the scalar fields of each correspondent series/faults in the following order (except basement): .. GENERATED FROM PYTHON SOURCE LINES 178-180 .. code-block:: python3 geo_model.series .. raw:: html
order_series BottomRelation isActive isFault isFinite
Default series 1 Erosion True False False
Basement 2 Erosion False False False


.. GENERATED FROM PYTHON SOURCE LINES 181-184 For the surfaces, there are two numpy arrays, one with vertices and the other with triangles. Axis 0 is each surface in the order: .. GENERATED FROM PYTHON SOURCE LINES 186-189 .. code-block:: python3 geo_model.surfaces .. raw:: html
surface series order_surfaces color id
0 0 Default series 1 #015482 1
1 basement Basement 1 #9f0052 2


.. GENERATED FROM PYTHON SOURCE LINES 190-194 np.save('Moureze_scalar', geo_model.solutions.scalar_field_matrix) np.save('Moureze_ver', geo_model.solutions.vertices) np.save('Moureze_edges', geo_model.solutions.edges) gp.plot.export_to_vtk(geo_model, 'Moureze') .. GENERATED FROM PYTHON SOURCE LINES 194-195 .. code-block:: python3 gp.save_model(geo_model) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none True .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 2 minutes 4.415 seconds) .. _sphx_glr_download_examples_real_Moureze.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: Moureze.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Moureze.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_