This vignette illustrates the basic functionality of the
eRTG3D package and some workflows, to combine the functions in a meaningful way. For a more detailed description of the individual functions and their parameters please consider the package’s help.
As first step the properties of a track with x, y and z coordinates are calculated.
Then the movement characteristics (P probability) are extracted from the trajectory. Although the algorithm also works without a DEM, the DEM should be passed to the
get.track.densities.3d() function, otherwise the flight height distribution in respect to the earth surface can not be built, which ends in less accurate results.
get.track.densities.3d(niclas, heightDistEllipsoid = TRUE, DEM = dem)P <-
The finally desired Conditional Empirical Random Walk (CERW) connecting a given start with a certain end point by a given number of steps needs an attraction term (the Q probability) to ensure that the target is approached and hit. In order to calculate the Q probability for each step the distribution of turns and lifts to target and the distribution of distance to target has to be known. They can be derived from the empirical data (ideally), or estimated from an unconditional process with the same properties. In this case the Q probabilities, which represent the pull towards the destination, are extracted from a UERW simulated with
sim.uncond.3d(). The UERW should contain 1500
f <- 1500 times more steps than the final CERW to be simulated. Q are extracted from the UERW by the function
nrow(niclas) sim.locs <- 1500 f <- sim.uncond.3d(sim.locs*f, start = c(niclas$x, niclas$y, niclas$z), uerw <-a0 = niclas$a, g0 = niclas$g, densities = P) qProb.3d(uerw, sim.locs)Q <-
Set up the start and end conditions: azimuth (
a0), gradient (
g0), start and end point of the CERW to be simulated.
c(niclas$x, niclas$y, niclas$z) start <- c(niclas$x[nrow(niclas)], niclas$y[nrow(niclas)], niclas$z[nrow(niclas)]) end <- niclas$a a0 <- niclas$gg0 <-
Then finally a CERW can be simulated.
sim.cond.3d(sim.locs, start = start, end = end, a0 = a0, g0 = g0, cerw <-densities = P, qProbs = Q, DEM = dem)
If more than one simulated track is desired, the
n.sim.cond.3d() can be used. The n.sim parameter defines the number of simulated tracks.
n.sim.cond.3d(n.sim = 100, sim.locs, cerwList <-start = start, end = end, a0 = a0, g0 = g0, densities = P, qProbs = Q, DEM = dem)
Note: Due to dead ends, which are normally occurring in a proportion of 25%, the n.sim parameter should be set higher than the needed tracks.
In many cases the time between the acquisition of fix points of the GPS tracks is not constant. This can be caused by the time to get the fix point or missing data. To avoid distorted statistic distributions, which increases the probability of dead ends, the track has to be splitted in sections, where the acquisition time is constant. In this case the
get.track.properties.3d() function can not be used anymore. Then the work flow should look like the following:
track.split.3d(track, timeLag) trackSections <- get.section.densities.3d(trackSections, DEM = dem)P <-
Note: If the aim is to reproduce a track, then the length of the track should be adjusted to fit to the densities extracted by
get.section.densities.3d(). The message thrown by the previously applied
track.split.3d() proposes a value
nChange to adjust the track length of the simulations.
To reproduce an observed track, it is the simplest to just apply the
reproduce.track.3d() function on the track and the DEM. The function automatically wraps all steps above together. To produce multiple tracks, the
n.sim variable can be used.
reproduce.track.3d(n.sim = 100, niclas, DEM = dem)cerwList <-