1

I am working with Landsat 8 images to create seasonal NDVI images in QGIS.

For all NDVI images I masked the clouds/cloud shadows so there are 4 different NDVI images with different cloud/cloud shadow masks .

How could I create one single NDVI image with mean NDVI values out of the 4 different NDVI images?

2

A workaround could be using R scripts in QGIS.

For your specific purpose use this script:

##LayerA = raster
##LayerB = raster
##LayerC = raster
##LayerD = raster
##output = output raster
library(raster)
calc(stack(LayerA, LayerB, LayerC,LayerD), fun = mean, na.rm = T)

enter image description here

And you'll be able to compute NDVI mean taking account No Data pixels (masked pixels).

enter image description here

 Requirements:

Rasters should have the same extent and pixel resolution. You can solve this before with GDAL, SAGA or GRASS tools or add a normalization step in R script.

Notes:

If you stack layers before, you can define only one input file and work with several layers (from 2 to hundreds of layers or even more, depending on the amount of memory required) with minor changes (deleting the others inputs)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.