Skip to content

Read band metadata from item-asset extension in STAC collection if possible #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

VincentVerelst
Copy link
Collaborator

Updated metadata_from_stac such that if the item-asset extension is present in a STAC collection, the client reads the band metadata from there instead of looping over all the assets.

@VincentVerelst VincentVerelst requested a review from soxofaan April 17, 2024 08:09
Copy link
Member

@soxofaan soxofaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to provide some unit tests about this.
It's a bit hard to review this without some more concrete examples

@@ -546,32 +546,47 @@ def get_band_names(bands: List[Band]) -> List[str]:
def is_band_asset(asset: pystac.Asset) -> bool:
return "eo:bands" in asset.extra_fields

def bands_from_collection(collection: pystac.Collection) -> List[Band]:
# First check if the item_asset extension is present, if so, we can use that to get the band metadata
if pystac.extensions.item_assets.ItemAssetsExtension.has_extension(collection):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work? pystac.extensions.item_assets is not imported yet I think

@soxofaan
Copy link
Member

Support for item-assets was also introduced by PR #577 so this one can be closed

@soxofaan soxofaan closed this Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants