knitr::opts_chunk$set(collapse = TRUE, comment = "#>") options(knitr.table.format = "html", rmarkdown.html_vignette.check_title = FALSE) library(eRTG3D) library(ggplot2) set.seed(123)
Since movement in 2-D is a special case of movement in 3-D, the eRTG3D
algorithm also supports two-dimensional simulations. The underlying data structure of the algorithm remains in three-dimensional, with the third dimension (z) being constant, as for example zero. This approach guarantees a seamless transition between 2-D and 3-D simulations. Therefore, two P and Q probabilities are be extracted from 2D and 3D trajectories, then a combined simulation can take place.
trajectory.3D <- sim.crw.3d(nStep = 100, rTurn = 0.99, rLift = 0.99, meanStep = 0.1)
To simulate in 2-D the third dimension of the trajectory is set to zero:
trajectory.2D <- trajectory.3D trajectory.2D$z <- 0 head(trajectory.2D)
If the original trajectory is already two-dimensional, a third column z
has to be added: trajectory.2D$z <- 0
.
Now the workflow is the same as in 3-D, described in the standard workflow vignette:
simulation.2D <- reproduce.track.3d(trajectory.2D)
Note: Since it is not feasible to use a DEM (DEM = demRaster
) in 2-D simualtions, the adding of a DEM in the somulations will result in dead ends. A BG layer (BG = bgRaster
) with a binary mask or continous probabilities for the simulation area can be passed (e.g. water bodies, nutrition sources, ...).
simulation.2D <- reproduce.track.3d(trajectory.2D)
And plotting the results:
plot2d(trajectory.2D, simulation.2D, titleText = "2-D trajectory simulation")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.