stac-utils / pystac

Python library for working with any SpatioTemporal Asset Catalog (STAC)
https://pystac.readthedocs.io
Other
355 stars 116 forks source link

Regression: Adjusting Assets does not have an effect #1209

Closed constantinius closed 1 year ago

constantinius commented 1 year ago

In the stactools-datacube package we extend an Item like this:

    asset = item.get_assets()[asset_name]
    datacube = extend_asset(item, asset, rtol)

This used to work, but with pystac==1.8.3 this results in an empty asset. When explicitly re-adding the asset it works again:

    asset = item.get_assets()[asset_name]
    datacube = extend_asset(item, asset)
    item.add_asset(asset_name, asset)

Is it now required to re-add the asset to the item to trigger the update?

gadomski commented 1 year ago

I'd access the assets dictionary directly if you want to modify it:

asset = item.assets[asset_name]

The behavior of get_assets was intentionally changed in https://github.com/stac-utils/pystac/pull/1087.

constantinius commented 1 year ago

Thanks @gadomski, will fix this in stactools-datacube