This is my first question on R so please bear with me.
Basically, I have a Raster and am able to convert it from a DEM Raster to a slope raster. However, when I convert it to a slope raster, I want to be able to change it from calculating the slope using the surrounding 8 neighbors to something larger.
My current code looks like this:
#Read Raster
Original_Raster <- raster("output-5km-8192p-000.63m.tif")
#Call Raster min/max details
Original_Raster <- setMinMax(Original_Raster)
#Set new extent to variable
bb <- extent(-2560,2560,-2560,2560)
#Change Raster extent to variable
extent(Original_Raster) <- bb
Original_Raster <- setExtent(Original_Raster, bb, keepres = TRUE)
#Plot Raster
plot(Original_Raster)
title('Original Elevation Model')
crs(Original_Raster) <- "+proj=stere +lat_0=-90 +lon_0=0 +k=1 +x_0=0 +y_0=0 +R=1737400 +units=m +no_defs"
#Create slope raster
Original_Raster_Slope = terrain(Original_Raster, 'slope', unit='degrees', neighbors=8)
This is the output of the two plots DEM Raster Slope Raster
My resolution is currently 0.625x0.625m.
My current understanding of using terrain() with 8 neighbors is that it creates a 3x3 grid and the center cell is the slope of that grid. In this case it would be a 1.875x1.875m grid (cell size x3). I want a larger grid to calculate the slope of each cell (particularly a 11.875x11.875m grid - roughly 19x19 grid or 360 neighbors... 361 cells minus center cell).
It's imperative that I keep the resolution at 0.625m and not combine them into 5.625m blocks as I would lose a large number of cells to this that I need for random sampling.
Any help would be greatly appreciated!!