timeDir: timeDir

Description Usage Arguments Details Value See Also Examples

View source: R/timeDir.R

Description

Analysis of environmental change in time for a set of coordinate pairs.

Usage

1
2
3
4
5
6
7
8
9
timeDir(
  env.data,
  env.dates,
  obs.dates,
  temporal.buffer,
  xy = NULL,
  stat.fun = NULL,
  min.count = 2
)

Arguments

env.data

Object of class RasterStack or RasterBrick or data.frame.

env.dates

Object of class Date with env.data observation dates.

obs.dates

Object of class Date with xy observation dates.

temporal.buffer

two element vector with temporal window size (expressed in days).

xy

Object of class "SpatialPoints" or "SpatialPointsDataFrame".

stat.fun

Output statistical metric.

min.count

Minimum number of samples required by stat.fun. Default is 2.

Details

This function quantifies environmental change in time along a movement track. First, for each point in xy, the function compares its observation date (obs.dates) against the acquisition dates (env.dates) of env.data to select non NA timesteps within a predefined temporal window (temporal.buffer). The user can adjust this window to determine which images are the most important. For example, if one wishes to know how the landscape evolved up to the observation date of the target sample, temporal.buffer can be define as, e.g., c(30,0) forcing the function to only consider pixels recorded within the previous 30 days. After selecting adequate temporal information for each data point, a statistical metric is estimated. This statistical metric is specified by stat.fun. By default, the function reports on the slope between the acquisition dates of env.data and their corresponding values. When providing a new function, set x for env.dates and y for env.data. The final output is a list consisting of:

Value

A vector with a requested statistical metric for each point in xy and informative plots.

See Also

spaceDir dataQuery imgInt

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{

 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
 r.dates <- seq.Date(as.Date("2013-08-01"), as.Date("2013-08-09"), 1)

 # sample dates
 obs.dates <- as.Date(shortMove@data$date)

 # perform directional sampling
 of <- function(x,y) {lm(y~x)$coefficients[2]}
 time.env <- timeDir(r.stk, r.dates, obs.dates, c(30,30), xy=shortMove, stat.fun=of)

}

rsMove documentation built on July 1, 2020, 6:02 p.m.