0

I am trying to get the cloud scores for all the images of landsat 8 collected withing specified time frame in google earth engine python API.

Here is the code I used:

Landsat8_collection= ee.ImageCollection('LANDSAT/LC08/C01/T1_SR').\
filterBounds(LW).\
filterDate('2015-01-01','2020-12-20').\
select(['B4', 'B3', 'B2', ],['B3', 'B2','B1'])

def cloud(img):
    value=img.get('CLOUD_COVER')
    final=value.getInfo()
    return final

landsat_cloud=Landsat8_collection.map(cloud)

I got the error. Whats wrong with the code?

James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

0

You cannot use getInfo inside a mapped function. If you want all the valuesas, for instance a list, use collection.aggregate_array('CLOUD_COVER')

Noel Gorelick
  • 489
  • 2
  • 10