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
Use asset keys as canonical band names #77
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #77 +/- ##
===========================================
+ Coverage 88.37% 88.55% +0.17%
===========================================
Files 19 19
Lines 1652 1660 +8
===========================================
+ Hits 1460 1470 +10
+ Misses 192 190 -2
Continue to review full report at Codecov.
|
return {} | ||
if eo.bands is None: | ||
continue | ||
if len(eo.bands) != 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm starting to think that we should probably record all name|common_name -> asset_name, idx
and only warn on use when ambiguously named band is requested for loading. Extension seems to encourage using the same common name in particular, so these warnings will get annoying really quick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, asset_key+band_index
seems like the right way to make a "band pointer."
for key, asset in item.assets.items(): | ||
try: | ||
eo = EOExtension.ext(asset) | ||
except pystac.errors.ExtensionNotImplemented: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm, this exception will only happen is entire item has not EO so early exit is fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, since there is no such thing as asset-level extensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the only thing guaranteed to be a unique identifier for a band is asset name, so let's use that and treat eo:band:name as an alias. Let's merge and release this fix, and think about multi-band support later.
Just making sure, you mean "key in the |
yes |
related: #74 |
Overview
This PR fixes how
odc-stac
uses the Electro-Optical STAC extension to generate band aliases. Specifically:eo:bands -> name
eo:bands -> common_name
andeo:bands -> name
are both used as aliases back to asset keysThis enables support for the common STAC pattern of "one band per asset".
Background
Initially raised in Element84/geo-notebooks#8. USGS has changed the structure of their STAC items such that
eo:band -> name
does not match the asset key (example item here). Instead,eo:band -> common_name
is the asset key.More generally,
odc-stac
was incorrectly readingeo:bands
information from theItem
instead of from theAssets
. From the EO extension:This PR fixes
odc-stac
to read band information from each asset.Details
name
orcommon_name
matches the asset key, it is not added to the aliases.