Third Edit: The only reason I can think of for my exported zeros is that MCD19A2 reports some missings as zero, but gives them a "Best Quality" value in the AOD_QA band. This means for many regions all pixels get masked out, but some zero measurements stay. Is that plausible?

Second edit: The behavior of .mean() functions is explained in the official tutorials, e.g. here https://developers.google.com/earth-engine/reducers_reduce_region. They do not take into account pixels that are masked out.

First Edit: I'm wondering now whether it is default behavior of ee.Reducer.mean() to return zero if all pixels are missing. I haven't found anything on this in the documentation. Can anybody confirm this?

I'm creating daily pollution averages by ROI with MCD19A2_GRANULES and I want to filter out low quality images. Currently, I'm doing this with a mask, but I get zeros rather than missings after I take the mean() of the daily ImageCollection and after applying the ReduceRegions to these daily means. I assume that this is due to the mask creating zeros in the band.

Would it make sense to do a .filter(ee.Filter.neq('Optical_Depth_047', 0)) in Line 69 after I map my filterBadObs function over the ImageCollection? The problem is that this would also filter out true zeros.

What would be a better way to filter here?


1 Answer 1


My code stopped returning zeros, when I started masking with .updateMask() rather than .mask(). It seems that pixels masked by the latter are not excluded but counted as zeros in .mean() functions.

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.