Transform 22

Basic Methods

%matplotlib widget
import matplotlib.pyplot as plt
# turn of warnings
import warnings

The covariance model class CovModel of GSTools provides a set of handy methods.

One of the following functions defines the main characterization of the variogram:

  • CovModel.variogram : The variogram of the model given by

    γ(r)=σ2(1cor(sr))+n\gamma\left(r\right)= \sigma^2\cdot\left(1-\mathrm{cor}\left(s\cdot\frac{r}{\ell}\right)\right)+n

  • CovModel.covariance : The (auto-)covariance of the model given by

    C(r)=σ2cor(sr)C\left(r\right)= \sigma^2\cdot\mathrm{cor}\left(s\cdot\frac{r}{\ell}\right)

  • CovModel.correlation : The (auto-)correlation (or normalized covariance) of the model given by

    ρ(r)=cor(sr)\rho\left(r\right) = \mathrm{cor}\left(s\cdot\frac{r}{\ell}\right)

  • CovModel.cor : The normalized correlation taking a normalized range given by:


As you can see, it is the easiest way to define a covariance model by giving a correlation function as demonstrated in the introductory example. If one of the above functions is given, the others will be determined:

import gstools as gs

model = gs.Exponential(dim=3, var=2.0, len_scale=10, nugget=0.5)
ax = model.plot("variogram")
model.plot("covariance", ax=ax)
model.plot("correlation", ax=ax)