db.grid2point.sampling {RGeostats}R Documentation

Extract samples from a regular grid

Description

Extract samples from a regular grid

Usage

db.grid2point.sampling(dbgrid, names = db.getname(dbgrid, "z", 1), 
                       npack = 3, npcell = 1, nmini = 1)

Arguments

dbgrid

The db-class where the input variable is read. It must be organized as a regular grid in 1-D, 2-D or 3-D space.

names

The list of variables which will be copied in the resulting Db.

npack

Number of cells of the fine input grid that are regrouped to form a cell from which one or several samples are randomly selected. This argument should be a vector with a dimension equal to the space dimension of 'dbgrid' argument. If dimension do not match, the value of the first element of 'npacks' is duplicated.

npcell

Number of samples extracted for each cell.

nmini

No sample is extracted if the number of grid nodes per cell is smaller than 'nmini'

Details

A coarse grid of cells is overlaid to the initial fine grid. The dimension of the cell is equal to the dimension of the fine grid multiplied by 'nfacts'. Per cell, 'npcell' nodes are randomly chosen. Their collection form the returned data base.

Value

The returned db-class (organized as isolated points) with the following variables:

Examples

	grid = db.create(nx=c(30,30))
	grid = db.add(grid,z1=runif(grid$nech))
	db = db.grid2point.sampling(grid,npack=5)
	plot(grid,name.post="rank",flag.aspoint=TRUE,pch=1)
	plot(db,name.post="rank",add=TRUE,col="blue",pch=19)
	rm(grid,db)

[Package RGeostats version 14.0.10 Index]