Skip to content

Satellite abnimation app not working in unstable #1480

@cbur24

Description

@cbur24

Describe the bug/issue
Running the Generating_satellite_animations interactive notebook results in an AssertionError from datacube, most likely related to differences in how datacube handles geometry queries between ODC-1.8 and ODC-1.9

Steps to reproduce
Steps to reproduce the behaviour:

  1. Open unstable DEA Sandbox
  2. Launch the "Generating_satellite_animations.ipynb" notebook
  3. Run all cells, draw a polygon on the interactive map
  4. Hit "run animaton" button
AssertionError                            Traceback (most recent call last)
File /env/lib/python3.10/site-packages/dea_tools/app/animations.py:861, in animation_app.run_app(self, change)
    858 with self.status_info:
    859     # Load data and add to attribute
    860     if self.timeseries_ds is None:
--> 861         self.timeseries_ds = extract_data(self)
    863     else:
    864         print("Using previously loaded data")

File /env/lib/python3.10/site-packages/dea_tools/app/animations.py:165, in extract_data(self)
    159 self.query_params = {
    160     "time": (str(start_date), str(end_date)),
    161     "geopolygon": geopolygon,
    162 }
    164 # Find matching datasets
--> 165 dss = [dc.find_datasets(product=i, **self.query_params) for i in sat_params[self.dealayer]["products"]]
    166 dss = list(itertools.chain.from_iterable(dss))
    168 # If data is found

File /env/lib/python3.10/site-packages/dea_tools/app/animations.py:165, in <listcomp>(.0)
    159 self.query_params = {
    160     "time": (str(start_date), str(end_date)),
    161     "geopolygon": geopolygon,
    162 }
    164 # Find matching datasets
--> 165 dss = [dc.find_datasets(product=i, **self.query_params) for i in sat_params[self.dealayer]["products"]]
    166 dss = list(itertools.chain.from_iterable(dss))
    168 # If data is found

File /env/lib/python3.10/site-packages/datacube/api/core.py:628, in Datacube.find_datasets(self, ensure_location, dataset_predicate, like, limit, **search_terms)
    601 def find_datasets(
    602     self,
    603     ensure_location: bool = False,
   (...)
    607     **search_terms: QueryField,
    608 ) -> list[Dataset]:
    609     """
    610     Search the index and return all datasets for a product matching the search terms.
    611 
   (...)
    625     .. seealso:: :meth:`group_datasets` :meth:`load_data` :meth:`find_datasets_lazy`
    626     """
    627     return list(
--> 628         self.find_datasets_lazy(
    629             limit=limit,
    630             ensure_location=ensure_location,
    631             dataset_predicate=dataset_predicate,
    632             like=like,
    633             **search_terms,
    634         )
    635     )

File /env/lib/python3.10/site-packages/datacube/api/core.py:662, in Datacube.find_datasets_lazy(self, limit, ensure_location, dataset_predicate, like, **kwargs)
    637 def find_datasets_lazy(
    638     self,
    639     limit: int | None = None,
   (...)
    643     **kwargs: QueryField,
    644 ) -> Iterable[Dataset]:
    645     """
    646     Find datasets matching query.
    647 
   (...)
    660     .. seealso:: :meth:`group_datasets` :meth:`load_data` :meth:`find_datasets`
    661     """
--> 662     query = Query(self.index, like=like, **kwargs)  # type: ignore[arg-type]
    663     if not query.product:
    664         raise ValueError("must specify a product")

File /env/lib/python3.10/site-packages/datacube/api/query.py:125, in Query.__init__(self, index, product, geopolygon, like, **search_terms)
    123 self.index = index
    124 self.product = product
--> 125 self.geopolygon = extract_geom_from_query(geopolygon=geopolygon, **search_terms)
    126 if (
    127     "source_filter" in search_terms
    128     and search_terms["source_filter"] is not None
    129 ):
    130     self.source_filter: Query | None = Query(**search_terms["source_filter"])

File /env/lib/python3.10/site-packages/datacube/index/_spatial.py:55, in extract_geom_from_query(**q)
     51         if spatial_key in q:
     52             raise ValueError(
     53                 f"Cannot specify spatial key {spatial_key} AND geopolygon in the same query"
     54             )
---> 55     assert geom and geom.crs
     56 else:
     57     # Old lat/lon--style spatial query (or no spatial query)
     58     # TODO: latitude/longitude/x/y aliases for lat/lon
     59     #       Also some stuff is precalculated at the api.core.Datacube level.
     60     #       THAT needs to offload to index driver when it can.
     61     lon = lat = None

AssertionError: 

Environment information
AWS unstable

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions