my_item = eds.search(
collections=["my-collection"],
ids=[my_item_id],
limit=1 # Since we're searching for a specific item
)
assert type(my_item) == pystac.item_collection.ItemCollection
File ~/earthdaily-python-client/earthdaily/earthdatastore/cube_utils/__init__.py:212, in datacube(items_collection, bbox, intersects, assets, engine, rescale, groupby_date, common_band_names, cross_calibration_items, properties, **kwargs)
210 if common_band_names and not isinstance(assets, dict):
211 aM = AssetMapper()
--> 212 assets = aM.map_collection_assets(items_collection[0].collection_id, assets)
213 if isinstance(assets, dict):
214 assets_keys = list(assets.keys())
AttributeError: 'ItemCollection' object has no attribute 'collection_id'
Resolved by
mask_datacube = earthdaily.earthdatastore.datacube(
[my_item.items[0]], # creates a list of pystac.item.Item
intersects=gdf,
assets=["cloud-mask"],
resolution=RESOLUTION,
crs="EPSG:3857",
).load()
Proposal: if an ItemCollection is received, it is automatically converted to a list of items
Alternative: catch the AttributeError and raise an instructive warning?
This is really user error, so the question is how much we support misuse
I make a query:
When creating a datacube:
An exception is raised:
Resolved by
Proposal: if an ItemCollection is received, it is automatically converted to a list of items Alternative: catch the AttributeError and raise an instructive warning?
This is really user error, so the question is how much we support misuse