Coerce raster time series (rts) object back to raster* object

怎甘沉沦 提交于 2020-01-03 19:43:19

问题


Should seem straight forward but have failed to find a way. How does one coerce a rts raster time series back to a raster (stack)?

The following example from the rts package.

library(raster)
library(rts)
path <- system.file("external", package="rts")
lst <- list.files(path=path,pattern='.asc$',full.names=TRUE)
r <- stack(lst)
d <- c("2000-02-01","2000-03-01","2000-04-01","2000-05-01") # corresponding dates to 4 rasters
d <- as.Date(d)

# creating a RasterStackTS object:
rt <- rts(r,d)

回答1:


In rts, the raster object is kept in slot @raster, so, you can simply use rt@raster to get the raster object.



来源:https://stackoverflow.com/questions/25030594/coerce-raster-time-series-rts-object-back-to-raster-object

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