Tutorials
Juyter Logo

Bimodal fields

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

We provide two transformations to obtain bimodal distributions:

Both transformations will preserve the mean and variance of the given field by default.

See: transform.normal_to_arcsin and transform.normal_to_uquad

import gstools as gs

# structured field with a size of 100x100 and a grid-size of 1x1
x = y = range(101)
model = gs.Gaussian(dim=2, var=1, len_scale=10)
srf = gs.SRF(model, seed=20220425)
field = srf.structured([x, y])
srf.transform("normal_to_arcsin")  # also "arcsin" works
srf.plot()
plt.figure()
plt.hist(srf.field.ravel(), bins=50)
plt.show()