问题
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