The r package enerscape: A general energy landscape framework for terrestrial movement ecology

Ecological processes and biodiversity patterns are strongly affected by how animals move through the landscape. However, it remains challenging to predict animal movement and space use. Here we present our new r package enerscape to quantify and predict animal movement in real landscapes based on energy expenditure. enerscape integrates a general locomotory model for terrestrial animals with GIS tools in order to map energy costs of movement in a given environment, resulting in energy landscapes that reflect how energy expenditures may shape habitat use. enerscape only requires topographic data (elevation) and the body mass of the studied animal. To illustrate the potential of enerscape, we analyse the energy landscape for the Marsican bear (Ursus arctos marsicanus) in a protected area in central Italy in order to identify least‐cost paths and high‐connectivity areas with low energy costs of travel. enerscape allowed us to identify travel routes for the bear that minimize energy costs of movement and regions that have high landscape connectivity based on movement efficiency, highlighting potential corridors. It also identifies areas where high energy costs may prevent movement and dispersal, potentially exacerbating human–wildlife conflicts in the park. A major strength of enerscape is that it requires only widely available topographic and body size data. As such, enerscape permits a first cost‐effective way to estimate landscape use and movement corridors even when telemetry data are not readily available, such as for the example with the bear. enerscape is built in a modular way and other movement modes and ecosystem types can be implemented when appropriate locomotory models are available. In summary, enerscape is a new general tool that quantifies, using minimal and widely available data, the energy costs of moving through a landscape. This can clarify how and why animals move in real landscapes and inform practical conservation and restoration decisions.


