.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/05_kriging/00_simple_kriging.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_05_kriging_00_simple_kriging.py: Simple Kriging -------------- Simple kriging assumes a known mean of the data. For simplicity we assume a mean of 0, which can be achieved by subtracting the mean from the observed values and subsequently adding it to the resulting data. The resulting equation system for :math:`W` is given by: .. math:: W = \begin{pmatrix}c(x_1,x_1) & \cdots & c(x_1,x_n) \\ \vdots & \ddots & \vdots \\ c(x_n,x_1) & \cdots & c(x_n,x_n) \end{pmatrix}^{-1} \begin{pmatrix}c(x_1,x_0) \\ \vdots \\ c(x_n,x_0) \end{pmatrix} Thereby :math:`c(x_i,x_j)` is the covariance of the given observations. Example ^^^^^^^ Here we use simple kriging in 1D (for plotting reasons) with 5 given observations/conditions. The mean of the field has to be given beforehand. .. GENERATED FROM PYTHON SOURCE LINES 30-43 .. code-block:: Python import numpy as np from gstools import Gaussian, krige # condtions cond_pos = [0.3, 1.9, 1.1, 3.3, 4.7] cond_val = [0.47, 0.56, 0.74, 1.47, 1.74] # resulting grid gridx = np.linspace(0.0, 15.0, 151) # spatial random field class model = Gaussian(dim=1, var=0.5, len_scale=2) .. GENERATED FROM PYTHON SOURCE LINES 44-47 .. code-block:: Python krig = krige.Simple(model, mean=1, cond_pos=cond_pos, cond_val=cond_val) krig(gridx) .. GENERATED FROM PYTHON SOURCE LINES 48-51 .. code-block:: Python ax = krig.plot() ax.scatter(cond_pos, cond_val, color="k", zorder=10, label="Conditions") ax.legend() .. image-sg:: /examples/05_kriging/images/sphx_glr_00_simple_kriging_001.png :alt: Field 1D: (151,) :srcset: /examples/05_kriging/images/sphx_glr_00_simple_kriging_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.072 seconds) .. _sphx_glr_download_examples_05_kriging_00_simple_kriging.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 00_simple_kriging.ipynb <00_simple_kriging.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 00_simple_kriging.py <00_simple_kriging.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 00_simple_kriging.zip <00_simple_kriging.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_