Simulation Function for Animal Tracks#7
Conversation
Implemented function to simulate animal tracks from multimodal inputs (numeric and spacial imagery data) together with a working example
|
| } else {numericRasters <- list()} | ||
|
|
||
| # Kernel extraction helper function: | ||
| extractKernelValues_vec <- function(raster, xs, ys, kernelDim, kernelFun) { |
There was a problem hiding this comment.
als pkg function definieren
|
|
||
|
|
||
| # Kernel value calculation helper function: | ||
| computeImageValues <- function(x, y) { |
There was a problem hiding this comment.
- als pkg function definieren
- add missing arguments (some data is accessed from the environment, other data (x, y) are passed as arguments
| n_off <- nrow(offsets) | ||
|
|
||
| all_x <- rep(xs, each = n_off) + rep(offsets$dx, times = n_pts) * res_x | ||
| all_y <- rep(ys, each = n_off) + rep(offsets$dy, times = n_pts) * res_y |
There was a problem hiding this comment.
Mit diesen offsets könntest du theoretisch wieder über deine boundaries gehen oder? Müsstest du hier nicht deshalb wie in line 223/224 darauf checken/korrigieren?
| multinom <- stats::rmultinom(1, size = 1, prob = p) | ||
| chosenStep <- which(multinom == 1) | ||
|
|
||
| simData$x_[i + 1] <- x[chosenStep] |
There was a problem hiding this comment.
solltest du hier nicht die xToro coordinates nehmen?
There was a problem hiding this comment.
Ich benutze den Toro wrap nur um keine NAs in den Umweltdaten zu erzeugen. Die simulierten Tracks sollen nicht gewrapped werden um korrekte step length und turning angels zu behalten, damit die daraus abgeleiteten movement variable distributions stimmen.
| if (xminAll >= xmaxAll || yminAll >= ymaxAll) stop("The provided layers must have a spatial overlap") | ||
|
|
||
| # Adding imageLayer if present: (cutting to size and scaling) | ||
| if (!is.null(imageLayers)) { |
There was a problem hiding this comment.
fast identisch mit dem numericLayer Block? Helper function deklarieren und dann in einen Block zusammensetzen
| ext = terra::ext(-200, 200, -200, 200) | ||
| ) | ||
|
|
||
| terra::values(dummyImage) <- runif(terra::ncell(dummyImage)) |
Current versions of the simulation functions and data preparation functions together with unit tests and examples
Implemented function to simulate animal tracks from multimodal inputs (numeric and spacial imagery data) together with a working example