eMapR / lt-gee-py

Python interface to the Google Earth Engine implementation of the LandTrendr spectral-temporal segmentation algorithm.
Apache License 2.0
8 stars 1 forks source link

Exclude Landsat 7 striping fix. #3

Open clarype opened 5 months ago

clarype commented 5 months ago

I've noticed a potential issue with the method designed to remove striping from Landsat 7 images. It appears that the ee.Filter.gt('SCENE_CENTER_TIME', '2003-06-01T00:00') condition is preventing the function from returning an adjusted collection. The main concern is that SCENE_CENTER_TIME only provides the time of day without any year date information, making it inappropriate for filtering by specific dates.

Ideally, we'd like to preserve the earlier images from Landsat 7, before the onset of striping issues. However, I am currently unable to find a property that explicitly dates each image. The closest available identifier is the LANDSAT_PRODUCT_ID, which is a string. To extract the date from this ID, we would need to parse the string for each image which seems cumbersome in its implementation using inequities methods.

To the point, the easiest and fastest way would be to just exclude all of Landsat 7 by dropping the the 'ee.filter.and' and the 'ee.Filter.gt('SCENE_CENTER_TIME', '2003-06-01T00:00')'

From : if 'slcOff' in self.exclude: if self.exclude['slcOff'] is True: collection = collection.filter(ee.Filter.And( ee.Filter.eq('SPACECRAFT_ID', 'LANDSAT_7'), ee.Filter.gt('SCENE_CENTER_TIME', '2003-06-01T00:00') ).Not()) To: if 'slcOff' in self.exclude: if self.exclude['slcOff'] is True: collection = collection.filter(ee.Filter.eq('SPACECRAFT_ID', 'LANDSAT_7')).Not())

jdbcode commented 5 months ago

I think the logic is all fine. However, it looks like the value format for SCENE_CENTER_TIME has changed for Collection 2 e.g., '18:18:29.6640940Z' - it is no longer YYYY-MM-dd etc. I think if you filter on system:time_start it should work: ee.Filter.gt('system:time_start', 1054425600000)

Tested: https://code.earthengine.google.com/d44e507094ce05f3a7b1594cbf5c853b

clarype commented 5 months ago

Prefect! Thanks Jdbcode!