-
Notifications
You must be signed in to change notification settings - Fork 20
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
Preserve accessories #170
Preserve accessories #170
Conversation
🚀 Deployed on https://f6d43600145741f0--odc-stac-docs.netlify.app |
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 good to me! I'm happy to approve, but I think we should wait for Kirill before we merge.
7856c5e
to
679e34e
Compare
@Kirill888 could you please review |
odc/stac/_mdtools.py
Outdated
@@ -681,6 +682,9 @@ def _get_grid(grid_name: str, asset: pystac.asset.Asset) -> GeoBox: | |||
asset = _assets.get(asset_name) | |||
if asset is None: | |||
continue | |||
# the assets that aren't bands should be accessories | |||
if asset_name in _acc_names: | |||
_acc_names.remove(asset_name) |
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.
Why start full then remove?
Let's start empty and add as we go instead
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.
Well I can't think of a better way of determining which assets are accessories other than by discounting the ones we know to be bands. Instead of _acc_names
I could define a list of band_names
and then do a set difference, but I don't think that's a cleaner solution than the current one.
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.
remove
isO(n)
, repeated in aO(n)
loop, so this isO(n^2)
operation after this change
I'd rather this was a set operation, this also makes it easier to read to me, as it would be a single line that fully defines what _acc_names
is, rather than currently where you start with "all asset names" then need to search code below to understand that this then becomes "all asset names except for data assets". Also if asset_name in _acc_names:
will always be true in this logic.
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.
That's fair; updated.
Thanks for this @Ariana-B |
See #168
Assume that any assets that are not bands are accessories, and make sure they are captured in the Dataset metadata doc