質問

I am using the automap library where I want to use autokrige to interpolate rainfall data. The resulting interpolated map has different dimensions (different number of rows and colums) than my prediction points map. How is this possible? Please see my code below:

library(automap)
library(raster)
library(rgdal)

r <- read.table("c:\\Active\\2013-001_Qfever\\model\\data\\output_kriging\\raindata_old1.txt", header = TRUE, skip = 2, sep="")
coordinates(r) = ~x+y

predmap <- readGDAL(fname="c:\\Active\\2013-001_Qfever\\model\\NLclone_scalar.map")
kriging_result <- autoKrige(rain~1, r, predmap)

plot(kriging_result)

xyz <- as.data.frame(kriging_result$krige_output)                                                 
head(xyz)
p = xyz[,c('x','y','var1.pred')]

output <- rasterFromXYZ(p, res=c(250,250), crs="+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs", digits=5)

writeRaster(output, "c:\\Active\\2013-001_Qfever\\model\\data\\output_kriging\\test.asc", format="ascii")
plot(output)

正しい解決策はありません

他のヒント

Replace the following lines in your code, it will work-

p = xyz[,c('x1','x2','var1.pred')]
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top