| INTRODUC TI ON
How animals move and use the landscape determine their ecological effects on ecosystems and is thus an essential part of biodiversity (Jeltsch et al., 2013;Schlägel et al., 2020). Highly mobile species promote biodiverse communities by transporting propagules, genes and nutrients across ecosystems (Lundberg & Moberg, 2003). Moreover, animals' selective use of the landscape generates diverse habitat patches (Gable et al., 2020), promoting habitat heterogeneity, an essential part of self-sustaining biodiverse ecosystems (Svenning et al., 2019). To better understand how animals move, the concept of energy landscape, that is, the relation between physical features of the landscape and energetic costs of movement, has been proposed as a general framework for animal movement research (Shepard et al., 2013). An energy landscape quantifies the energy costs of movement in a spatially explicit habitat and can be derived by understanding how metabolic and biomechanical processes are affected by physical factors of the environment. Predictions from the energy landscape can then be used to inform conservation, for example, by identifying areas where animals are expected to travel more frequently (Wilson et al., 2012), or as a null model to test further hypotheses, for example, whether factors beyond energy costs influence animal movement (Gallagher et al., 2017).
Body mass accounts for a large proportion of the variation in the mass-specific cost of terrestrial locomotion across a wide range of animal taxa that display remarkable differences in their leg morphology, skeletal architecture and body temperature (Full, 1989). On level ground, mass-specific costs of locomotion decrease with increasing body mass because of increased muscle efficiency (Taylor et al., 1982); longer stride lengths allow equivalent running speeds to be achieved at lower stride frequencies, resulting in longer foot-contact times and a more efficient generation of the muscle force necessary for movement (Kram & Taylor, 1990). Additional energy is required when moving on uneven grounds due to gravity, whose effects are stronger for larger animals (Snyder & Carello, 2008). The energy landscape maps these predictions to a geographical area and its topographic characteristics (Wall et al., 2006), defining a cost surface that influences animal movement (Halsey, 2016; Figure 1), for example, with animals avoiding costly paths (Wall et al., 2006). Although the energy landscape has been proposed as a general conceptual framework for animal movement research (Shepard et al., 2013), a practical tool to derive energy landscapes based on theory is still lacking.
Here, we present the new r package enerscape (Berti, 2021), a framework that integrates unifying locomotory theory with geographical information systems (GIS) to obtain energy landscapes for terrestrial animals in spatially explicit contexts. Specifically, we integrate an existing model for energy costs of movement (Pontzer, 2016) with a transition graphs approach (Etten, 2017) and GIS tools available in r (R Core Team, 2021) to derive energy landscapes using elevation data and body sizes of animals. Importantly, the model used to calculate energy costs of movement is implemented as a module in enerscape, which is thus not limited to terrestrial animals, with possibility to expand it to incorporate other ecosystem types and movement modes (for an example with human cyclists, see the vignette at https://emili o-berti.github.io/eners cape.html). Our approach is designed to be implemented by ecologists and land managers with minimal training in GIS while still being general, providing a useful tool for researchers and practitioners.

K E Y W O R D S
animal dispersal, animal movement, energy landscape, enerscape, locomotory costs, Marsican bear, movement ecology F I G U R E 1 Illustration of the general workflow of the r package enerscape. The energy landscape is computed starting from a raster of the digital elevation model and animal body mass using a locomotory model to calculate the energy costs of transport (ECOT). The ARC model (Pontzer, 2016) for legged, terrestrial animals is displayed as green lines, with blue circles showing the empirical data used for validation

| ENERG E TI C COS TS OF LO COMOTI ON
Muscle contraction requires energy for two main processes: generating tension through cross-bridge cycling and maintaining/restoring transmembrane ion gradients in muscle cells. The energy needed to restore ion gradients is a large amount of the cost of 'activationrelaxation' processes, which do not generate tension directly, but that can account for as high as 40% of the total energy consumed for muscle contraction (Stienen et al., 1995). Notably, an activationrelaxation cycling (ARC) model that accounts for both cross-bridge cycling and activation-relaxation costs has recently been developed and validated for legged, terrestrial animals (Pontzer, 2016). This ARC model predicts that per-biomass energy costs of locomotion E COT (J m −1 kg −1 ) depend on the body mass of animals and on the incline of the terrain according to the relationship: where E AR is the per-biomass cost for activation-relaxation processes, E C the per-biomass cost for cross-bridge cycling, m the body mass (kg) of the animal and θ the slope (degrees) of the terrain, with positive values for ascending movement and negative values for descending movement (Pontzer, 2016). Equation 1 predicts that E COT decreases with animal body mass, due to larger animals having higher energy efficiency (Taylor et al., 1982), and with minimum values for descending slopes of −8 degrees. As per-biomass activation-relaxation costs decrease more rapidly with body mass than cross-bridge cycling (E C ), a larger relative amount of energy is spent for activation-relaxation processes in smaller animals compared to larger ones, which, on the other hand, incur in relatively higher cross-bridge cycling costs.
The ARC model is in line with other, older models of energy costs of movement (e.g. Full, 1989;Kram & Taylor, 1990;Snyder & Carello, 2008), fits well with available data spanning around six orders of magnitudes of body mass (0.78 g-431 kg) and incline ranges from −24 to 90 degrees (R 2 = 0.93, Figure S1) and is coherent with estimates of E COT derived in other studies (e.g. Wall et al., 2006). The total energy costs of travel E (J) can be derived by multiplying Equation 1 by animal body mass and distance of travel: where d (meters) is the distance travelled.

| THE r PACK AG E e n e r s c a p e
The energy cost of travel for legged, terrestrial animals in real landscapes can be predicted by Equation 2. Inclines in the landscape can be calculated from a digital elevation model (DEM) using GIS.
Energy landscapes can be then derived, using Equation 2, for terrestrial animals of given body masses. As DEMs are available at high accuracy and resolution globally (e.g. Tachikawa et al., 2011), computing energy landscapes at fine scales is potentially feasible everywhere.
In enerscape, the DEM is used as input to calculate the incline between cells, which are then used to compute the energy costs of travel among adjacent cells using Equation 2. Calculations are evaluated on transition matrices, a graph theory approach where raster cells are modelled as network nodes and transition among cells as weighted links, as implemented in the r package gdistance (Etten, 2017). For instance, the energy necessary to move from cell A to cell B is represented by a link A → B with weight proportional to the energy costs of transition. Notably, transition matrices do not need to be symmetrical, that is, a link A → B may have a different weight from the link B → A; as directionality is important when computing energy costs of movement, the use of transition matrices permits to discriminate such processes. enerscape also computes the matrix with elements equal to the inverse of the energy cost, which measures how many transitions can be made for one unit of energy. Borrowing from circuit theory, this matrix is often defined as the conductance matrix, as it represents how 'easy' it is to pass from one cell to another. The energy cost transition matrix and the conductance transition matrix can then be used in enerscape to evaluate optimal paths of travel and associated movement metrics. The transition matrices are also converted to rasters, where cell values are obtained as the mean of the incoming weighted links to the nodes.
This comes with a loss of information, but it is useful to visualize and test predictions of optimal movement paths in a geographical setting and to perform additional analyses. The energy landscape is the geographical raster derived from the cost of travel transition matrix. enerscape requires a DEM raster and the body mass of the study animal as input for the function enerscape(). Internally, enerscape() computes the slope (degrees) of transition between cells, calculates the energy cost of travel (E; J or kcal) between cells based on Equation 2 (the movement model module) and the conductance (J −1 or kcal −1 ), defined as 1/E. Transition matrices can be evaluated between 4 (chess rook movement), 8 (king's move) or 16 (king's + knight's move) neighbour cells using the optional argument neigh (default = 16).
Other models can be implemented as needed by modifying the script enerscape_internals.R and specifying the optional argument method (default = 'ARC', Equation 2). The transition matrices are then converted to rasters by averaging the incoming links to each cell node.
The output of enerscape is a 'enerscape' object, containing the rasters of DEM, incline, energy landscape and conductance as well as the conductance transition matrix, which can be used to compute leastcost paths and other route metrics using enerscape (or gdistance) without the inevitable loss of information of raster conversion.
We implemented two algorithms from the gdistance package to calculate least-cost paths and random walks of animals. In particular, en_lcp() computes the least-cost path between two points, returning the path that minimizes the energy costs, its length and the total energy costs. en_passage() computes the probability of passage across cells for random walks that deviates from the least-cost path by a chosen factor, returning a raster with the net cumulative probability of passage within cells. We also implemented two functions to create initialization files for the Julia implementations of Circuitscape and Omniscape, which calculate the connectivity between two (1) points and for the whole landscape using a circuit theory approach (Anantharaman et al., 2020;McRae et al., 2016). Borrowing from circuit theory, Circuitscape models landscape connectivity based on a resistance matrix and calculates the connectivity between two locations as the cumulative current between the two points of the circuit. Omniscape models the omni-directional landscape connectivity by applying Circuitscape to all points within a moving window with radius defined by the user. As an R implementation of these two algorithms is still lacking, enerscape relies on their implementations in the Julia programming language (Bezanson et al., 2017). In particular, Julia initialization files can be created with the enerscape functions cirtuitscape_skeleton() and omniscape_skeleton(), which take as input an enerscape object and two user-specified locations for Circuitscape or the moving window of the algorithm (in cells) for Omniscape. In both cases, the energy landscape is used as the resistance matrix, that is, assuming that landscape connectivity for the animal is inversely proportional to the energy costs of travel.
This provides a meaningful way to quantify landscape connectivity based on the energetic costs that animals experience while moving.
When appropriate data are available, the landscape connectivity derived using the energy landscape can also provide a null model to test other factors that may drive animal movement in the landscape.
After the initialization files are created, Circuitscape and Omniscape can be run in Julia by passing the initialization files as arguments to the functions compute() and run_omniscape(), respectively. We illustrate an application example in the next section, with more examples and code available in Supplemental Information and from the package vignette: https://emili o-berti.github.io/eners cape.html.

| APPLI C ATI ON: L ANDSC APE CONNEC TIVIT Y FOR THE MAR S IC AN B ROWN B E AR IN THE S IRENTE-VELINO REG IONAL PARK
The possible applications of energy landscapes are broad and diverse. For example, energy landscapes can be used to determine optimal movement paths that minimize energy costs of travel, to study how animal usage of the landscape is affected by locomotory costs in habitat suitability models or in macroecological analyses to investigate landscape connectivity at large scales for many species.
To give concrete examples of one of these applications and illustrate the workflow of the package, we show how to obtain energy landscape and landscape connectivity for the Marsican bear in the Sirente-Velino Regional Park (SVRP), a protected area in central Italy ( Figure 2). Importantly, as telemetry data are scarce for this species in the park, this example provide a first, cost-effective assessment of areas that should be preferred by bears while minimizing energy costs of movement.
The Marsican brown bear is a critically endangered, isolated subpopulation of the Eurasian brown bear (Ursus arctos arctos) residing in central Italy, including the SVRP (Morini et al., 2017). The SVRP, covering around 50,000 ha, was established in 1989 to protect the natural and cultural heritage of the area. Because of the continuous presence of bears in the area and its role as a potential crossing corridor across the Central Apennines, the SVRP has been proposed as a critical conservation area for the Marsican bear (Maiorano et al., 2019).
Understanding how the Marsican bear uses the area within the SVRP is important to inform conservation of this endangered population.
We used enerscape to derive the energy landscape for bears in the SVRP and infer the landscape connectivity of the park.
We downloaded the DEM of the area at 10 × 10 m resolution from TINITALY (Tarquini et al., 2007) and aggregated it to 100 × 100 m using bilinear interpolation. At this resolution, the elevation within the park ranges from 222 to 2,469 m, with absolute slopes ranging from 0 to 66 degrees. First, we computed the energy landscape for a typical female Marsican bear of 140 kg: R> dem <raster("DEM.tif") R> en <enerscape(dem, 140, unit = "kcal") Then, we generated the Omniscape initialization file using a moving window of 10 cells radius, equivalent to 1 km at the resolution of our study:

F I G U R E 2
The Sirente-Velino Regional Park. (a) Digital elevation model. (b) The energy landscape, that is, the energy costs for travel in the landscape, for the Marsican bear (Ursus arctos). (c) A picture of the Sirente mountain peak. The continuous line shows the park boundaries, with areas outside the park being shaded transparently. Grey areas show cells with high probability of urban settlements, as detected by satellite imagery (Corbane et al., 2020) R> omniscape _ skeleton(en, path = "bear", radius =

10)
which creates the file omniscape.ini in the subfolder 'bear'. Finally, we run the Omniscape algorithm in Julia: julia> run _ omniscape("bear/omniscape.ini") Omniscape output showed that many regions in the SVRP had low energy costs paths resulting in high connectivity values, but that these were associated with urban areas in many cases ( Figure 3). As areas near human settlements are associated with higher bear mortality (Falcucci et al., 2009), our findings suggest that bears moving across low-energy trajectories are likely to encounter high-risk areas. We also found high connectivity values in valleys between mountain peaks, where human settlements are scarce, highlighting the potential importance of these areas for mitigating humanwildlife conflicts. Importantly, we also found that the north side of the Monte Sirente, located at the centre of the park (Figure 2), had low connectivity values due to the steep inclines that determine high cost of travel. This suggests that the Marsican bear, instead of crossing the Monte Sirente directly, may use less costly, but longer routes that will lead them past urban areas, potentially presenting a trade-off between movement cost and higher mortality risk associated with urban areas.
To explore this possibility, we also computed the least-cost path between two points on the opposite sides of the Monte Sirente and the overall connectivity between the two points using Circuitscape.
The least-cost path between the two points was obtained with the enerscape function en_lcp(), returning the shortest path as a spatial vector object: To calculate the overall connectivity between the two points, we generated the Circuitscape initialization file: R> circuitscape _ skeleton(en, path = "bear", points =p) and ran the Circuitscape algorithm in Julia: julia> compute("bear/circuitscape.ini") We found that the least-cost path did not directly cross the Monte Sirente, which had connectivity values comparable to longer routes with more gentle inclines (Figure 3). Overall, our results show that the SVRP is relatively well connected at the landscape level, but that many highly connected areas with low energy costs of travel are near human settlements, where mortality risk is higher for bears, and that the Monte Sirente likely acts as a barrier for dispersal of bears due to the high energy costs of travel on such steep terrains.

| OTHER APPLI C ATI ON S
To demonstrate its versatility, we show two other potential applications of enerscape. In example one, we assessed the importance of energy landscapes in driving habitat usage of feral horses and cattle in a rewilding site in Denmark. In particular, we used energy landscapes as resistance matrix to estimate the overall landscape connectivity of the site for the animals. In the second example, we show how body weight of cyclists affects their overall performance at a famous cycling event. In both cases, we computed movement costs using enerscape. For the rewilding site, we included these costs in a habitat suitability model in order to explain why horses and cattle use the rewilding area differently. For the cycling event, we used the costs to calculate overall energy expenditures based on speed and body weight of cyclists. Detailed description of methods and code can be found in Supplemental Information and in the package vignette: https://emili o-berti.github.io/eners cape.html.
For the rewilding site example, we found that energy landscapes were important in explaining how animals use specific areas within the site (Figure 4 and Figure S2; Table S1) with the cattle, and to a lesser extent the horses, preferentially using highly connected open F I G U R E 3 Landscape connectivity for the Marsican bear in the Sirente-Velino Regional Park. (a) Landscape connectivity across the whole area. (b) Connectivity evaluated only between two locations. Colours show the connectivity standardized between zero and one, with dark colour representing areas with low connectivity and bright colours areas with high connectivity. Red colour shows urban areas and the dark blue line in B the least-cost path between the two locations areas associated with low locomotory costs ( Figure S3). This suggests that neglecting energy costs of travel in suitability models may result in incorrect estimates of how animals select their habitats and thus of the anticipated spatial distribution of their ecological impact, highlighting the importance of energy landscapes in habitat usage and resource selection models.
For the cycling example, we implemented another locomotory model (di Prampero et al., 1979) as internal module of enerscape and found that (not surprisingly) heavier cyclists consumed more energy than lighter ones at the same cycling speed. But we also discovered that this difference decreased for increasing speed (Figure 4 and Figure S4), highlighting that air drag, which depends on frontal surface area rather than body weight, was more important in determining energy expenditure than other factors at higher speeds. This example, which illustrates how to implement other movement models in enerscape, suggests that heavier cyclists should aim to proceed at high speeds, thus reducing any comparative, competitive costs of energy expenditures due to body weight.

| D ISCUSS I ON
The r package enerscape integrates existing locomotory models into a GIS framework in order to compute energy landscapes of terrestrial animals using transition graphs. Notably, enerscape is built in a modular way and can potentially implement new models for other movement types, for example, crawling, swimming and flying. A caveat of our framework is that its accuracy depends on the accuracy of the locomotion model used. For example, the ARC model (Equation 2; Pontzer, 2016) has been derived from general theory and empirically tested, but only for a subset of body masses (0.78 g to 431.00 kg) and inclines (−24° to 90°) and by using data from animals in laboratory conditions (Pontzer, 2016).
The application of our framework thus rests on the assumption that this locomotion model can be generalized. Nonetheless, the ARC model predicts accurately energy cost of locomotion for African elephants (Loxodonta africana) from independent sources ( Figure S1; Wall et al., 2006), suggesting the ARC model is appropriate also for larger species.
In addition to energy landscapes, other factors influence animal movement in real ecosystems. For example, predator avoidance, resource availability and physical factors other than incline (e.g. substrate density) can determine if an energetically favourable path is actually preferred (Gallagher et al., 2017;Shepard et al., 2013). In this sense, the energy landscape provides one of the potential determinant of animal movement and habitat selection, the importance of which can be assessed jointly considering also other drivers in multifactorial analyses. For instance, deviation from optimal energy paths can highlight important trade-offs in optimal foraging strategies (Masello et al., 2017;Wilson et al., 2012), the role interspecific interactions, such as the effects of landscapes of fear (Gable et al., 2020;Gallagher et al., 2017), and the effects of anthropogenic activities in disrupting animal migrations and their habitat use (Jeltsch et al., 2013;Nickel et al., 2021). In our example with the Marsican bear, other environmental factors, most notably resource availability (Chetkiewicz & Boyce, 2009), can influence how animals use the area; only by jointly considering both resource availability and energy landscapes, the trade-offs between energy costs and gains can be clarified.

| CON CLUS ION
The r package enerscape provides a novel, ready-to-use tool for researchers and practitioners to quantify energy costs of moving through the landscape, mapped as energy landscapes. Energy landscapes are a physiologically meaningful way to estimate animal use of habitats and of landscape corridors based on energetic efficiency F I G U R E 4 Results for the two additional examples. (a) Results from the habitat suitability model for horses (blue) and cattle (red) in the Danish rewilding site. These partial plots show the marginal effects of predictors on the animal's GPS kernel density estimate (KDE). Landscape connectivity was obtained using energy landscapes, calculated using enerscape, as resistance matrix for animal movement. (b) Energy consumed to cycle the event l'Eroica according to overall cycling speed and weight of cyclists. Points are predictions from enerscape using the locomotory model from di Prampero et al. (1979), with colours showing cyclist weight. Violin plots show the variability of energy consumed at a given speed, with horizontal lines representing the median of locomotion (Shepard et al., 2013). A major strength of enerscape is that it efficiently estimates energy landscapes from widely available topographic and body size data, allowing a cost-effective first estimate of landscape use and movement corridors even when telemetry data are not available. Finally, enerscape can be used to better understand where and why animals move and to inform practical conservation and management decisions. Open access funding enabled and organized by ProjektDEAL.

CO N FLI C T O F I NTE R E S T
We have no conflict of interests.

AUTH O R S ' CO NTR I B UTI O N S
E.B., M.D. and F.V. conceived the idea and designed the methodology; E.B. analysed the data and led the writing of the manuscript.
All authors developed ideas and contributed critically to the study and to the final version of the manuscript and gave final approval for publication.

PEER R E V I E W
The peer review history for this article is available at https://publo ns.com/publo n/10.1111/2041-210X.13734.

DATA AVA I L A B I L I T Y S TAT E M E N T
Data are deposited in the Dryad Digital Repository https://doi. org/10.5061/dryad.wwpzg mskm . The r package enerscape is available from CRAN: https://cran.r-proje ct.org/web/ packa ges/eners cape/index.html; a development version can be accessed at https://github.com/emili o-berti/ eners cape.