geetools.ImageCollection.ImageCollectionAccessor.maskClouds#
- geetools.ImageCollection.ImageCollectionAccessor.maskClouds(method='cloud_prob', prob=60, maskCirrus=True, maskShadows=True, scaledImage=False, dark=0.15, cloudDist=1000, buffer=250, cdi=None)#
Masks clouds and shadows in each image of an ImageCollection (valid just for Surface Reflectance products).
- Parameters:
self – ImageCollection to mask.
method (str) –
Method used to mask clouds. This parameter is ignored for Landsat products. Available options:
’cloud_prob’ : Use cloud probability.
’qa’ : Use Quality Assessment band.
prob (int) – Cloud probability threshold. Valid just for method = ‘cloud_prob’. This parameter is ignored for Landsat products.
maskCirrus (bool) – Whether to mask cirrus clouds. Default to
True
. Valid just for method = ‘qa’. This parameter is ignored for Landsat products.maskShadows (bool) – Whether to mask cloud shadows. Default to
True
This parameter is ignored for Landsat products.scaledImage (bool) – Whether the pixel values are scaled to the range [0,1] (reflectance values). This parameter is ignored for Landsat products.
dark (float) – NIR threshold. NIR values below this threshold are potential cloud shadows. This parameter is ignored for Landsat products.
cloudDist (int) – Maximum distance in meters (m) to look for cloud shadows from cloud edges. This parameter is ignored for Landsat products.
buffer (int) – Distance in meters (m) to dilate cloud and cloud shadows objects. This parameter is ignored for Landsat products.
cdi (Optional[int]) – Cloud Displacement Index threshold. Values below this threshold are considered potential clouds. A cdi = None means that the index is not used. This parameter is ignored for Landsat products.
- Returns:
Cloud-shadow masked image.
- Return type:
ee.ImageCollection
Notes
This method may mask water as well as clouds for the Sentinel-3 Radiance product.
Examples
import ee, geetools ee.Initialize() S2 = ( ee.ImageCollection('COPERNICUS/S2_SR') .maskClouds(prob = 75,buffer = 300,cdi = -0.5) .first() )