open-geocomputing / OpenEarthEngineLibrary

https://www.open-geocomputing.org/OpenEarthEngineLibrary/
129 stars 39 forks source link

In Colab, using OEEL #26

Open koala17github opened 5 months ago

koala17github commented 5 months ago

In Colab, using OEEL for SG filtering previously worked successfully, but now it stays in a running state without producing results. How can this be resolved?

mgravey commented 5 months ago

can you provide an example code ?

koala17github commented 5 months ago

%%capture !pip install oeel --upgrade import ee from oeel import oeel import geemap

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

def reproj(imge): image=imge.clip(roibox)\ .reduceResolution({\ 'reducer': ee.Reducer.mean(), 'maxPixels': 1024 })\ .reproject({'crs':'EPSG:4326','scale':926.6254331387497})

return image datestar=ee.Date('2016-01-01') dateend=ee.Date('2017-01-01') days=dateend.difference(datestar,'day').getInfo()-9

window_size = 15; half_window = (window_size - 1)/2;

roi = ee.Geometry.Polygon( [ [ [-64.602356, -1.127399], [-68.821106, -12.625598], [-60.647278, -22.498601], [-47.815247, -21.111406], [-43.860168, -8.913564], [-54.582825, -0.775886], [-60.823059, 0.454555], [-64.602356, -1.127399], ] ] ) roibox=roi.bounds()

ndviset = ee.ImageCollection('MODIS/MOD09GA_006_NDVI') ndviset1 = ndviset \ .filterDate(datestar.advance(-half_window,'day'),'2016-02-19').merge(ndviset.filterDate('2016-02-29',ee.Date('2016-11-01'))) \ .select('NDVI') \ .map(reproj)

ndviset2 = ndviset \ .filterDate(ee.Date('2016-11-01'), dateend.advance(half_window,'day')) \ .select('NDVI') \ .map(reproj)\

ndvisetmeg=ndviset1.merge(ndviset2) ndvilist=ndvisetmeg.toList(370) ndvisetmeg

NDVI_sg=oeel.ImageCollection.SavatskyGolayFilter(ndvisetmeg,\ ee.Filter.maxDifference(1000360024*10, 'system:time_start', None, 'system:time_start'),\ sgfun,\ 5,['NDVI'])

koala17github commented 3 months ago

Hi, teacher, has this issue been resolved?