Skip to content

Generating several realizations of srf in one call. #339

Answered by MuellerSeb
Kivou-2000607 asked this question in Q&A
Discussion options

You must be logged in to vote

In the documentation we provide a tutorial for ensemble generation of random fields:
https://geostat-framework.readthedocs.io/projects/gstools/en/v1.5.0/examples/01_random_field/01_srf_ensemble.html

import gstools as gs
from gstools.random import MasterRNG

x = y = range(100)

model = gs.Gaussian(dim=2, var=1, len_scale=10)
srf = gs.SRF(model)
srf.set_pos([x, y], "structured")

ens_no = 4

seed = MasterRNG(20170519)
for i in range(ens_no):
    srf(seed=seed(), store=f"field{i}")

The randomization method is quiet efficient when it is called again with a new seed, since the sampling needed should be rather fast.
The advantage of that method is, that it doesn't need to decompose a covariance…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Kivou-2000607
Comment options

Answer selected by Kivou-2000607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants