Skip to content

Convert Cube -> "component", and vice versa #6826

Description

@ukmo-ccbunney

A component in this context is any named cube part that is a DimensionalMetadata object, e.g. coord, coord_system, cell_measure, etc.

Converting components of a cube into cube objects (and vice versa) will facilitate the insertion of CF variables that were captured as "unloadable netCDF objects" into an existing cube (e.g. inserting a coord that failed to load correctly)

See for context: #6320 (comment)

A few considerations:

  • The biggest issue is that there is the potential to lose information when converting from a component to a cube. E.g. when converting a coord to a cube, the original dimension(s) the coord mapped onto in the cube are lost. Similarly, any associated coordinate system is lost.
    • We could possibly retain this information by adding them as special "internal" attributes on the cube (see proposal in Namespaced "internal" attributes #6572). We would need to check that the merge code can deal ok with complex objects as attributes (should be ok - they are hashed for comparison operations)
    • Alternatively, operations that need to re-insert a component extracted from a cube will need access to the original cube to determine lost metadata.
  • Should we have a separate metadata object to store the original component's metadata? This would need careful synchronisation with the cube's metadata in case common fields are changed (such as standard_name).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    No status
    Status
    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions