Statistical API: sampleCount and noDataCount


How are sampleCount and noDataCount defined in case of non-rectangular geometries?

It seems that noDataCount never reaches 0 for non-rectangular regions but has a minimum value that is related to the region’s boundingbox.

For example the results in this example have a constant noDataCount for different dates:

If I’m using dynamic masking (with for example CLM/SCL flags) to set noDataMask, is there a way to determine the number of no-data-pixels within the irregular polygon?


Thanks for your question. This is quite a difficult concept to answer, but, to put it simply when you make a request, a bounding box of a geometry is requested and the pixels not in the geometry but within the bounding box are labelled no data. Therefore:

  • sampleCount = width * height (always the bounding box of the request, be it bbox or geometry that is being requested)
  • noDataCount = sampleCount - no. of pixels in the geometry

I hope this answers your question. Let me know if you need a more detailed explanation and I can run through an example of the concept for you.

Thank you, this helps.

For my use case, daily statistics from S2L2A data with custom noData mask derived from CLM and SLC, I’m interested also in the daily number of no-data pixel within the geometry.

Getting that value would be nice improvement to the API.

Is there currently any other way to get that information than to assume that in the time-series the date when noDataCount gets it’s minimum value is completely cloud free and derive the total number of pixels within the geometry accordingly?

  • no. of pixels outside the geometry = min(noDataCount)
  • number of no-data-pixels in geometry = noDataCount - min(nodataCount)