rts: Create a Raster Time Series object

rtsR Documentation

Create a Raster Time Series object

Description

Constructor function to create a raster time series (Raster*TS) object. rts object can be created from a vector of image files names, a RasterStack or a RasterBrick object (defined in raster) together with a vector of time/dates-must be of known time-based class. This function can also be used to read a raster time series file.

Usage

rts(x, time,...)

Arguments

x

A character vector including names of image/raster files, or RasterStack or RasterBrick object, or the name (character) of a raster time series file

time

a vector holding date/time data with the same length as rasters in Raster* object or name of files in character vector

...

see details

Details

A raster time series object is created by combining a RasterStack or RasterBrick objct, defined in raster and a xts object in xts-package. RasterStack or RasterBrick can be created by using stack and brick functions, respectively in raster-package. If a character vector including the name of raster files is used for x, stack function is internally called by rts. time information is handled by xts object. The date/time values in the vector of time should be correspond to the raster files (i.e. first date/time for first raster, ...) and have the same length as the number of rasters in x.

If a name of a raster time series file is provided for the x argument, it acts the same as coderead.rts.

If x is the name of Raster Time Series file (a character), it calls read.rts to read the file. By default, the Raster Time Series is read as the class of SpatRasterTS, but the user can provide cls argument to specify a different rts class (e.g., cls='RasterBrickTS')

Value

RasterStackTS or RasterBrickTS

Author(s)

Babak Naimi

naimi.b@gmail.com

http://r-gis.net

See Also

stack, brick, xts

Examples


## Not run: 
path <- system.file("external", package="rts") # location of files

lst <- list.files(path=path,pattern='.asc$',full.names=TRUE)
lst # list of raster files


r <- rast(lst) # creating a RasterStack object

r

d <- c("2000-02-01","2000-03-01","2000-04-01","2000-05-01") # corresponding dates to 4 rasters
d <- as.Date(d) # or d <- as.POSIXct(d) 

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

rt

plot(rt)

## End(Not run)




babaknaimi/rts documentation built on Oct. 3, 2023, 4:46 p.m.