.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/05_kriging/04_extdrift_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_04_extdrift_kriging.py: External Drift Kriging ---------------------- .. GENERATED FROM PYTHON SOURCE LINES 5-27 .. image-sg:: /examples/05_kriging/images/sphx_glr_04_extdrift_kriging_001.png :alt: Field 1D: (151,) :srcset: /examples/05_kriging/images/sphx_glr_04_extdrift_kriging_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np from gstools import SRF, Gaussian, krige # synthetic condtions with a drift drift_model = Gaussian(dim=1, len_scale=4) drift = SRF(drift_model, seed=1010) cond_pos = [0.3, 1.9, 1.1, 3.3, 4.7] ext_drift = drift(cond_pos) cond_val = ext_drift * 2 + 1 # resulting grid gridx = np.linspace(0.0, 15.0, 151) grid_drift = drift(gridx) # kriging model = Gaussian(dim=1, var=2, len_scale=4) krig = krige.ExtDrift(model, cond_pos, cond_val, ext_drift) krig(gridx, ext_drift=grid_drift) ax = krig.plot() ax.scatter(cond_pos, cond_val, color="k", zorder=10, label="Conditions") ax.plot(gridx, grid_drift, label="drift") ax.legend() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.055 seconds) .. _sphx_glr_download_examples_05_kriging_04_extdrift_kriging.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 04_extdrift_kriging.ipynb <04_extdrift_kriging.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 04_extdrift_kriging.py <04_extdrift_kriging.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 04_extdrift_kriging.zip <04_extdrift_kriging.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_