db.grid.fill {RGeostats} | R Documentation |
Fill the empty cells of a Grid
db.grid.fill(db, mode = 0, seed = 1321, radius = 1, radix="Grid.Fill", modify.target=db.locmod())
db |
The |
mode |
Type of filling function. This depends on the dimension of the Grid. For a Space Dimension > 1, the type of filling is:
For a 1-D regular grid, the type of filling is:
|
seed |
Random seed |
radius |
Neighborhood radius |
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 |
The Z-variable defined on a grid is filled if necessary. When a cell is not defined, its value is derived by interpolation from its nearest neighbors. The procedure is performed by successive rings, starting from the periphery of the cells where the target variable is initially defined. This procedure is iterated until all the cells are filled. This procedure is meant to avoid spurious artefacts linked to strong uncontrolled extrapolation.
The db-class
of grid type where the target variable is filled.
# Example for ndim>1 grid = db.create(nx=c(100,100)) grid = simtub(,grid,model.create(vartype=4,range=20)) plot(grid,title="Reference map") grid = db.rename(grid,grid$natt,"my.var") grid = db.add(grid,my.new.var = ifelse(my.var > 1,NA,my.var)) grid = db.grid.fill(grid) plot(grid,title="Reconstructed map") rm(grid) # Example in 1-D db1D = db.create(nx=600,dx=0.01) db1D = db.add(db1D,real=sin(db1D$x1)) data = rep(NA,db1D$nech) index = sort(unique(floor(db1D$nech*runif(10)))) data[index] = db1D[index,"real"] db1D = db.add(db1D,data) plot(db1D,name.post="data",pch=19,col="red") db1D = db.grid.fill(db1D,mode=1,modify.target=FALSE,radix="spline") plot(db1D,add=TRUE,name="spline*") db1D = db.grid.fill(db1D,mode=0,modify.target=FALSE,radix="linear") plot(db1D,add=TRUE,name="linear*") rm(db1D)