Title: | Compute Energy Landscapes |
---|---|
Description: | Compute energy landscapes using a digital elevation model raster and body mass of animals. |
Authors: | Emilio Berti |
Maintainer: | Emilio Berti <[email protected]> |
License: | GPL-3 |
Version: | 1.1.2 |
Built: | 2025-03-07 05:50:38 UTC |
Source: | https://github.com/emilio-berti/enerscape |
This creates the init file for the julia package Circuitscape: https://juliapackages.com/p/circuitscape.
circuitscape_skeleton(en = NULL, path = NULL, points = NULL)
circuitscape_skeleton(en = NULL, path = NULL, points = NULL)
en |
an enerscape object. |
path |
full path where to write the .ini file. |
points |
data.frame with origin and destination coordinates. |
Nothing, only write the circuitscape.ini file to disk.
Spatial distances
distances(x, center, res)
distances(x, center, res)
x |
matrix with values |
center |
numeric value (double) with the value of the focal cell |
res |
numeric value (double) of the spatial resolution of the matrix |
Vector with values the distances between x and center
Energy Landscape
energy(slope, distance, mass, res, kcal = TRUE)
energy(slope, distance, mass, res, kcal = TRUE)
slope |
vector with slopes |
distance |
vector with distances |
mass |
body mass of species (kg) |
res |
numeric value (double) of the spatial resolution of the matrix |
kcal |
(boolean) if to return the result in kCal (true) or J (false) |
Vector with the energy cost of locomotion (EnergyScape)
Energy Landscape
energyscape( x, n = 4L, mass = 0, res = 0, kcal = TRUE, out = 0L, direction = 0L )
energyscape( x, n = 4L, mass = 0, res = 0, kcal = TRUE, out = 0L, direction = 0L )
x |
matrix with values the elevation. |
n |
(integer) number of neighbours to consider (either 4 or 8). |
mass |
body mass of species (kg). |
res |
numeric value (double) of the spatial resolution of the matrix. |
kcal |
(boolean) if to return the result in kCal (true) or J (false). |
out |
(integer) if to calculate the costs for moving into the cell (0) or from it (1). |
direction |
(integer) for which direction to calculate costs: 0 for all, 1 for left, 2 for down, 3 for right, 4 for up. |
Matrix with the energy cost of locomotion (EnergyScape).
This is the main function to compute energy landscapes from a digital elevation model and body mass of animals based on the model from Pontzer (2016). The core of the computations are done using the gdistance (Etten, 2017) package.
enerscape(dem, m, unit = "joule", neigh = 8, direction = "in")
enerscape(dem, m, unit = "joule", neigh = 8, direction = "in")
dem |
raster file of the digital elevation model, either a raster or a full path location of the file. |
m |
species body mass (kg). |
unit |
if joules ('joule') or kilocalories ('kcal'). |
neigh |
number of neighbor cells that are connected together. |
direction |
character specifying if costs are to be calcualted for moving into the focal cell ('in'), from it ('out'), or for a specific direction ,i.e. 'up', 'down', 'left', 'right'. |
From the digital elevation model, transition slopes, energy costs and conductances (1 / work) are computed based on the model described in Pontzer (2016).
A list with elements a rasterStack of the digital elevation model, slope, energy landscape, and conductance and the conductance as a transitionLayer for path analysis.
Pontzer, H. (2016). A unified theory for the energy cost of legged locomotion. Biology Letters, 12(2), 20150935. doi:10.1098/rsbl.2015.0935.
library(terra) library(enerscape) data("sirente") dem <- rast(sirente) en <- enerscape(dem, 10, unit = "kcal", neigh = 8) plot(en, col = hcl.colors(100, "Inferno")) contour(dem, add = TRUE, nlevels = 5, col = hcl.colors(7, "Terrain"))
library(terra) library(enerscape) data("sirente") dem <- rast(sirente) en <- enerscape(dem, 10, unit = "kcal", neigh = 8) plot(en, col = hcl.colors(100, "Inferno")) contour(dem, add = TRUE, nlevels = 5, col = hcl.colors(7, "Terrain"))
Neighbours
neighbours(i, j, n, x, direction)
neighbours(i, j, n, x, direction)
i |
row index. |
j |
column index. |
n |
number of neighbours (4 or 8). |
x |
matrix with values. |
direction |
(integer) for which direction to calculate costs: 0 for all, 1 for left, 2 for down, 3 for right, 4 for up. |
Vector with values the neighours of x
This creates the init file for the julia package Omniscape: https://juliapackages.com/p/omniscape.
omniscape_skeleton(en = NULL, path = NULL, radius = NULL, aggr_fact = 1)
omniscape_skeleton(en = NULL, path = NULL, radius = NULL, aggr_fact = 1)
en |
an enerscape object. |
path |
full path where to write the .ini file. |
radius |
radius in pixels of the moving window. |
aggr_fact |
the block size to compute the Omniscape. |
Nothing, only write the omniscape.ini file to disk.
Energy cost of transport from Pontzer (2016)
pontzer
pontzer
A data frame with 92 rows and 5 variables:
species name
incline of movement
species body mass
cost of transport
original source of data
#' Pontzer, H. (2016). A unified theory for the energy cost of legged locomotion. Biology Letters, 12(2), 20150935.
A matrix with the digital elevation mode of the Monte Sirente (Central Italy).
sirente
sirente
An object of class matrix
(inherits from array
) with 393 rows and 594 columns.
Slopes
slope(x, center, res, out)
slope(x, center, res, out)
x |
matrix with values |
center |
numeric value (double) with the value of the focal cell |
res |
numeric value (double) of the spatial resolution of the matrix |
out |
(integer) if to calculate the costs for moving into the cell (0) or from it (1). |
Vector with values the slopes (degrees) between x and center