I have 6 stacks Sentinel 2 images (10m resolution) that I want to crop to my AOI and cloud masking. After which I want to calculate NDVI in R. The stacks are 3 from different months of 2016 and 3 from 2018.
I have read my AOI and different bands to create a stack as shown below
forest_shp <- readOGR(dsn= ".", layer = "forest_fichtelgebirge1")
band2_20160708 <- raster("T32UQA_20160708T101032_B02_10m.jp2")
band3_20160708 <- raster("T32UQA_20160708T101032_B03_10m.jp2")
band4_20160708 <- raster("T32UQA_20160708T101032_B04_10m.jp2")
band8_20160708 <- raster("T32UQA_20160708T101032_B08_10m.jp2")
all_bands_20160708 <- stack (band2_20160708, band3_20160708, band4_20160708, band8_20160708)
#cropping/masking
new_all_bands_2016070 <- mask(crop(forest_shp), all_bands_20160708)
I seek any looping ideas?