.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/02_cov_model/02_aniso_rotation.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_02_cov_model_02_aniso_rotation.py: Anisotropy and Rotation ======================= The internally used (semi-) variogram represents the isotropic case for the model. Nevertheless, you can provide anisotropy ratios by: .. GENERATED FROM PYTHON SOURCE LINES 9-17 .. code-block:: Python import gstools as gs model = gs.Gaussian(dim=3, var=2.0, len_scale=10, anis=0.5) print(model.anis) print(model.len_scale_vec) .. rst-class:: sphx-glr-script-out .. code-block:: none [1. 0.5] [10. 10. 5.] .. GENERATED FROM PYTHON SOURCE LINES 18-25 As you can see, we defined just one anisotropy-ratio and the second transversal direction was filled up with ``1.``. You can get the length-scales in each direction by the attribute :any:`CovModel.len_scale_vec`. For full control you can set a list of anistropy ratios: ``anis=[0.5, 0.4]``. Alternatively you can provide a list of length-scales: .. GENERATED FROM PYTHON SOURCE LINES 25-34 .. code-block:: Python model = gs.Gaussian(dim=3, var=2.0, len_scale=[10, 5, 4]) model.plot("vario_spatial") print("Anisotropy representations:") print("Anis. ratios:", model.anis) print("Main length scale", model.len_scale) print("All length scales", model.len_scale_vec) .. image-sg:: /examples/02_cov_model/images/sphx_glr_02_aniso_rotation_001.png :alt: Field 3D structured (50, 50, 50), Plane :srcset: /examples/02_cov_model/images/sphx_glr_02_aniso_rotation_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Anisotropy representations: Anis. ratios: [0.5 0.4] Main length scale 10.0 All length scales [10. 5. 4.] .. GENERATED FROM PYTHON SOURCE LINES 35-41 Rotation Angles --------------- The main directions of the field don't have to coincide with the spatial directions :math:`x`, :math:`y` and :math:`z`. Therefore you can provide rotation angles for the model: .. GENERATED FROM PYTHON SOURCE LINES 41-46 .. code-block:: Python model = gs.Gaussian(dim=3, var=2.0, len_scale=[10, 2], angles=2.5) model.plot("vario_spatial") print("Rotation angles", model.angles) .. image-sg:: /examples/02_cov_model/images/sphx_glr_02_aniso_rotation_002.png :alt: Field 3D structured (50, 50, 50), Plane :srcset: /examples/02_cov_model/images/sphx_glr_02_aniso_rotation_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Rotation angles [2.5 0. 0. ] .. GENERATED FROM PYTHON SOURCE LINES 47-57 Again, the angles were filled up with ``0.`` to match the dimension and you could also provide a list of angles. The number of angles depends on the given dimension: - in 1D: no rotation performable - in 2D: given as rotation around z-axis - in 3D: given by yaw, pitch, and roll (known as `Tait–Bryan `_ angles) - in nD: See the random field example about higher dimensions .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.356 seconds) .. _sphx_glr_download_examples_02_cov_model_02_aniso_rotation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 02_aniso_rotation.ipynb <02_aniso_rotation.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 02_aniso_rotation.py <02_aniso_rotation.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 02_aniso_rotation.zip <02_aniso_rotation.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_