[R] Cokriging
Gnai Nishani Musafer
g.musafer at qut.edu.au
Tue Mar 19 02:03:46 CET 2013
Dear All,
I run following code to estimate the blocks using cokriging ( my data set has more than 50,000 data points). All the things run finely but Once I run the predict.gstat function it gave the error message - "memory.c", line 58: can't allocate memory in function m_get(). I run this code on LINUX sever but result is same. Would any one please be able to give a solution for this? Any advice regarding this highly appreciated.
Note: same error message gave when I was using krige function . Then I changed the code and add a loop to estimate the one by one. It worked. But this technique not work for cokiriging it gives the same error message.
require(gstat)
require(automap)
data_c <- read.csv("cu_s_data.csv", header=T)
grid<- read.csv("grid.csv", header=T)
coordinates(data_c) <- ~X+Y+Z
coordinates(grid) <- ~x+y+z
proj4string(grid)=CRS("+init=epsg:28992")
proj4string(data_c)=CRS("+init=epsg:28992")
g <- gstat(id = "Cu", formula =Cu~1,data = data_c)
g <- gstat(g, id = "S", formula = S~1,data =data_c)
g <- gstat(g, id = c("Cu", "S"), model = vgm(cov(data_c$Cu,data_c$S) , "Sph", 200, 0))
g<fit.lmc(variogram(g),g,model=vgm(psill=cov(data_c$Cu,data_c$S),model="Sph",range=200,nugget=0))
k.c <- predict.gstat(g, grid,block = c(30,30,15))
Thanks and Regards,
Nishani Musafer
More information about the R-help
mailing list