Mask Cover

Percentage of masked pixels


In [1]:
import ee
ee.Initialize()

In [2]:
from geetools import algorithms, ui, cloud_mask, tools

In [3]:
from ipygee import *

Area of Interest


In [4]:
p = ee.Geometry.Point([-71.33972167968751, -42.737619925503054])
aoi = p.buffer(8000).bounds()

Masked image


In [5]:
i = ee.Image('COPERNICUS/S2/20181122T142749_20181122T143353_T18GYT')
masked = cloud_mask.sentinel2()(i)
masked = masked.clip(aoi)

Compute Mask Cover


In [6]:
cover = algorithms.maskCover(masked, aoi, 10)

In [7]:
eprint(cover.get('MASK_COVER'))


Show Image on Map


In [8]:
Map = Map()
Map.show()



In [9]:
vis = {'bands': ['B8', 'B11','B4'], 'min':0, 'max':5000}

In [10]:
Map.addLayer(masked, vis, 'Masked image')

In [11]:
Map.centerObject(aoi)

Make it an image band


In [12]:
metadata = cover.metadata('MASK_COVER')

In [13]:
tools.image.getValue(metadata, aoi.centroid(1), 10, side='client')


Out[13]:
{'MASK_COVER': 14.97}

In [ ]: