Skip to content

Using tuple Bounding Box in Query fails on order #698

@trey-stafford

Description

@trey-stafford

Using a tuple instead of a list for a bounding box with ipx.Query results in a failure at order-time:

import datetime as dt

import icepyx as ipx


BBOX = (
    -49.149,
    69.186,
    -48.949,
    69.238,
)

DATE_RANGE = (dt.date(2007, 1, 1), dt.date(2024, 10, 28))

result = ipx.Query(
    "ATL06",
    BBOX,
    DATE_RANGE,
)

result.order_granules(subset=True)
Traceback (most recent call last):
  File "/home/trst2284/code/valkyrie-lib/scratch.py", line 21, in <module>
    result.order_granules(subset=True)
  File "/home/trst2284/miniconda3/envs/iceflow-dev/lib/python3.12/site-packages/icepyx/core/query.py", line 994, in order_granules
    job_id = self._order_subset_granules(skip_preview=skip_preview)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/trst2284/miniconda3/envs/iceflow-dev/lib/python3.12/site-packages/icepyx/core/query.py", line 852, in _order_subset_granules
    readable_granule_name = self.CMRparams.get("readable_granule_name[]", [])
                            ^^^^^^^^^^^^^^
  File "/home/trst2284/miniconda3/envs/iceflow-dev/lib/python3.12/site-packages/icepyx/core/query.py", line 521, in CMRparams
    extent_type=self._spatial._ext_type,
                ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Spatial' object has no attribute '_ext_type'

Converting the BBOX to list works as expected. The need to do this is not clear from the error output.

It looks like the Query class requires that the spatial extent be either a list or a string. This is clearly documented in the Spatial class docstring. However, I think it would be best to have an else condition for the spatial extent, so that a more informative error message is raised at Query instantiation, and not later when the user tries to order data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions