You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# TODO: "CollectionMetadata" is also used as "cube metadata" where the link to original collection
# might be lost (if any). Better separation between rich EO raster collection metadata and
# essential cube metadata? E.g.: also thing of vector cubes.
"CollectionMetadata" got its name when data cubes where still called "ImageCollection" (instead of "DataCube"). But now that is getting a bit confusing: in openEO, "collections" is the source data one loads with load_collection, while "cubes" are the intermediate data structure one works with. So "CollectionMetadata" should better be called "CubeMetadata".
Also, CollectionMetadata contains some specific dimension metadata parsing logic (cube:dimensions/eo:bands), which is closely tied to the STAC description of collections. I think it would be better to separate this from the essential cube metadata logic.
CubeMetadata: just the bare metadata essentials for a data cube: interface to interact with the cube dimensions and their labels (if available), maybe some resolution info too. Methods allow to construct a new CubeMetadata instance from an existing one (e.g. reduce_dimension eliminates a dimension)
CollectionMetadata (subclass of CubeMetadata): interface to interact with all original collection (STAC) metadata. Calling a "process" like reduce_dimension produces a CubeMetadata
By making CollectionMetadata a subclass of CubeMetadata we can stay backward compatible I think, because the interface of CollectionMetadata would not really change
Currently functionality does not change due to this function.
As this function checks the type and returns an object of the same class, functions like reduce_dimension (who use this function to update a metadata object) will still return a CollectionMetadata object if that was the original object.
Changing this to return a CubeMetadata changes functionality and fails some existing tests.
An alternative is to provide an optional argument to set the expected returned class, however this feels more like a quick fix and might be confusing in the future.
Activity
soxofaan commentedon Aug 24, 2023
I think we should change it to:
CubeMetadata: just the bare metadata essentials for a data cube: interface to interact with the cube dimensions and their labels (if available), maybe some resolution info too. Methods allow to construct a newCubeMetadatainstance from an existing one (e.g.reduce_dimensioneliminates a dimension)CollectionMetadata(subclass ofCubeMetadata): interface to interact with all original collection (STAC) metadata. Calling a "process" likereduce_dimensionproduces aCubeMetadataBy making
CollectionMetadataa subclass ofCubeMetadatawe can stay backward compatible I think, because the interface ofCollectionMetadatawould not really changejdries commentedon Aug 24, 2023
ok, makes sense!
soxofaan commentedon Oct 27, 2023
Another reason for better abstraction:
load_stacshould produce a data cube with metadata (#425) , but that is not the same as collection metadata.created CubeMetadata class
VictorVerhaert commentedon Feb 23, 2024
openeo-python-client/openeo/metadata.py
Lines 231 to 242 in 498c4c7
Currently functionality does not change due to this function.
As this function checks the type and returns an object of the same class, functions like
reduce_dimension(who use this function to update a metadata object) will still return a CollectionMetadata object if that was the original object.Changing this to return a CubeMetadata changes functionality and fails some existing tests.
An alternative is to provide an optional argument to set the expected returned class, however this feels more like a quick fix and might be confusing in the future.
issue #464 added tests for CubeMetadata
issue #464 added chanhelog entry
Issue #464 Introduce CubeMetadata
Harden some CollectionMetadata/CubeMetadata usage
Harden some CollectionMetadata/CubeMetadata usage