Creates multiple conditional empirical random walks, with a specific starting and ending point, geometrically similar to the initial trajectory by applying sim.cond.3d multiple times.

n.sim.cond.3d(
  n.sim,
  n.locs,
  start = c(0, 0, 0),
  end = start,
  a0,
  g0,
  densities,
  qProbs,
  error = FALSE,
  parallel = FALSE,
  DEM = NULL,
  BG = NULL
)

Arguments

n.sim

number of CERWs to simulate

n.locs

length of the trajectory in locations

start

numeric vector of length 3 with the coordinates of the start point

end

numeric vector of length 3 with the coordinates of the end point

a0

initial incoming heading in radian

g0

initial incoming gradient/polar angle in radian

densities

list object returned by the get.densities.3d function

qProbs

list object returned by the qProb.3d function

error

logical: add random noise to the turn angle, lift angle and step length to account for errors measurements?

parallel

logical: run computations in parallel (n-1 cores)? Or numeric: the number of nodes (maximum: n - 1 cores)

DEM

raster layer containing a digital elevation model, covering the area between start and end point

BG

a background raster layer that can be used to inform the choice of steps

Value

A list containing the CERWs or NULLs if dead ends have been encountered.

Examples

niclas <- track.properties.3d(niclas)
n.locs <- 3
P <- get.track.densities.3d(niclas)
#>   |TLD cube dimensions: 9 x 14 x 3
f <- 1500
start <- Reduce(c, niclas[1, 1:3])
end <- Reduce(c, niclas[n.locs, 1:3])
a0 <- niclas$a[1]
g0 <- niclas$g[1]
uerw <- sim.uncond.3d(
  n.locs * f, start = start, a0 = a0, g0 = g0, densities = P
)
#>   |Simulate UERW with 4500 steps
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |====                                                                  |   5%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |===========                                                           |  15%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |=========================                                             |  35%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |=======================================                               |  55%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |==============================================                        |  65%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |=====================================================                 |  75%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |===================================================================   |  95%
  |                                                                            
  |======================================================================| 100%
#>   |Elapsed time: 0.3s
Q <- qProb.3d(uerw, n.locs)
#>   |Extracting Q probabilities for 3 steps
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
#>   |Elapsed time: 0s
n.sim.cond.3d(
  n.sim = 2, n.locs = n.locs,
  start = start, end = end,
  a0 = a0, g0 = g0,
  densities = P, qProbs = Q
)
#>   |Simulate 2 CERWs with 3 steps
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
#> 
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
#> 
  |                                                                            
  |======================================================================| 100%
#>   |Elapsed time: 0.1s
#> [[1]]
#>         x       y        z         a        g          t            l        d
#> 1 2556476 1188336 1283.736 0.3914766 1.557032 0.01087508 -0.009858383       NA
#> 2 2561433 1190823 1414.762 0.4650999 1.547173 0.07362330 -0.009858383 5547.047
#> 3 2560477 1189861 1369.713        NA       NA         NA           NA 1357.124
#>             p
#> 1          NA
#> 2 1.81689e-17
#> 3          NA
#> 
#> [[2]]
#>         x       y        z         a        g           t            l
#> 1 2556476 1188336 1283.736 0.3914766 1.557032 -0.05187315  0.059190899
#> 2 2560446 1190328 1388.677 0.4650999 1.547173  0.07362330 -0.009858383
#> 3 2560477 1189861 1369.713        NA       NA          NA           NA
#>           d            p
#> 1        NA           NA
#> 2 4442.7296 8.698607e-18
#> 3  468.6208           NA
#>