jeffreyevans/spatialEco

Trasp function

Rapsodia86 opened this issue · 2 comments

Hi there,
I think that there is missing parenthesis in the equation.
ORG:
"trasp <- function(x, ...) {
if (!inherits(x, "RasterLayer")) stop("MUST BE RasterLayer OBJECT")
asp <- raster::terrain(x, out='aspect', unit='degrees')
return( raster::calc(asp, fun=function(x) { 1 - cos( (3.142/180) *(x - 30) ) / 2 }, ... ) )"

Should not be?:

"trasp <- function(x, ...) {
if (!inherits(x, "RasterLayer")) stop("MUST BE RasterLayer OBJECT")
asp <- raster::terrain(x, out='aspect', unit='degrees')
return( raster::calc(asp, fun=function(x) { (1 - cos( (3.142/180) *(x - 30) )) / 2 }, ... ) )"

Best,
Monika