0

我正在使用 automap 库,我想在其中使用 autokrige 插值降雨数据。生成的插值图与我的预测点图具有不同的维度(不同的行数和列数)。这怎么可能?请在下面查看我的代码:

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)
4

1 回答 1

0

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

p = xyz[,c('x1','x2','var1.pred')]
于 2013-12-30T17:48:23.253 回答