Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(raster)
- r <- raster()
- userpath <- "C:\somepath"
- for(i in 1:203){
- NIR <- list.files(path = userpath, pattern = 'NIR,*.*.tif',full.names = T)
- RED <- list.files(path = userpath, pattern = 'red*.*.tif', full.names = T)
- for (i in 1:203) {
- ndvitemp <- overlay(raster(NIR[i]),raster(RED[i]), fun = function(x,y) (x - y)/(x + y))
- writeRaster(ndvitemp, paste0(userpath,'NDVI',"_",i,'.tif'))}
Add Comment
Please, Sign In to add comment