Note
Go to the end to download the full example code.
Creating an Ensemble of Fields
Creating an ensemble of random fields would also be a great idea. Let’s reuse most of the previous code.
We will set the position tuple pos before generation to reuse it afterwards.
This time, we did not provide a seed to SRF
, as the seeds will used
during the actual computation of the fields. We will create four ensemble
members, for better visualisation, save them in to srf class and in a first
step, we will be using the loop counter as the seeds.
ens_no = 4
for i in range(ens_no):
srf(seed=i, store=f"field{i}")
Now let’s have a look at the results. We can access the fields by name or index:

Using better Seeds
It is not always a good idea to use incrementing seeds. Therefore GSTools
provides a seed generator MasterRNG
. The loop, in which the fields are
generated would then look like
from gstools.random import MasterRNG
seed = MasterRNG(20170519)
for i in range(ens_no):
srf(seed=seed(), store=f"better_field{i}")
Total running time of the script: (0 minutes 2.630 seconds)