You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a multiband raster stack and I want to find the band number of the maximum value for each pixel. For this, I have used the following code:
#Set working directory
setwd("E:/Red Panda/TIF")
library(raster)
#Get the names of all the files with extension ".tif" of the folder
files <- list.files("E:/Red Panda/TIF/", pattern='tif$', full.names=TRUE )
files
Raster_stack <- stack(files)
Raster_stack
names(Raster_stack)
plot(Raster_stack)
Identify pixel-wise band with max value
pixelMaxBand.ras <- whiches.max(Raster_stack)
But I found this type of error:
Error in .local(x, ...) :
you can use only use this function for an object with less than 10 layers
Generally, I have >10 raster layers for different land use and land cover but this “whiches.max” function works for layers less than 10. Can you please suggest me the appropriate code that can work for rasters >10? Thank you.
The text was updated successfully, but these errors were encountered:
I have a multiband raster stack and I want to find the band number of the maximum value for each pixel. For this, I have used the following code:
#Set working directory
setwd("E:/Red Panda/TIF")
library(raster)
#Get the names of all the files with extension ".tif" of the folder
files <- list.files("E:/Red Panda/TIF/", pattern='tif$', full.names=TRUE )
files
Raster_stack <- stack(files)
Raster_stack
names(Raster_stack)
plot(Raster_stack)
Identify pixel-wise band with max value
pixelMaxBand.ras <- whiches.max(Raster_stack)
But I found this type of error:
Error in .local(x, ...) :
you can use only use this function for an object with less than 10 layers
Generally, I have >10 raster layers for different land use and land cover but this “whiches.max” function works for layers less than 10. Can you please suggest me the appropriate code that can work for rasters >10? Thank you.
The text was updated successfully, but these errors were encountered: