Tutorials
Juyter Logo

Creating Fancier Fields

%matplotlib widget
import matplotlib.pyplot as plt
plt.ioff()
# turn of warnings
import warnings
warnings.filterwarnings('ignore')

Only using Gaussian covariance fields gets boring. Now we are going to create much rougher random fields by using an exponential covariance model and we are going to make them anisotropic.

The code is very similar to the previous examples, but with a different covariance model class Exponential. As model parameters we a using following

  • variance σ2=1\sigma^2=1
  • correlation length =(12,3)T\ell=(12, 3)^T
  • rotation angle θ=π/8\theta=\pi/8
import numpy as np
import gstools as gs

x = y = np.arange(0, 101)
model = gs.Exponential(
    dim=2,
    var=1,
    len_scale=[12.0, 3.0],
    angles=np.deg2rad(22.5),
)
srf = gs.SRF(model, seed=20170519)
srf.structured([x, y])
srf.plot()
print(model)
Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …
Exponential(dim=2, var=1.0, len_scale=12.0, nugget=0.0, anis=[0.25], angles=[0.393])

The anisotropy ratio could also have been set with

model = gs.Exponential(dim=2, var=1, len_scale=12, anis=1/4, angles=np.deg2rad(22.5))
print(model)
Exponential(dim=2, var=1.0, len_scale=12.0, nugget=0.0, anis=[0.25], angles=[0.393])