How do I ensure a 3D synthetic random field reproduces its variogram using R gstat

83 Views Asked by At

I have attempted to generate a 3D synthetic spatial random field using unconditional simulation in R gstat; with the lines below. However, my attempts to check if the exhaustive data can reproduce the variogram used in generating the field have been unsuccessful. When I make the field isotropic; the variogram model is reproduced easily. But when I make it anisotropic (as below); I noticed that both 90-deg (major continuity) and 0-deg (minor continuity) directions resulted in same variogram values and plots; and the range is always around 45 distance units. I expect 90 distance units as major range and 45 as minor.

I had avoided setting grid = TRUE in the variogram call; as pointed out in response to a similar question in this Stack Overflow.

library(gstat)
library(sp)

delta_X = 20
delta_Y = 20
delta_Z = 10
grd=expand.grid(1:10,1:10,1:5)
names(grd) = c("x","y","z")
BlockEasting = (delta_X*(grd$x-0.5))+0 #This is the x-coordinate of the block center.
BlockNorthing = (delta_Y*(grd$y-0.5))+0 #This is the y-coordinate of the block center.
BlockDepth = (delta_Z*(grd$z-0.5))+0 #This is the z-coordinate of the block center.
Scaledgrd = data.frame(BlockEasting, BlockNorthing, BlockDepth) 
SimPar = gstat(formula = p~1, locations=~BlockEasting+BlockNorthing+BlockDepth, dummy=T, beta=0, nmin=8, nmax=16, model= vgm(nugget = 0.02, psill = 0.98, range = 90, model = "Sph", anis=c(90,0,0,0.5,0.1)))
Sim = predict(SimPar, newdata = Scaledgrd, nsim = 1,debug=-1)
SimS = Sim
coordinates(SimS) = ~BlockEasting+BlockNorthing+BlockDepth
VarSim_90azim = variogram(sim1~1,SimS, alpha = 90, beta=0, cutoff = 150)
VarSim_0azim = variogram(sim1~1,SimS, alpha = 0, beta=0, cutoff = 150)
plot(VarSim_90azim$dist, VarSim_90azim$gamma, xlim = c(0,150), ylim = c(0,1.4))
plot(VarSim_0azim$dist, VarSim_0azim$gamma, xlim = c(0,150), ylim = c(0,1.4))

enter image description here

enter image description here

0

There are 0 best solutions below