Skip to content

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
Eurac-Research-Institute-for-EO:dim_policy
Open

Respect STAC cube:dimensions as source of truth in metadata_from_stac + align tests with dimension policy#867
suriyahgit wants to merge 4 commits intoOpen-EO:masterfrom
Eurac-Research-Institute-for-EO:dim_policy

Conversation

@suriyahgit
Copy link
Member

Problem

metadata_from_stac() previously injected openEO default dimensions (x, y, t, bands) even when a STAC object already defined dimensions via cube:dimensions.

This led to:

  • dimension names being overridden or altered,
  • inconsistencies between STAC metadata and openEO metadata,
  • tests relying on implicit default behavior instead of STAC semantics.

Fix

Introduce a clear dimension resolution policy:

  • If cube:dimensions is present
    → treat it as the source of truth and preserve dimension names and order.

  • If cube:dimensions is absent
    → fall back to openEO defaults (x, y, optional t).

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:

    • fallback behavior when cube:dimensions is missing,
    • preservation of dimension names when cube:dimensions exists,
    • correct temporal dimension handling across STAC object types.
  • 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

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.

1 participant