extractIndex: Exrtract values from raster time series

Description Details Value Methods Author(s) See Also Examples

Description

This is a short-hand method that acts the same as extract. This method extracts values from a Raster*TS object for spatial locations which can be specified by spatial points, lines, polygons, or an Extent (rectangle) object or raster cell number(s).

Details

This function uses the raster and xts packages to extract the values in space and subset them in time by specifying ISO-8601 compatible range strings. This allows for natural range-based time queries without requiring prior knowledge of the underlying time object used in construction.

When a raw character vector is used for j, it is processed as if it was ISO-8601 compliant. This means that it is parsed from left to right, according to the following specification:

CCYYMMDD HH:MM:SS.ss+

A full description will be expanded from a left-specified truncated one.

Additionally, one may specify range-based queries by simply supplying two time descriptions seperated by a forward slash:

CCYYMMDD HH:MM:SS.ss+/CCYYMMDD HH:MM:SS.ss

The algorithm to parse the above is .parseISO8601 from the xts package.

Value

rts.

Methods

x[i, j]

Arguments

x is a raster time series (Raster*TS) object created by rts

i is a SpatialPoints*, SpatialPolygons*, SpatialLines, Extent object, or a vector (representing cell numbers)

j is optional; the time index for which the values in raster should be extracted. It can be numeric, timeBased or ISO-8601 style (see details)

Author(s)

Babak Naimi

naimi.b@gmail.com

http://r-gis.net

See Also

extract and [.xts

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
file <- system.file("external/ndvi", package="rts")

ndvi <- rts(file) # read the ndvi time series from the specified file

n1 <- ndvi[125] # extract the time series values at cell number 125 for all available times

n1

plot(n1)

n2 <- ndvi[125,"/20090101"] # extract the time series values at cell number 125 for 
# all times after 2009-01-01

n2

plot(n2)

n3 <- ndvi[125,"200901/"] # extract the time series values at cell number 125 for all
# times before 2009-01

n4 <- ndvi[10:20,"2008-05-01"] #extract the values at cell numbers of 10:20 for 
# the specified time

n4



## End(Not run)

rts documentation built on Oct. 17, 2021, 1:07 a.m.

Related to extractIndex in rts...