rsMove (version 0.2.4)

imgInt: imgInt

Description

Temporal linear interpolation of environmental data using a raster, SpatialPointsDataFrames or data frames.

Usage

imgInt(env.data, env.dates, target.dates, time.buffer, xy = NULL)

Arguments

env.data

Object of class RasterStack, RasterBrick or data.frame.

env.dates

Object of class Date with dates of env.data.

target.dates

Object of class Date with target dates.

time.buffer

A two-element vector with temporal search buffer (expressed in days).

xy

Object of class SpatialPoints or SpatialPointsDataFrame.

Value

A RasterBrick or a data frame. If a RasterBrick, each layer represents a date. If a data.frame, columns represent dates and rows represent samples.

Details

Performs a pixel-wise linear interpolation over a raster for a given set of dates (target.dates). A temporal buffer (time.buffer) is required to limit the search for reference data points (time.buffer). This is defined by a two element vector which limits the search in the past and future. If xy is provided and env.data is a raster object the function only considers the pixels that overlap with the shapefile. Otherwise, all pixels are considered providing a RasterBrick. However, if env.data is a data.frame, xy is ignored.

See Also

dataQuery timeDir spaceDir moveSeg

Examples

Run this code
# NOT RUN {
{

 require(raster)

 #'  # read raster data
 file <- list.files(system.file('extdata', '', package="rsMove"), 'ndvi.tif', full.names=TRUE)
 r.stk <- stack(file)
 r.stk <- stack(r.stk, r.stk, r.stk) # dummy files for the example

 # read movement data
 data(shortMove)

 # raster dates
 file.name <- names(r.stk)
 env.dates <- as.Date(paste0(substr(file.name, 2, 5), '-',
 substr(file.name, 7, 8), '-', substr(file.name, 10, 11)))

 # target dates
 target.dates = as.Date("2013-08-10")

 # interpolate raster data to target dates
 i.env.data <- imgInt(r.stk, env.dates, target.dates, c(60,60), xy=shortMove)

}
# }

Run the code above in your browser using DataLab