Package 'enerscape'

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

Help Index


Create the initialization file for the julia package Circuitscape

Description

This creates the init file for the julia package Circuitscape: https://juliapackages.com/p/circuitscape.

Usage

circuitscape_skeleton(en = NULL, path = NULL, points = NULL)

Arguments

en

an enerscape object.

path

full path where to write the .ini file.

points

data.frame with origin and destination coordinates.

Value

Nothing, only write the circuitscape.ini file to disk.


Spatial distances

Description

Spatial distances

Usage

distances(x, center, res)

Arguments

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

Value

Vector with values the distances between x and center


Energy Landscape

Description

Energy Landscape

Usage

energy(slope, distance, mass, res, kcal = TRUE)

Arguments

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)

Value

Vector with the energy cost of locomotion (EnergyScape)


Energy Landscape

Description

Energy Landscape

Usage

energyscape(
  x,
  n = 4L,
  mass = 0,
  res = 0,
  kcal = TRUE,
  out = 0L,
  direction = 0L
)

Arguments

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.

Value

Matrix with the energy cost of locomotion (EnergyScape).


Compute Energy Landscapes

Description

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.

Usage

enerscape(dem, m, unit = "joule", neigh = 8, direction = "in")

Arguments

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'.

Details

From the digital elevation model, transition slopes, energy costs and conductances (1 / work) are computed based on the model described in Pontzer (2016).

Value

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.

References

Pontzer, H. (2016). A unified theory for the energy cost of legged locomotion. Biology Letters, 12(2), 20150935. doi:10.1098/rsbl.2015.0935.

Examples

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

Description

Neighbours

Usage

neighbours(i, j, n, x, direction)

Arguments

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.

Value

Vector with values the neighours of x


Create the initialization file for the julia package Omniscape

Description

This creates the init file for the julia package Omniscape: https://juliapackages.com/p/omniscape.

Usage

omniscape_skeleton(en = NULL, path = NULL, radius = NULL, aggr_fact = 1)

Arguments

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.

Value

Nothing, only write the omniscape.ini file to disk.


Energy cost of transport from Pontzer (2016)

Description

Energy cost of transport from Pontzer (2016)

Usage

pontzer

Format

A data frame with 92 rows and 5 variables:

Species

species name

Incline

incline of movement

Mass

species body mass

Cost.of.Transport

cost of transport

Source

original source of data

Source

doi:10.1098/rsbl.2015.0935

References

#' Pontzer, H. (2016). A unified theory for the energy cost of legged locomotion. Biology Letters, 12(2), 20150935.


Monte Sirente Digital Elevation Model

Description

A matrix with the digital elevation mode of the Monte Sirente (Central Italy).

Usage

sirente

Format

An object of class matrix (inherits from array) with 393 rows and 594 columns.


Slopes

Description

Slopes

Usage

slope(x, center, res, out)

Arguments

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).

Value

Vector with values the slopes (degrees) between x and center