{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Anisotropy and Rotation\n\nThe internally used (semi-) variogram\nrepresents the isotropic case for the model.\nNevertheless, you can provide anisotropy ratios by:\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import gstools as gs\n\nmodel = gs.Gaussian(dim=3, var=2.0, len_scale=10, anis=0.5)\nprint(model.anis)\nprint(model.len_scale_vec)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "As you can see, we defined just one anisotropy-ratio\nand the second transversal direction was filled up with ``1.``.\nYou can get the length-scales in each direction by\nthe attribute :any:`CovModel.len_scale_vec`. For full control you can set\na list of anistropy ratios: ``anis=[0.5, 0.4]``.\n\nAlternatively you can provide a list of length-scales:\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "model = gs.Gaussian(dim=3, var=2.0, len_scale=[10, 5, 4])\nmodel.plot(\"vario_spatial\")\nprint(\"Anisotropy representations:\")\nprint(\"Anis. ratios:\", model.anis)\nprint(\"Main length scale\", model.len_scale)\nprint(\"All length scales\", model.len_scale_vec)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Rotation Angles\n\nThe main directions of the field don't have to coincide with the spatial\ndirections $x$, $y$ and $z$. Therefore you can provide\nrotation angles for the model:\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "model = gs.Gaussian(dim=3, var=2.0, len_scale=[10, 2], angles=2.5)\nmodel.plot(\"vario_spatial\")\nprint(\"Rotation angles\", model.angles)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Again, the angles were filled up with ``0.`` to match the dimension and you\ncould also provide a list of angles. The number of angles depends on the\ngiven dimension:\n\n- in 1D: no rotation performable\n- in 2D: given as rotation around z-axis\n- in 3D: given by yaw, pitch, and roll (known as\n  [Tait\u2013Bryan](https://en.wikipedia.org/wiki/Euler_angles#Tait-Bryan_angles)\n  angles)\n- in nD: See the random field example about higher dimensions\n\n"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.8.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}