.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/11_plurigaussian/03_correlations.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_11_plurigaussian_03_correlations.py: Understanding the Influence of Variograms ----------------------------------------- Up until now, we have only used very smooth Gaussian variograms for the underlying spatial random fields. Now, we will combine a smooth Gaussian field with a much rougher exponential field. This example should feel familiar, if you had a look at the previous examples. .. GENERATED FROM PYTHON SOURCE LINES 10-23 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np import gstools as gs dim = 2 # no. of cells in both dimensions N = [200, 200] x = np.arange(N[0]) y = np.arange(N[1]) .. GENERATED FROM PYTHON SOURCE LINES 24-25 Now, we generate fields with a Gaussian and an Exponential variogram. .. GENERATED FROM PYTHON SOURCE LINES 25-33 .. code-block:: Python model1 = gs.Gaussian(dim=dim, var=1, len_scale=[50, 25]) srf1 = gs.SRF(model1) field1 = srf1.structured([x, y], seed=20170519) model2 = gs.Exponential(dim=dim, var=1, len_scale=[40, 40]) srf2 = gs.SRF(model2) field2 = srf2.structured([x, y], seed=19970221) .. GENERATED FROM PYTHON SOURCE LINES 34-36 The lithotypes will consist of a circle which contains one category and the surrounding is the second category. .. GENERATED FROM PYTHON SOURCE LINES 36-51 .. code-block:: Python # no. of grid cells of the lithotypes M = [200, 200] # radius of circle radius = 25 x_lith = np.arange(M[0]) y_lith = np.arange(M[1]) lithotypes = np.zeros(M) mask = (x_lith[:, np.newaxis] - M[0] // 2) ** 2 + ( y_lith[np.newaxis, :] - M[1] // 2 ) ** 2 < radius**2 lithotypes[mask] = 1 .. GENERATED FROM PYTHON SOURCE LINES 52-53 With the two SRFs and the lithotypes ready, we can create the PGS. .. GENERATED FROM PYTHON SOURCE LINES 53-56 .. code-block:: Python pgs = gs.PGS(dim, [field1, field2]) P = pgs(lithotypes) .. GENERATED FROM PYTHON SOURCE LINES 57-58 And now the plotting of the two Gaussian fields, the lithotypes, and the PGS. .. GENERATED FROM PYTHON SOURCE LINES 58-66 .. code-block:: Python fig, axs = plt.subplots(2, 2) axs[0, 0].imshow(field1, cmap="copper", origin="lower") axs[0, 1].imshow(field2, cmap="copper", origin="lower") axs[1, 0].imshow(lithotypes, cmap="copper", origin="lower") axs[1, 1].imshow(P, cmap="copper", origin="lower") .. image-sg:: /examples/11_plurigaussian/images/sphx_glr_03_correlations_001.png :alt: 03 correlations :srcset: /examples/11_plurigaussian/images/sphx_glr_03_correlations_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 67-70 In this PGS, we can see two different spatial structures combined. We see large and rather smooth structures and shapes, which are surrounded by very rough and unconnected patches. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.116 seconds) .. _sphx_glr_download_examples_11_plurigaussian_03_correlations.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 03_correlations.ipynb <03_correlations.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 03_correlations.py <03_correlations.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 03_correlations.zip <03_correlations.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_