我能够从 rasterstack 中提取()并编写 ax,y txt 文件,如此处讨论的 如何使用 xy 坐标从 rasterstack 中提取值?
然而,当我使用一个大的光栅堆栈时,我最终遇到了内存问题。
library(raster)
r <- raster(nrow=1000, ncol=1500)
s <- stack( sapply(1:366, function(i) setValues(r, rnorm(ncell(r), i, 3) )) )
s[1:3]<-NA
vals<-extract(s,1:ncell(s))
Warning messages:
1: In s[1:3] <- NA :
Reached total allocation of 1535Mb: see help(memory.size)
2: In s[1:3] <- NA :
Reached total allocation of 1535Mb: see help(memory.size)
coord<-xyFromCell(s,1:ncell(s))
combine<-cbind(coord,vals)
write.table(combine,"xyvalues.txt")
我真的很感激任何帮助。
提前致谢。