davemlz / eemont

A python package that extends Google Earth Engine.
https://eemont.readthedocs.io/
MIT License
407 stars 69 forks source link

eemont scale and cloudMask error on data with end date before 2018-12-14 #1

Closed Vierod closed 3 years ago

Vierod commented 3 years ago

Hi I've found an apparent issue?

When using eemont for the cloudMask and scale convenience functions, if creating an image collection with a filterDate end date of before 2018-12-14 I receive the following error.

If I remove the .scale or .cloudMask from the call it completes, similarly if the end date is set to later than this it also completes. Is anyone else able to replicate this?

My suspicion is something has changed in the metadata info between these dates?


HttpError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/ee/data.py in _execute_cloud_call(call, num_retries) 344 try: --> 345 return call.execute(num_retries=num_retries) 346 except googleapiclient.errors.HttpError as e:

7 frames HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/value:compute?prettyPrint=false&alt=json returned "Element.get: Parameter 'object' is required.">

During handling of the above exception, another exception occurred:

EEException Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/ee/data.py in _execute_cloud_call(call, num_retries) 345 return call.execute(num_retries=num_retries) 346 except googleapiclient.errors.HttpError as e: --> 347 raise _translate_cloud_exception(e) 348 349

EEException: Element.get: Parameter 'object' is required.

Vierod commented 3 years ago

Ok so if I remove my filterBounds call the error is no longer present, and I can then filterBounds afterwards.

I'm curious if anyone can replicate this but will otherwise close the issue as resolved...

This fails...

geom = ee.Geometry.Polygon([[-89.25692536680897, 16.074658637557285],
[-88.42180379522411, 16.074658637557285],
[-88.42180379522411, 16.75649478205662],
[-89.25692536680897, 16.75649478205662],
[-89.25692536680897, 16.074658637557285]]
)

imcol = (ee.ImageCollection('COPERNICUS/S2_SR')
             .filterDate('2017-01-01', '2017-12-13')
             .filterBounds(geom)
             .scale()
)

This works...

geom = ee.Geometry.Polygon([[-89.25692536680897, 16.074658637557285],
[-88.42180379522411, 16.074658637557285],
[-88.42180379522411, 16.75649478205662],
[-89.25692536680897, 16.75649478205662],
[-89.25692536680897, 16.074658637557285]]
)

imcol = (ee.ImageCollection('COPERNICUS/S2_SR')
             .filterDate('2017-01-01', '2017-12-13')
             .scale()
             .filterBounds(geom)
)

This also works...

geom = ee.Geometry.Polygon([[-89.25692536680897, 16.074658637557285],
[-88.42180379522411, 16.074658637557285],
[-88.42180379522411, 16.75649478205662],
[-89.25692536680897, 16.75649478205662],
[-89.25692536680897, 16.074658637557285]]
)

imcol = (ee.ImageCollection('COPERNICUS/S2_SR')
             .filterDate('2020-01-01', '2020-01-31')
             .filterBounds(geom)
             .scale()
)

So does this...

geom = ee.Geometry.Polygon([[-89.25692536680897, 16.074658637557285],
[-88.42180379522411, 16.074658637557285],
[-88.42180379522411, 16.75649478205662],
[-89.25692536680897, 16.75649478205662],
[-89.25692536680897, 16.074658637557285]]
)

imcol = (ee.ImageCollection('COPERNICUS/S2_SR')
             .filterDate('2017-01-01', '2020-01-31')
             .filterBounds(geom)
             .scale()
)

Maybe I'm just being dim about the reasoning for the order of the calls, is this unusual behaviour?

Vierod commented 3 years ago

There's no images in my area before this date that's why...

Great package thanks! :)

davemlz commented 3 years ago

Hi! Thank you for pointing this out, maybe I can add an Exception requesting the user to check if there are images if something goes wrong!