simtub {RGeostats}R Documentation

Performs Simulations

Description

Performs conditional or non-conditional simulations using Turning Bands

Usage

simtub(dbin = NA, dbout, model = model.input(), neigh = neigh.input(), 
       uc = c("1"), mean = NA, seed = 232131, nbsimu = 1,
       nbtuba = 100, anam = NA, 
       accept.fun = NA, accept.nloop.max = 10, accept.verbose=TRUE,
       flag.check=FALSE, radix = "Simu",modify.target = db.locmod())

Arguments

dbin

The db-class structure containing the data file. This file is optional. If absent, non-conditional simulations are performed.

dbout

The db-class structure containing the target file

model

The model-class structure containing the Model information.

neigh

The neigh-class structure containing the Neighborhood information. This structure is compulsory for conditional simulations.

uc

The drift description. Use command uc.names for details.

mean

Array containing the mean of each variable.

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

anam

The anam-class containing the characteristics of the Anamorphosis. When defined, the simulation resulting outcome is backtransformed (from Gaussian to Raw scale) before storage.

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.

flag.check

When TRUE, the Gaussian value of the conditional simulation is compared to the value of the closest data.

radix

Radix of the name given to the variables storing the results in the target Db.

modify.target

Decides whether or not the newly created variables will have their locator defined or not. For more information, see db.locmod.

Value

The target Db where 'nbsimu' variables have been added. These variables are multiplied for each one of the data variables.

The acceptation function must have the following argument:

The function must return a list containing the following items:

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:

Examples


# Acceptation function: an outcome is valid if more than 90 per cent #
# of its pixels have a value larger than -1                          #

accept <- function(db,iatt) 
{
  ok  = (mean(db.extract(db,iatt) > -1) > 0.9)
  res = list(ok=ok, db=db)
  res
}

# Perform a conditional simulation of facies #
nbsimu = 25
grid   = db.create(nx=c(100,100))
model  = model.create(vartype="Cubic",range=70)

grid = simtub(,grid,model=model,
       accept.fun=accept,nbsimu=nbsimu,nbtuba=1000)
grid = db.locerase(grid,"z")
grid = db.compare(grid,names="Simu*",fun="mean")
plot(grid,title="Average of Simulations (under constraints)",pos.legend=1)

rm(grid,model,nbsimu,accept)

[Package RGeostats version 14.0.10 Index]