validPixel#

geetools.ImageCollectionAccessor.validPixel(band='')#

Compute the number of valid pixels in the specified band.

Compute the number of valid pixels in the specified band. 2 bands will be created: one with the number of valid pixels (valid) and another with the percentage of valid pixels (pct_valid).

Parameters:

band (str | ee.String) – the band to evaluate for valid pixels. If empty, use the first band.

Returns:

An Image with the number of valid pixels or the percentage of valid pixels.

Return type:

ee.Image

Examples

import ee, geetools
collection = (
    ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA")
    .filterBounds(ee.Geometry.Point(-122.262, 37.8719))
    .filterDate("2014-01-01", "2014-12-31")
)
valid = collection.geetools.validPixels("B1")
print(valid.getInfo())