downsampleXYZ.Rd
Downsample high-resolution *(x,y,t)* or *(x,y,z,t)* data to match a minimum spatial resolution.
downsampleXYZ(
data,
t_step,
t_cut = t_step * 10,
x = "x",
y = "y",
z = NULL,
t = "t",
ID = "ID"
)
A data.frame or something coercible to a data.table containing all observations
The smallest allowable median time interval between observations.
Any track with a median value below this will be resampled to a track of
equally-spaced observations with time difference t_step
. This should
be selected based on the parameters that will be used to generate a
world
object such that each successive step is likely to fall outside
of the range of possible raster transitions. For example, for a given source
dem
in makeGrid
, a given distances = 16
in
makeWorld
(implying that contiguity = 2
), and
an estimated animal maximum velocity of v_max = 1.5
m/s, t_step
should be at least t_step = res(dem) / v_max * (contiguity + 1) * sqrt(2)
A numeric. Any gap exceeding this value in seconds in a given
track will be treated as the start of a new segment. Default is t_step * 10
.
A character string representing the data column containing the 'x' coordinates in any projection.
A character string representing the data column containing the 'y' coordinates in any projection.
Optional. A character string representing the data column containing the 'z' elevations.
A character string representing the data column containing the time values, either as a numeric of successive seconds or as a date time string
A character string representing the data column containing the unique ID for each observed trajectory. In other words, each set of points for each continuous observation for each observed individual would merit a unique id.
A data.table, containing the original input data but with all
overly-high resolution tracks downsampled to an acceptable rate of observations
and column names prepared for the getVelocity
function.
# Generate fake data with x,y coordinates, z elevation, and a t
# column representing the number of seconds into the observation
data <- data.table(x = runif(10000,10000,20000),
y = runif(10000,30000,40000),
z = runif(10000,0,200),
t = 1:1000,
ID = rep(1:10,each=1000))
# Set the minimum value at 3 seconds
data <- downsampleXYZ(data = data, t_step = 3, z = 'z')
#>
|
| | 0%
|
|======= | 10%
|
|============== | 20%
|
|===================== | 30%
|
|============================ | 40%
|
|=================================== | 50%
|
|========================================== | 60%
|
|================================================= | 70%
|
|======================================================== | 80%
|
|=============================================================== | 90%
|
|======================================================================| 100%