-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be95a61
commit b1fbc06
Showing
54 changed files
with
544 additions
and
1,471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,80 @@ | ||
[] | ||
[ | ||
{ | ||
"file": "/home/eb97ziwi/Proj/enerscape/src/distance.h", | ||
"file_last_write": 1664895205.0, | ||
"definitions": [ | ||
{ | ||
"usr": "c:@F@distance#$@N@Rcpp@S@Vector>#VI14#@N@Rcpp@ST>1#T@PreserveStorage#d#d#", | ||
"kind": 6, | ||
"parent_name": "", | ||
"name": "distance(Rcpp::NumericVector, double, double)", | ||
"file": "/home/eb97ziwi/Proj/enerscape/src/distance.h", | ||
"line": 11, | ||
"column": 15, | ||
"hidden": false | ||
} | ||
], | ||
"hidden": false | ||
}, | ||
{ | ||
"file": "/home/eb97ziwi/Proj/enerscape/src/enerscape.cpp", | ||
"file_last_write": 1664895433.0, | ||
"definitions": [ | ||
{ | ||
"usr": "c:@F@energy#$@N@Rcpp@S@Vector>#VI14#@N@Rcpp@ST>1#T@PreserveStorage#S0_#d#d#b#", | ||
"kind": 6, | ||
"parent_name": "", | ||
"name": "energy(Rcpp::NumericVector, Rcpp::NumericVector, double, double, bool)", | ||
"file": "/home/eb97ziwi/Proj/enerscape/src/enerscape.cpp", | ||
"line": 16, | ||
"column": 15, | ||
"hidden": false | ||
}, | ||
{ | ||
"usr": "c:@F@energyscape#$@N@Rcpp@S@Matrix>#VI14#@N@Rcpp@ST>1#T@PreserveStorage#I#d#d#b#", | ||
"kind": 6, | ||
"parent_name": "", | ||
"name": "energyscape(Rcpp::NumericMatrix, int, double, double, bool)", | ||
"file": "/home/eb97ziwi/Proj/enerscape/src/enerscape.cpp", | ||
"line": 49, | ||
"column": 15, | ||
"hidden": false | ||
} | ||
], | ||
"hidden": false | ||
}, | ||
{ | ||
"file": "/home/eb97ziwi/Proj/enerscape/src/neighbours.h", | ||
"file_last_write": 1664895233.0, | ||
"definitions": [ | ||
{ | ||
"usr": "c:@F@neighbours#I#I#I#$@N@Rcpp@S@Matrix>#VI14#@N@Rcpp@ST>1#T@PreserveStorage#", | ||
"kind": 6, | ||
"parent_name": "", | ||
"name": "neighbours(int, int, int, Rcpp::NumericMatrix)", | ||
"file": "/home/eb97ziwi/Proj/enerscape/src/neighbours.h", | ||
"line": 12, | ||
"column": 15, | ||
"hidden": false | ||
} | ||
], | ||
"hidden": false | ||
}, | ||
{ | ||
"file": "/home/eb97ziwi/Proj/enerscape/src/slope.h", | ||
"file_last_write": 1664895257.0, | ||
"definitions": [ | ||
{ | ||
"usr": "c:@F@slope#$@N@Rcpp@S@Vector>#VI14#@N@Rcpp@ST>1#T@PreserveStorage#d#d#", | ||
"kind": 6, | ||
"parent_name": "", | ||
"name": "slope(Rcpp::NumericVector, double, double)", | ||
"file": "/home/eb97ziwi/Proj/enerscape/src/slope.h", | ||
"line": 11, | ||
"column": 15, | ||
"hidden": false | ||
} | ||
], | ||
"hidden": false | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
"ascending": true | ||
} | ||
], | ||
"path": "~/enerscape" | ||
"path": "~/Proj/enerscape" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"left": { | ||
"splitterpos": 471, | ||
"splitterpos": 337, | ||
"topwindowstate": "HIDE", | ||
"panelheight": 1140, | ||
"windowheight": 1178 | ||
"panelheight": 818, | ||
"windowheight": 856 | ||
}, | ||
"right": { | ||
"splitterpos": 364, | ||
"splitterpos": 431, | ||
"topwindowstate": "NORMAL", | ||
"panelheight": 1140, | ||
"windowheight": 1178 | ||
"panelheight": 818, | ||
"windowheight": 856 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"TabSet1": 3, | ||
"TabSet2": 0, | ||
"TabSet2": 3, | ||
"TabZoom": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
.Rhistory | ||
.RData | ||
.Ruserdata | ||
inst/doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ Package: enerscape | |
Type: Package | ||
Title: Compute | ||
Energy Landscapes | ||
Version: 0.2.0 | ||
Version: 1.0.0 | ||
Author: Emilio Berti | ||
Maintainer: Emilio Berti <[email protected]> | ||
Description: Compute energy landscapes using a digital elevation model raster and body mass of animals. Vignette available at: <https://emilio-berti.github.io/enerscape.html>. | ||
|
@@ -11,18 +11,15 @@ Encoding: UTF-8 | |
LazyData: true | ||
Imports: | ||
Rcpp, | ||
raster, | ||
gdistance, | ||
rgdal, | ||
rgeos, | ||
sp, | ||
Matrix | ||
methods, | ||
terra | ||
Suggests: | ||
knitr, | ||
rmarkdown, | ||
testthat (>= 3.0.0) | ||
LinkingTo: Rcpp | ||
RoxygenNote: 7.1.1 | ||
RoxygenNote: 7.2.0 | ||
Depends: | ||
R (>= 2.10) | ||
Config/testthat/edition: 3 | ||
VignetteBuilder: knitr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
useDynLib(enerscape, .registration=TRUE) | ||
importFrom(Rcpp, evalCpp) | ||
exportPattern("^[[:alpha:]]+") | ||
|
||
importFrom("methods", "is") | ||
importFrom("terra", | ||
"rast", "rasterize", "writeRaster", "aggregate", | ||
"res", "crs", "crs<-", "ext", "ext<-") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,58 @@ | ||
# Generated by using Rcpp::compileAttributes() -> do not edit by hand | ||
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 | ||
|
||
distance <- function(dem, center, res) { | ||
.Call(`_enerscape_distance`, dem, center, res) | ||
#' Spatial distances | ||
#' | ||
#' @param x matrix with values | ||
#' @param center numeric value (double) with the value of the focal cell | ||
#' @param res numeric value (double) of the spatial resolution of the matrix | ||
#' @return Vector with values the distances between x and center | ||
distances <- function(x, center, res) { | ||
.Call(`_enerscape_distances`, x, center, res) | ||
} | ||
|
||
#' Energy Landscape | ||
#' | ||
#' @param slope vector with slopes | ||
#' @param distance vector with distances | ||
#' @param mass body mass of species (kg) | ||
#' @param res numeric value (double) of the spatial resolution of the matrix | ||
#' @param kcal (boolean) if to return the result in kCal (true) or J (false) | ||
#' @return Vector with the energy cost of locomotion (EnergyScape) | ||
energy <- function(slope, distance, mass, res, kcal = TRUE) { | ||
.Call(`_enerscape_energy`, slope, distance, mass, res, kcal) | ||
} | ||
|
||
energyscape <- function(m, n = 4L, mass = 0, res = 0, kcal = TRUE) { | ||
.Call(`_enerscape_energyscape`, m, n, mass, res, kcal) | ||
#' Energy Landscape | ||
#' | ||
#' @param x matrix with values the elevation. | ||
#' @param n (integer) number of neighbours to consider (either 4 or 8). | ||
#' @param mass body mass of species (kg). | ||
#' @param res numeric value (double) of the spatial resolution of the matrix. | ||
#' @param kcal (boolean) if to return the result in kCal (true) or J (false). | ||
#' @return Matrix with the energy cost of locomotion (EnergyScape). | ||
energyscape <- function(x, n = 4L, mass = 0, res = 0, kcal = TRUE) { | ||
.Call(`_enerscape_energyscape`, x, n, mass, res, kcal) | ||
} | ||
|
||
neighbours <- function(i, j, n, m) { | ||
.Call(`_enerscape_neighbours`, i, j, n, m) | ||
#' Neighbours | ||
#' | ||
#' @param i row index | ||
#' @param j column index | ||
#' @param n number of neighbours (4 or 8) | ||
#' @param x matrix with values | ||
#' @return Vector with values the neighours of x | ||
neighbours <- function(i, j, n, x) { | ||
.Call(`_enerscape_neighbours`, i, j, n, x) | ||
} | ||
|
||
slope <- function(dem, center, res) { | ||
.Call(`_enerscape_slope`, dem, center, res) | ||
#' Slopes | ||
#' | ||
#' @param x matrix with values | ||
#' @param center numeric value (double) with the value of the focal cell | ||
#' @param res numeric value (double) of the spatial resolution of the matrix | ||
#' @return Vector with values the slopes (degrees) between x and center | ||
slope <- function(x, center, res) { | ||
.Call(`_enerscape_slope`, x, center, res) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.