.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/05_kriging/09_pseudo_inverse.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_09_pseudo_inverse.py: Redundant data and pseudo-inverse --------------------------------- It can happen, that the kriging system gets numerically unstable. One reason could be, that the input data contains redundant conditioning points that hold different values. To smoothly deal with such situations, you can use the pseudo inverse for the kriging matrix, which is enabled by default. This will result in the average value for the redundant data. Example ^^^^^^^ In the following we have two different values at the same location. The resulting kriging field will hold the average at this point. .. GENERATED FROM PYTHON SOURCE LINES 20-33 .. code-block:: Python import numpy as np from gstools import Gaussian, krige # condtions cond_pos = [0.3, 1.9, 1.1, 3.3, 1.1] cond_val = [0.47, 0.56, 0.74, 1.47, 1.14] # resulting grid gridx = np.linspace(0.0, 8.0, 81) # spatial random field class model = Gaussian(dim=1, var=0.5, len_scale=1) .. GENERATED FROM PYTHON SOURCE LINES 34-37 .. code-block:: Python krig = krige.Ordinary(model, cond_pos=cond_pos, cond_val=cond_val) krig(gridx) .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. 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_09_pseudo_inverse_001.png :alt: Field 1D: (81,) :srcset: /examples/05_kriging/images/sphx_glr_09_pseudo_inverse_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.068 seconds) .. _sphx_glr_download_examples_05_kriging_09_pseudo_inverse.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 09_pseudo_inverse.ipynb <09_pseudo_inverse.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 09_pseudo_inverse.py <09_pseudo_inverse.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 09_pseudo_inverse.zip <09_pseudo_inverse.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_