How could I create a function calculating NDVI difference from actual NDVI and mean NDVI values to add as a new band to the collection?

Something like this:

var ndvi_diff = ndvi.map(function (image) {
  return image.subtract(ndvi_mean).addBands('ndvi_diff');

Can I do calculations with different image collections?

Note that I don’t want to reduce the collection into a single image but I would like to have the mean and then the calculated formula for all images in the same collection as new bands.

1 Answer 1


Similar to this question: Calculating the vegetation condition indices over a stacked vegetation indices in Google Earth Engine

You could try something like this:

var getdiff = function(image){
  var diff = image.subtract(meanImage).rename('ndvi_diff')
  return diff // only the vci


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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