Skip to content

merge_cubes: merge metadata even without band_dimensions #783

Description

@VictorVerhaert

related code:

if (
self.metadata
and self.metadata.has_band_dimension()
and isinstance(other, DataCube)
and other.metadata
and other.metadata.has_band_dimension()
):
# Minimal client side metadata merging
merged_metadata = self.metadata
for b in other.metadata.band_dimension.bands:
if b not in merged_metadata.bands:
merged_metadata = merged_metadata.append_band(b)
else:
merged_metadata = None
# Overlapping bands without overlap resolver will give an error in the backend

Currently if one or both of the cubes have missing band data the resulting metadata is set to None.
Suggested approaches:

  1. cube1 has bands and cube2 has bands -> current implementation
  2. cube1 has bands but cube2 has no bands -> take over bands of cube1 (cube2 will be merged with overlap on all bands)
  3. cube1 has no bands but cube 2 has bands -> See step 2 I think
  4. both have no bands -> use metadata from first cube

If one of both cubes has none as metadata I think it is still safer to put the result to none as well

In a better scenario the extents of all dimensions are merged but that might be the scope of a separate issue rather than include it in this one.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions