【发布时间】:2014-01-29 06:14:13
【问题描述】:
我的问题与一个不幸的未解决问题recently posted on Stackoverflow 非常相似。我正在处理一个由 12 层组成的 RasterStack 对象(一年中的每个月一个),我想复制这些层十次,最后得到一个由 120 层组成的 RasterStack,每 12 层相似(即,层 1 与层 13 相同,层 13 与层 25 相同,依此类推)。
出于复制目的,让我们以raster 包中的示例为例:
library(raster)
file <- system.file("external/test.grd", package = "raster")
s <- stack(file, file, file, file, file, file, file, file, file, file, file, file)
stack(s, s, s, s, s, s, s, s, s, s)
class : RasterStack
dimensions : 115, 80, 9200, 120 (nrow, ncol, ncell, nlayers)
resolution : 40, 40 (x, y)
extent : 178400, 181600, 329400, 334000 (xmin, xmax, ymin, ymax)
coord. ref. : +init=epsg:28992 +towgs84=565.237,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812 +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
names : test.1.1, test.2.1, test.3.1, test.4.1, test.5.1, test.6.1, test.7.1, test.8.1, test.9.1, test.10.1, test.11.1, test.12.1, test.1.2, test.2.2, test.3.2, ...
min values : 128.434, 128.434, 128.434, 128.434, 128.434, 128.434, 128.434, 128.434, 128.434, 128.434, 128.434, 128.434, 128.434, 128.434, 128.434, ...
max values : 1805.78, 1805.78, 1805.78, 1805.78, 1805.78, 1805.78, 1805.78, 1805.78, 1805.78, 1805.78, 1805.78, 1805.78, 1805.78, 1805.78, 1805.78, ...
当然,可以像最后一行代码那样手动完成,但这对我来说似乎很不方便。任何有关如何以更好的方式实现我的目标的建议将不胜感激!
【问题讨论】:
标签: r replication raster