.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/01_universal.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_01_universal.py: Universal Kriging Example ========================= In this example we apply a regional linear trend to the kriging system. .. GENERATED FROM PYTHON SOURCE LINES 8-27 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from pykrige.uk import UniversalKriging data = np.array( [ [0.3, 1.2, 0.47], [1.9, 0.6, 0.56], [1.1, 3.2, 0.74], [3.3, 4.4, 1.47], [4.7, 3.8, 1.74], ] ) gridx = np.arange(0.0, 5.5, 0.5) gridy = np.arange(0.0, 5.5, 0.5) .. GENERATED FROM PYTHON SOURCE LINES 28-34 Create the universal kriging object. Required inputs are the X-coordinates of the data points, the Y-coordinates of the data points, and the Z-values of the data points. Variogram is handled as in the ordinary kriging case. drift_terms is a list of the drift terms to include; currently supported terms are 'regional_linear', 'point_log', and 'external_Z'. Refer to UniversalKriging.__doc__ for more information. .. GENERATED FROM PYTHON SOURCE LINES 34-43 .. code-block:: Python UK = UniversalKriging( data[:, 0], data[:, 1], data[:, 2], variogram_model="linear", drift_terms=["regional_linear"], ) .. GENERATED FROM PYTHON SOURCE LINES 44-47 Creates the kriged grid and the variance grid. Allows for kriging on a rectangular grid of points, on a masked rectangular grid of points, or with arbitrary points. (See UniversalKriging.__doc__ for more information.) .. GENERATED FROM PYTHON SOURCE LINES 47-51 .. code-block:: Python z, ss = UK.execute("grid", gridx, gridy) plt.imshow(z) plt.show() .. image-sg:: /examples/images/sphx_glr_01_universal_001.png :alt: 01 universal :srcset: /examples/images/sphx_glr_01_universal_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.052 seconds) .. _sphx_glr_download_examples_01_universal.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 01_universal.ipynb <01_universal.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 01_universal.py <01_universal.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 01_universal.zip <01_universal.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_