gee-community / geetools

A collection of tools to work with Google Earth Engine Python API
https://geetools.readthedocs.io/en/stable/
MIT License
508 stars 121 forks source link

Bulk Export ImageCollection not working #261

Open noejn2 opened 5 months ago

noejn2 commented 5 months ago

I am running the script gee/exporting_images_from_gee/export_image_collection.ipynb and getting the following error, which I don't seem to understand. I get the attributes as specify there, and despite that it tells me such attribute is there, I can't make this code work.

`--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[170], line 27 22 collection = (ee.ImageCollection('COPERNICUS/S2_SR') 23 .filterDate('2022-01-01', '2022-03-01') 24 .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 5)) 25 .filterBounds(roi)) 26 # Export the ImageCollection ---> 27 tasks = geetools.batch.Export.imagecollection.toDrive( 28 collection=collection, 29 folder='gee_images', 30 region=roi.getInfo()['coordinates'], 31 namePattern='{id}', 32 scale=300, 33 dataType='uint32', 34 verbose=True, 35 maxPixels=int(1e13) 36 )

File /usr/local/anaconda3/envs/ee-work/lib/python3.10/site-packages/geetools/batch/imagecollection.py:61, in toDrive(collection, folder, namePattern, scale, dataType, region, datePattern, extra, verbose, **kwargs) 59 # get region 60 if region: ---> 61 region = tools.geometry.getRegion(region) 63 # Make a list of images 64 img_list = collection.toList(collection.size())

File /usr/local/anaconda3/envs/ee-work/lib/python3.10/site-packages/deprecated/classic.py:285, in deprecated..wrapperfunction(wrapped, instance, args, kwargs_) 283 else: 284 warnings.warn(msg, category=category, stacklevel=routinestacklevel) --> 285 return wrapped(*args, **kwargs_)

File /usr/local/anaconda3/envs/ee-work/lib/python3.10/site-packages/geetools/tools/_deprecated_geometry.py:14, in getRegion(eeobject, bounds, error) 11 @deprecated(version="1.0.0", reason="Use ee.ComputedObject.geometry() instead") 12 def getRegion(eeobject, bounds=False, error=1): 13 """Gets the region of a given geometry to use in exporting tasks.""" ---> 14 return eeobject.geometry()

AttributeError: 'list' object has no attribute 'geometry'`

12rambau commented 5 months ago

This script is not compatible with version 1.0 of the lib as exportation has not been refactored yet. Could you try using 0.6.14 ? Alternatively can you look at my answer in #256 ?