Skip to content

Preserve metadata when merging cubes without bands#912

Open
Silvren wants to merge 1 commit into
Open-EO:masterfrom
Silvren:agent/merge-cubes-band-metadata
Open

Preserve metadata when merging cubes without bands#912
Silvren wants to merge 1 commit into
Open-EO:masterfrom
Silvren:agent/merge-cubes-band-metadata

Conversation

@Silvren

@Silvren Silvren commented Jul 13, 2026

Copy link
Copy Markdown

Summary

  • preserve cube metadata when merge_cubes receives cubes without band dimensions
  • retain the available band metadata when only one input cube has a band dimension
  • keep the existing band-union behavior when both cubes have band dimensions
  • keep metadata unknown when either input has no metadata

Testing

  • python -m pytest tests/rest/datacube/test_datacube100.py -q (347 passed, 2 skipped)
  • pre-commit run --files CHANGELOG.md openeo/rest/datacube.py tests/rest/datacube/test_datacube100.py

Fixes #783

@Silvren
Silvren force-pushed the agent/merge-cubes-band-metadata branch from 1bad7f5 to 6afdced Compare July 13, 2026 14:14
Comment thread CHANGELOG.md

- Better error message when passing a bounding box with field typos in `Connection.load_collection()` and alike ([#910](https://github.com/Open-EO/openeo-python-client/issues/910))

- Preserve available band metadata when merging data cubes if one cube has no band dimension. ([#783](https://github.com/Open-EO/openeo-python-client/issues/783))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

changelog has been bumped in meantime, this has to be moved

Comment thread openeo/rest/datacube.py
if b not in merged_metadata.bands:
merged_metadata = merged_metadata.append_band(b)
elif other.metadata.has_band_dimension():
merged_metadata = other.metadata

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's not ideal to use the other.metadata in full here, just to copy the band metadata

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.

merge_cubes: merge metadata even without band_dimensions

2 participants