r-earthengine / ee_extra

A ninja python package that unifies the Google Earth Engine ecosystem.
https://ee-extra.readthedocs.io/
Other
58 stars 10 forks source link

Add method to solve ID loss in `ee.Image` #18

Open davemlz opened 2 years ago

davemlz commented 2 years ago

Solve this: https://github.com/davemlz/eemont/issues/42

KMarkert commented 2 years ago

A nice way to solve this would be to include a decorator function that we can decorate functions to keeps attributes from processed imagery. As noted when doing some user defined function on ee.Image or reductions, the properties can be lost which is not very transparent to users and can be frustrating.

There is something similar implement here that keeps all the metadata from images input into mapped functions and another decorator defined for attributes on reductions.

The use internally for converted functions can be something like the following:

@ee_extra.keep_attrs
def external_function(img):
   # do process
   return result

Thoughts?