ee_extra.QA.clouds.maskClouds#

ee_extra.QA.clouds.maskClouds(x, method='cloud_prob', prob=60, maskCirrus=True, maskShadows=True, scaledImage=False, dark=0.15, cloudDist=1000, buffer=250, cdi=None)[source]#

Masks clouds and shadows in an image or image collection (valid just for Surface Reflectance products).

Parameters:
  • x (Union[Image, ImageCollection]) – Image or Image Collection to mask.

  • method (str) –

    Method used to mask clouds.

    Available options:
    • ’cloud_prob’ : Use cloud probability.

    • ’qa’ : Use Quality Assessment band.

    This parameter is ignored for Landsat products.

  • prob (Union[int, float]) – Cloud probability threshold. Valid just for method = ‘cloud_prob’. This parameter is ignored for Landsat products.

  • maskCirrus (bool) – Whether to mask cirrus clouds. Valid just for method = ‘qa’. This parameter is ignored for Landsat products.

  • maskShadows (bool) – Whether to mask cloud shadows. For more info see ‘Braaten, J. 2020. Sentinel-2 Cloud Masking with s2cloudless. Google Earth Engine, Community Tutorials’.

  • 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[float]) – Cloud Displacement Index threshold. Values below this threshold are considered potential clouds. A cdi = None means that the index is not used. For more info see ‘Frantz, D., HaS, E., Uhl, A., Stoffels, J., Hill, J. 2018. Improvement of the Fmask algorithm for Sentinel-2 images: Separating clouds from bright surfaces based on parallax effects. Remote Sensing of Environment 2015: 471-481’. This parameter is ignored for Landsat products.

Return type:

Union[Image, ImageCollection]

Returns:

Cloud-shadow masked image or image collection.