I am analyzing animal tracking data within an acoustic receiver array using dynamic Brownian bridge movement models. The dataset contains an animal identifier and every detection on a receiver has a timestamp and a lat/lon coordinates (in decimal degrees). Further, there is are two additional grouping variables "studyperiod" and "sgroup".
Elasmo Datetime Lat Lon studyperiod sgroup
1 X10141 2019-02-13 15:29:00 25.72441 -79.30922 IS2019 naive
2 X10141 2019-02-13 15:44:00 25.72441 -79.30922 IS2019 naive
3 X10141 2019-02-13 15:48:00 25.72441 -79.30922 IS2019 naive
4 X10141 2019-02-13 17:17:00 25.72441 -79.30922 IS2019 naive
5 X10141 2019-02-13 17:20:00 25.72441 -79.30922 IS2019 naive
6 X10141 2019-02-13 18:00:00 25.72441 -79.30922 IS2019 naive
I then used the GitHub package 'dBBMMhomeRange' (/https://github.com/SimonDedman/dBBMMhomeRange) to calculate individual-level Utilization distributions first, which are then scaled, weighted, summed to group-level UDs. The resulting group-level UDs are saved as .ascii rasters. As the rasters had different extents, I imported them into ArcMap and specified a shared extent within the program. Rasters with the same shared extent were then exported from Arcmap and imported into R. The rasters have the following properties:
r1 <- raster("~/N_IS2017_sc.tif")
r4 <- raster("~/N_IS2020_sc.tif")
> r1;r4
class : RasterLayer
dimensions : 1450, 1264, 1832800 (nrow, ncol, ncell)
resolution : 50, 50 (x, y)
extent : -31658.67, 31541.33, -36085.92, 36414.08 (xmin, xmax, ymin, ymax)
crs : NA
source : N_IS2017_sc.tif
names : N_IS2017_sc
values : 0, 0.0003713508 (min, max)
class : RasterLayer
dimensions : 1450, 1264, 1832800 (nrow, ncol, ncell)
resolution : 50, 50 (x, y)
extent : -31658.67, 31541.33, -36085.92, 36414.08 (xmin, xmax, ymin, ymax)
crs : NA
source : N_IS2020_sc.tif
names : N_IS2020_sc
values : 0, 0.0004588088 (min, max)
Now, I would like to use Earth Mover's Distance as described by Kranstauber et al. (2016) to calculate similarity in space use between the different groups. To do so I used emdDists() function from the move package.
## create a raster stack
allrasters <- stack(r1,r4)
## EMD
emdDists <- emd(allrasters/cellStats(allrasters, sum), threshold = 700)
However, the function starts running but always crashes. Which makes me think that something I did was not correct.
So, this brings me to my two questions:
The corresponding paper uses a UDStack as object to supply to the EMDDists(). So I am unsure if it is possible to implement the EMD approach for here described .tif rasters as well?
If correct, are there ways to reduce the calculation power demands to R?