0

I am trying to calculate the standard deviation and mean of all individual pixels in an Image Collection. The image collection is eight years of NDVI data filtered to one crop and that crop is not grown every year so when I reduce the image collection to find the mean and standard deviation of each pixel in the spatial area, I think GEE includes the null values as 0. Is that correct and how do you address that? Thank you.

Steph
  • 33
  • 1
  • 5

1 Answers1

0

Earth Engine uses masks to eliminate null values. For layers in the data catalog, this has already been done. However, you will need to determine if it has been done for the data you are using. If null values are indeed zeroes, you can update the mask with e.g.

var mask = image.eq(0);
var masked_image = image.updateMask(mask);

For an image collection, you can use map to accomplish this for each image.

function fix_mask(image) {
  var mask = image.eq(0);
  return image.updateMask(mask);
}

masked_collection = collection.map(fix_mask);
Jesse Anderson
  • 4,507
  • 26
  • 36