.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/01_random_field/00_gaussian.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_random_field_00_gaussian.py: A Very Simple Example --------------------- We are going to start with a very simple example of a spatial random field with an isotropic Gaussian covariance model and following parameters: - variance :math:`\sigma^2=1` - correlation length :math:`\lambda=10` First, we set things up and create the axes for the field. We are going to need the :any:`SRF` class for the actual generation of the spatial random field. But :any:`SRF` also needs a covariance model and we will simply take the :any:`Gaussian` model. .. GENERATED FROM PYTHON SOURCE LINES 16-21 .. code-block:: Python import gstools as gs x = y = range(100) .. GENERATED FROM PYTHON SOURCE LINES 22-25 Now we create the covariance model with the parameters :math:`\sigma^2` and :math:`\lambda` and hand it over to :any:`SRF`. By specifying a seed, we make sure to create reproducible results: .. GENERATED FROM PYTHON SOURCE LINES 25-29 .. code-block:: Python model = gs.Gaussian(dim=2, var=1, len_scale=10) srf = gs.SRF(model, seed=20170519) .. GENERATED FROM PYTHON SOURCE LINES 30-33 With these simple steps, everything is ready to create our first random field. We will create the field on a structured grid (as you might have guessed from the `x` and `y`), which makes it easier to plot. .. GENERATED FROM PYTHON SOURCE LINES 33-37 .. code-block:: Python field = srf.structured([x, y]) srf.plot() .. image-sg:: /examples/01_random_field/images/sphx_glr_00_gaussian_001.png :alt: Field 2D structured: (100, 100) :srcset: /examples/01_random_field/images/sphx_glr_00_gaussian_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 38-39 Wow, that was pretty easy! .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.401 seconds) .. _sphx_glr_download_examples_01_random_field_00_gaussian.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 00_gaussian.ipynb <00_gaussian.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 00_gaussian.py <00_gaussian.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 00_gaussian.zip <00_gaussian.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_