Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Colab, using OEEL #26

Open
koala17github opened this issue Jun 14, 2024 · 2 comments
Open

In Colab, using OEEL #26

koala17github opened this issue Jun 14, 2024 · 2 comments

Comments

@koala17github
Copy link

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
Copy link
Collaborator

mgravey commented Jun 14, 2024

can you provide an example code ?

@koala17github
Copy link
Author

%%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'])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants