Guest User

Untitled

a guest
Mar 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. library(raster)
  2. r <- raster()
  3.  
  4. userpath <- "C:\somepath"
  5. for(i in 1:203){
  6. NIR <- list.files(path = userpath, pattern = 'NIR,*.*.tif',full.names = T)
  7. RED <- list.files(path = userpath, pattern = 'red*.*.tif', full.names = T)
  8.  
  9. for (i in 1:203) {
  10. ndvitemp <- overlay(raster(NIR[i]),raster(RED[i]), fun = function(x,y) (x - y)/(x + y))
  11. writeRaster(ndvitemp, paste0(userpath,'NDVI',"_",i,'.tif'))}
Add Comment
Please, Sign In to add comment