simpgs {RGeostats} | R Documentation |
Plurigaussian conditional simulations
simpgs(dbin = NA, dbout, dbprop = NA, rule = rule.input(), model1 = NA, model2 = NA, neigh=neigh.input(), props = NA, nostat=NA, flag.gaus = FALSE, flag.prop=FALSE, flag.check=FALSE, flag.show = FALSE, seed = 232131, nbsimu = 1, nbtuba = 100, ngburn = 10, ngiter = 100, ngint=5, percent=0.1, flag.spde=FALSE, triswitch="nqQ", gext=NA, verbose=FALSE, accept.fun = NA, accept.nloop.max = 10, accept.verbose=TRUE, radix = "SimPGS", modify.target = db.locmod())
dbin |
The |
dbout |
The |
dbprop |
The |
rule |
The |
model1 |
The |
model2 |
The |
neigh |
The |
props |
Array giving the (constant) proportions of the different facies
involved in the Lithotype rule. See details in |
nostat |
List of non-stationary parameters.
For details see |
flag.gaus |
When FALSE, the simulation outcome is coded into facies. When TRUE, the (conditional) simulation is kept in the gaussian scale |
flag.prop |
When TRUE, the procedure returns the proportion of facies, rather than the simulations |
flag.check |
When TRUE (and if dbin is defined), the facies of conditioning data is compared to the facies of the closest grid node. |
flag.show |
When TRUE (and if dbin is defined), the grid node which coincides with a data is represented with the data facies (with a negative sign). |
seed |
Seed used for the generation of random numbers. When 0, the seed is not initialized. |
nbsimu |
Number of simulations |
nbtuba |
Number of turning bands |
ngburn |
Number of iterations performed for bootstrap |
ngiter |
Maximum number of iterations for calculating the conditional expectation |
ngint |
Number of iterations inside the Gibbs sampler iterative algorithm (only for SPDE technology) |
percent |
Amount of nugget effect added to the model if this initial model only contains Gaussian structures. If set to zero, the initial model is kept unchanged. This amount is defined as a percentage of the global variance. |
flag.spde |
When TRUE, the simulation is carried out using SPDE technique. Otherwise the Turning Bands method is used. |
triswitch |
Command line for the internal triangulation step. For more information see
|
gext |
The 'dbout' may be dilated by gext. This argument designates an array, with its dimension equal to the dimension of the space and which contains the extension in each direction. If not defined, the 'dbout' is not dilated and the simulated results may suffer some edge effect problems. |
verbose |
Verbose flag |
accept.fun |
An acceptation function. See details for more information. |
accept.nloop.max |
Maximum number of iterations before 'nbsimu' acceptable simulation outcomes is reached. |
accept.verbose |
When TRUE, the activity of the acceptation function is echoed. |
radix |
Radix of the name given to the simulation outcomes stored in the output Db. |
modify.target |
Decides whether or not the newly created variables will have their
locator defined or not. For more information, see |
The data Db where the simulations outcomes have been added.
The acceptation function must have the following argument:
db db-class
containing the simulated outcome(s)
iatt Rank of the simulated outcome whole validity must be checked/
The function must return a list containing the following items:
ok which must be TRUE if the outcome is accepted or FALSE otherwise.
db which contains the returned Db (which may have been modified by the acceptation function.
When an acceptation function is provided, the simulation procedure is iterated until 'nbsimu' accepted simulations are stored. This iterative procedure is iterated until one of the following criteria is fulfilled:
The number of accepted simulations is reached
The maximum number of loops is reached
# Acceptation function: an outcome is valid if the two samples designated # # by their grid indices ('ranks') belong to the same connected component # accept <- function(db,iatt) { # Locations of wells in the grid # ranks = c(5021, 5081) # Perform the Connected components # a = db a = db.locate(a,iatt,"z") a = morpho(a,0.5,1.5,oper="cc") cc.rank = a$natt # Do all wells belong to same CC # ok = TRUE if (length(unique(a[ranks,cc.rank])) > 1) ok = FALSE if (ok) { vect = ifelse(a[,cc.rank] != a[ranks[1],cc.rank],0,1) db[,iatt] = ifelse(is.na(vect),0,vect) } res = list(ok=ok, db=db) res } # Perform a conditional simulation of facies # nbsimu = 25 model = model.create(vartype="Cubic",range=30) rule = rule.create(c("S","F1","F2")) x1 = c(20,80,50) x2 = c(50,50,50) z1 = c(1,1,2) data=db.create(x1=x1,x2=x2,z1=z1) neigh = neigh.create(type=0) grid = db.create(nx=c(100,100)) grid = simpgs(data,grid,rule=rule,model1=model,neigh=neigh, accept.fun=accept,nbsimu=nbsimu,nbtuba=1000) grid = db.locerase(grid,"z") grid = db.compare(grid,names="SimPGS*",fun="mean") plot(grid,title="Connectivity probability",pos.legend=1) plot(data,add=TRUE,name.post=1,pch=19,col=c("yellow","red")[z1]) rm(grid,model,rule,data,neigh,nbsimu,accept,x1,x2,z1)