open-geocomputing / OpenEarthEngineLibrary

https://www.open-geocomputing.org/OpenEarthEngineLibrary/
127 stars 38 forks source link

can't use SavatskyGolayFilter in python #12

Closed YANQIN2021 closed 1 year ago

YANQIN2021 commented 1 year ago

Hi, I use oeel.ImageCollection.SavatskyGolayFilter in python and define distanceFunction like example, but I get an error like below Fig 微信图片_20230215085554 . here is my code: days = 60 millis = ee.Number(days1000606024)

maxDiffFilter = ee.Filter.maxDifference( difference= millis, leftField='system:time_start', rightField= 'system:time_start' )

def distanceFunction(infromedImage, estimationImage): return ee.Image.constant(ee.Number(infromedImage.get('system:time_start')) .subtract(ee.Number(estimationImage.get('system:time_start'))))

order = 3 smoothed = oeel.ImageCollection.SavatskyGolayFilter(test,maxDiffFilter,distanceFunction)

mgravey commented 1 year ago

Hi, this is an interesting issue, and surprisingly this situation is not in my tests. I know from what is due, I need to think about a proper fix. Is this urgent, I think I don't really time have time before next week.

YANQIN2021 commented 1 year ago

Thanks for your reply! The question is not urgent, do your busy first. And I also find the oeel.requireJS runime is too long, like Fig. When I use another smooth function in python, it almost use more than 2h, but only 5 min on google earth engine platform. 微信图片_20230216105012

mgravey commented 1 year ago

I don't really know what your smooth function do but I am almost sure that you should use a .get(0), .first() or any similar ee function and not [0]

mgravey commented 1 year ago

Fixed and fixed. I believe I have identified the issue that was causing the computation to run indefinitely. It appears that the deallocation of a particular object was preventing the Python process from terminating. Fortunately, while addressing this issue, we were able to fix several other related issues as well.

If you encounter any further issues, please don't hesitate to reopen the ticket if related, or simply make a new one.

YANQIN2021 commented 1 year ago

Thanks for your help!