moveReduce: moveReduce

View source: R/moveReduce.R

moveReduceR Documentation

moveReduce

Description

Pixel based summary of movement data that preserves periodic movements.

Usage

moveReduce(x, y, z, preserve.revisits = TRUE)

Arguments

x

Object of class spatVector.

y

Object of class spatRaster.

z

Object of class Date or POSIXct with the observation time of each element in x.

preserve.revisits

Logical. Should the function preserve revisit patterns?

Details

Translates (x) into pixel coordinates within a reference raster (y). The function identifies temporal segments corresponding to groups of consecutive observations within the same pixel. In this process, revisits to recorded pixels are preserved. Once the segments are identified, the function derives mean x and y coordinates for each of them and evaluates the time spent within each pixel. The function reports on the start and end timestamps and the elapsed time. If preserve.revisits is FALSE, the function will then summarize the output on a pixel level summing the time spent at each pixel. Additionally, if derive.raster is TRUE, the function will derive a RasterLayer with the same configuration as y depicting the the total amount of time spent per pixel. The output of the function consists of a spatVector with the reduced sample set.

Value

A spatVector object.

Examples

{

 require(terra)

 # read raster data
 r <- (system.file('extdata', '2013-07-16_ndvi.tif', package="rsMove"))

 # read movement data
 shortMove <- read.csv(system.file('extdata', 'shortMove.csv', package="rsMove"))

 # convert observations to vector
 shortMove = vect(shortMove, geom=c("x","y"), crs="EPSG:32632")

 # observation time
 z <- as.POSIXct(strptime(paste0(shortMove$date, ' ', shortMove$time),
 format="%Y/%m/%d %H:%M:%S"))

 # reduce amount of samples
 move.reduce <- moveReduce(shortMove, r, z, derive.raster=TRUE)

}

RRemelgado/rsMove documentation built on June 3, 2024, 10:07 p.m.