We define the Space dimension
defineDefaultSpace(ESpaceType_RN(), 2)
## NULL
Creating a dummy Model used for simulating a random field
mymodel = Model_createFromParam(ECov_CUBIC(), range=10, sill=1)
We construct a standard non rotated 2-D grid with two simulated variables
nx = c(70,25)
dx = c(1,2)
x0 = c(-40, 20)
mygrid = DbGrid_create(nx,dx,x0)
err = simtub(NULL,mygrid,mymodel,nbsimu=2)
mygrid$display()
##
## Data Base Grid Characteristics
## ==============================
##
## Data Base Summary
## -----------------
## File is organized as a regular grid
## Space dimension = 2
## Number of Columns = 5
## Total number of samples = 1750
##
## Grid characteristics:
## ---------------------
## Origin : -40.000 20.000
## Mesh : 1.000 2.000
## Number : 70 25
##
## Variables
## ---------
## Column = 0 - Name = rank - Locator = NA
## Column = 1 - Name = x1 - Locator = x1
## Column = 2 - Name = x2 - Locator = x2
## Column = 3 - Name = Simu.1 - Locator = z1
## Column = 4 - Name = Simu.2 - Locator = z2
## NULL
We construct a Selection
mygrid["sel"] = 1. -
(mygrid["x1"] > 0) * (mygrid["x1"] < 15) * (mygrid["x2"] > 40) * (mygrid["x2"] < 50)
err = mygrid$setLocator("sel",ELoc_SEL())
mygrid
##
## Data Base Grid Characteristics
## ==============================
##
## Data Base Summary
## -----------------
## File is organized as a regular grid
## Space dimension = 2
## Number of Columns = 6
## Total number of samples = 1750
## Number of active samples = 1694
##
## Grid characteristics:
## ---------------------
## Origin : -40.000 20.000
## Mesh : 1.000 2.000
## Number : 70 25
##
## Variables
## ---------
## Column = 0 - Name = rank - Locator = NA
## Column = 1 - Name = x1 - Locator = x1
## Column = 2 - Name = x2 - Locator = x2
## Column = 3 - Name = Simu.1 - Locator = z1
## Column = 4 - Name = Simu.2 - Locator = z2
## Column = 5 - Name = sel - Locator = sel
Displaying the grid cells
p = ggDefaultGeographic()
p = p + plot.grid(mygrid, nameRaster="Simu.1", nameContour="Simu.2",
flagLegendRaster=TRUE, legendNameRaster="ma Legende")
p = p + plot.decoration(title="Display of Grid Cells")
ggPrint(p)