ASCII to raster conversion

China☆狼群 提交于 2019-12-11 04:05:41

问题


I am using following code for opening a Raster image in single band (with temperature values)-

library(raster)
nrows = 764
ncols = 1022
df1 <- read.table("AA092800_1.asc", skip = 11, header = FALSE, sep = "\t", dec = ",")
r.mat <- matrix(data = "df1", nrow = nrows, ncol = ncols)
r <- raster(r.mat)
extent(r) <- extent(c(30,45.95,30,45.95))
res(r)

plot(r)

I am doing a silly mistake and the code is throwing the error-

"Error in setValues(r, as.vector(t(x))) : values must be numeric, integer, logical or factor"

The input Ascii file is attached.input Ascii file.

Please help.

来源:https://stackoverflow.com/questions/42087320/ascii-to-raster-conversion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!