jorgeassis
5/14/2020 - 6:51 PM

Apply Function to raster

# apply function to raster
above30SST <- calc(maxSST, fun=function(x){ x[x < 30] <- 0; x[x >= 30] <- 1; return(x) } )

# apply function to stack of rasters
rangeSSTEurope <- calc(thermalConditionsEurope, fun=function(x){ return( x[[2]] - x[[1]] ) } )