You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @davemlz! I don't think this is really an eemont bug, but I'm wondering if you know of a good workaround or if maybe there's an eemont feature that could help with this.
Describe the bug
If you use a reducer other than ee.Reducer.first on an ImageCollection and then try to use the index method, an attribute error is thrown. I think this is because Earth Engine reducers like ee.Reducer.median don't preserve image metadata that's needed for _get_platform_STAC to work.
I'm not sure exactly what metadata _get_platform_STAC needs, but maybe I could fix this by setting or copying some properties after running median?
To Reproduce
importee, eemontee.Initialize()
s2=ee.ImageCollection("COPERNICUS/S2_SR")
pt=ee.Geometry.Point([-122.276437, 44.803428])
img= (s2
.filterBounds(pt)
.filterDate("2020-01-01", "2020-01-30")
# Using .first() instead would fix the problem
.median()
)
img=img.index("NDSI")
You're totally right. The problem here is that after reducing an image it loses all its properties. Most eemont methods depend on the system:id property, so it is necessary to have it. Given this, here is a workaround:
s2=ee.ImageCollection("COPERNICUS/S2_SR")
pt=ee.Geometry.Point([-122.276437, 44.803428])
img= (s2
.filterBounds(pt)
.filterDate("2020-01-01", "2020-01-30")
# Using .first() instead would fix the problem
.median()
.copyProperties(s2.first(),["system:id"])
)
img=ee.Image(img).scaleAndOffset().spectralIndices("NDSI")
I will leave this issue open, maybe I can find a way to fix this in the future :)
Hi @davemlz! I don't think this is really an eemont bug, but I'm wondering if you know of a good workaround or if maybe there's an eemont feature that could help with this.
Describe the bug
If you use a reducer other than
ee.Reducer.first
on an ImageCollection and then try to use theindex
method, an attribute error is thrown. I think this is because Earth Engine reducers likeee.Reducer.median
don't preserve image metadata that's needed for_get_platform_STAC
to work.I'm not sure exactly what metadata
_get_platform_STAC
needs, but maybe I could fix this by setting or copying some properties after runningmedian
?To Reproduce
Setup (please complete the following information):
Additional context
Thanks!
The text was updated successfully, but these errors were encountered: