这是错误消息:
“在 writeBin(v, x@file@con, size = x@file@dsize) 中:写入连接 6 的问题:在 .rasterFromRasterFile(grdfile, band = band, objecttype) 中:值文件的大小与单元格(给定数据类型)"
我有 15 个相同范围和维度的栅格文件。我只想找出跨时间(15 年)的数据的相关性,即 15 个栅格文件。
我使用了下面的脚本:
list <- c(list.files(pattern = "\\.tif$"))
y <- stack()
for (i in 1:length(list)){
y <- stack(y,list[i]) }
corT <- layerStats(y, 'pearson', na.rm=TRUE)
或者像这样直接使用堆叠文件
test = brick ("EOS_ALL_STACK.tif")
corT = layerStats(test, 'pearson', na.rm=TRUE)
我还尝试使用此函数来获取相关系数和 r 平方,如下所示
fun5=function(x) { if (is.na(x[1])){ NA } else { m <- lm(x[1:15] ~ c(1:15));summary(m)$coefficients[1,4]}} #fstatistic[1]
fun5=function(x) { if (is.na(x[1])){ NA } else { m <- lm(x[1:15] ~ c(1:15));summary(m)$coefficients[2,4]}} #fstatistic[2]
fun3=function(x) { if (is.na(x[1])){ NA } else { m <- lm(x[1:15] ~ x[1:15]);summary(m)$r.squared }}
然后使用“calc”在所有像素上计算这些。例如:
r.squared <- calc(y, fun3)
但是,我的结果仍然存在上述错误,即使有输出,也似乎没有意义。