Respect STAC cube:dimensions as source of truth in metadata_from_stac + align tests with dimension policy#867
Open
suriyahgit wants to merge 4 commits intoOpen-EO:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
metadata_from_stac()previously injected openEO default dimensions (x,y,t,bands) even when a STAC object already defined dimensions viacube:dimensions.This led to:
Fix
Introduce a clear dimension resolution policy:
If
cube:dimensionsis present→ treat it as the source of truth and preserve dimension names and order.
If
cube:dimensionsis absent→ fall back to openEO defaults (
x,y, optionalt).The metadata parsing logic was refactored accordingly and aligned with PySTAC datacube capabilities.
Testing
Updated existing tests to no longer assume an always-present band dimension.
Added checks verifying:
cube:dimensionsis missing,cube:dimensionsexists,Tests now explicitly enforce the new dimension policy to prevent regressions.
This change makes metadata parsing more STAC-compliant while keeping backward-compatible fallback behavior.
Refer:
https://github.com/destine-datalake-cube/dedl-openeo-coordination/issues/3
Also solves: #743