Skip to content

TypeError: Unrecognized STAC collection type <class 'pystac.item_collection.ItemCollection'> #124

Closed
@cOsprey

Description

@cOsprey

I am trying to use stackstac ( Windows, virtual environment) but getting this error. Also I tried using in google colab but when I do pip install stackstac,older version 0.1.1 is installed.
Error on windows:

TypeError                                 Traceback (most recent call last)
File <timed exec>:1, in <module>

File C:\ProgramData\Anaconda3\envs\a2\lib\site-packages\stackstac\stack.py:278, in stack(items, assets, epsg, resolution, bounds, bounds_latlon, snap_bounds, resampling, chunksize, dtype, fill_value, rescale, sortby_date, xy_coords, properties, band_coords, gdal_env, errors_as_nodata, reader)
     20 def stack(
     21     items: Union[ItemCollectionIsh, ItemIsh],
     22     assets: Optional[Union[List[str], AbstractSet[str]]] = frozenset(
   (...)
     43     reader: Type[Reader] = AutoParallelRioReader,
     44 ) -> xr.DataArray:
     45     """
     46     Create an `xarray.DataArray` of all the STAC items, reprojected to the same grid and stacked by time.
     47 
   (...)
    276         automatically computed from the items you pass in.
    277     """
--> 278     plain_items = items_to_plain(items)
    280     if sortby_date is not False:
    281         plain_items = sorted(
    282             plain_items,
    283             key=lambda item: item["properties"].get("datetime", "") or "",
    284             reverse=sortby_date == "desc",
    285         )

File C:\ProgramData\Anaconda3\envs\a2\lib\site-packages\stackstac\stac_types.py:163, in items_to_plain(items)
    160 if isinstance(items, PystacItemCollection):
    161     return [item.to_dict() for item in items]
--> 163 raise TypeError(f"Unrecognized STAC collection type {type(items)}: {items!r}")

TypeError: Unrecognized STAC collection type <class 'pystac.item_collection.ItemCollection'>: <pystac.item_collection.ItemCollection object at 0x0000028DF16140D0>`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions