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

AttributeError when running dc.load command (ESA WorldCover Classification Notebook) #3

Open
max-poltora opened this issue Jul 20, 2023 · 1 comment

Comments

@max-poltora
Copy link

Recently I have been facing a problem when running the snippet of code below in Google Colab. The code uses the Datacube module from odc_gee package.

!wget -nc https://raw.githubusercontent.com/ceos-seo/odc-colab/master/odc_colab.py
from odc_colab import odc_colab_init
odc_colab_init(install_odc_gee=True)

from odc_colab import populate_db
populate_db()

from odc_gee.earthengine import Datacube
dc = Datacube(app='ESA_WorldCover')

product = 'esa_worldcover_google'

# Kumasi, Ghana 
lat_long = (6.7, -1.6)
box_size_deg = 0.50

# Calculates the latitude and longitude bounds of the analysis box
latitude = (lat_long[0]-box_size_deg/2, lat_long[0]+box_size_deg/2)
longitude = (lat_long[1]-box_size_deg/2, lat_long[1]+box_size_deg/2)

dataset = dc.load(product=product,time=time,latitude=latitude,longitude=longitude)

After installing required packages, modules and successful authorization at Earth Engine, I run into the following error message after executing las line of code:

/usr/local/lib/python3.10/dist-packages/datacube/utils/geometry/_base.py:519: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
return self.geom.type

AttributeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 dataset = dc.load(product=product,time=time,latitude=latitude,longitude=longitude)

5 frames
/usr/local/lib/python3.10/dist-packages/odc_gee/earthengine.py in load(self, datasets, **kwargs)
82 '''
83 datasets = datasets if datasets else self.find_datasets(**kwargs)
---> 84 return super().load(datasets=datasets, **kwargs)
85
86 def _refresh_credentials(self, stop_event):

/usr/local/lib/python3.10/dist-packages/datacube/api/core.py in load(self, product, measurements, output_crs, resolution, resampling, skip_broken_datasets, dask_chunks, like, fuse_func, align, datasets, progress_cbk, **query)
292 datasets = self.find_datasets(product=product, like=like, ensure_location=True, **query)
293 elif isinstance(datasets, collections.abc.Iterator):
--> 294 datasets = list(datasets)
295
296 if len(datasets) == 0:

/usr/local/lib/python3.10/dist-packages/odc_gee/earthengine.py in find_datasets(self, limit, **search_terms)
119 if hasattr(query, 'asset'):
120 images = self.get_images(self.build_parameters(query))
--> 121 for document in generate_documents(query.asset, images, query.product):
122 if limit != 0:
123 limit = limit - 1 if limit is not None else limit

/usr/local/lib/python3.10/dist-packages/odc_gee/earthengine.py in generate_documents(asset, images, product)
295 from datacube.index.hl import prep_eo3
296 from odc_gee.indexing import make_metadata_doc
--> 297 for image in images:
298 yield prep_eo3(make_metadata_doc(asset, image, product))
299

/usr/local/lib/python3.10/dist-packages/odc_gee/earthengine.py in get_images(self, parameters)
158 yield response
159 except Exception as error:
--> 160 raise error
161
162 def build_parameters(self, query):

/usr/local/lib/python3.10/dist-packages/odc_gee/earthengine.py in get_images(self, parameters)
140 '''
141 try:
--> 142 request = self.ee.data._get_cloud_api_resource().projects().assets().listImages(
143 **parameters)
144 while request is not None:

AttributeError: module 'ee.data' has no attribute '_get_cloud_api_resource'

What could be the problem?

@ceos-seo
Copy link
Owner

Thank you for the error report (and for including the traceback). The problem isn't on your end, it's a change in the EarthEngine API. We're aware of the issue and are working on updates to address these breaking changes.

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