.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/03_variogram/02_multi_vario.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_03_variogram_02_multi_vario.py: Multi-field variogram estimation -------------------------------- In this example, we demonstrate how to estimate a variogram from multiple fields on the same point-set that should have the same statistical properties. .. GENERATED FROM PYTHON SOURCE LINES 8-19 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np import gstools as gs x = np.random.RandomState(19970221).rand(1000) * 100.0 y = np.random.RandomState(20011012).rand(1000) * 100.0 model = gs.Exponential(dim=2, var=2, len_scale=8) srf = gs.SRF(model, mean=0) .. GENERATED FROM PYTHON SOURCE LINES 20-21 Generate two synthetic fields with an exponential model. .. GENERATED FROM PYTHON SOURCE LINES 21-26 .. code-block:: Python field1 = srf((x, y), seed=19970221) field2 = srf((x, y), seed=20011012) fields = [field1, field2] .. GENERATED FROM PYTHON SOURCE LINES 27-29 Now we estimate the variograms for both fields individually and then again simultaneously with only one call. .. GENERATED FROM PYTHON SOURCE LINES 29-35 .. code-block:: Python bins = np.arange(40) bin_center, gamma1 = gs.vario_estimate((x, y), field1, bins) bin_center, gamma2 = gs.vario_estimate((x, y), field2, bins) bin_center, gamma = gs.vario_estimate((x, y), fields, bins) .. GENERATED FROM PYTHON SOURCE LINES 36-38 Now we demonstrate that the mean variogram from both fields coincides with the joined estimated one. .. GENERATED FROM PYTHON SOURCE LINES 38-45 .. code-block:: Python plt.plot(bin_center, gamma1, label="field 1") plt.plot(bin_center, gamma2, label="field 2") plt.plot(bin_center, gamma, label="joined fields") plt.plot(bin_center, 0.5 * (gamma1 + gamma2), ":", label="field 1+2 mean") plt.legend() plt.show() .. image-sg:: /examples/03_variogram/images/sphx_glr_02_multi_vario_001.png :alt: 02 multi vario :srcset: /examples/03_variogram/images/sphx_glr_02_multi_vario_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.794 seconds) .. _sphx_glr_download_examples_03_variogram_02_multi_vario.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 02_multi_vario.ipynb <02_multi_vario.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 02_multi_vario.py <02_multi_vario.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 02_multi_vario.zip <02_multi_vario.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_