Skip to content

Add mid/high level interface for HDF5 Dimension Scale #1124

@fergu

Description

@fergu

Opening this as a stub issue for adding a mid/high level interface to the Dimension Scale functions. I meant to do this a while back when the low level library calls were added, but I never got around to it. See also #720. I will also add a short blurb on what HDF5 dimension scales are useful for in a reply to this issue for anyone who is unfamiliar.

Here are some current ideas for things to implement. This is currently closer to a train of thought rather than anything set in stone, so I'd welcome feedback on how this could/should be changed:

High-level interface:

  • Add a subtype of the HDF5.Dataset type called HDF5.Scale for cases where a Dataset is a dimension scale. This seems like the easiest way to add this functionality to the existing interface without breaking changes, but I'm open to suggestions.
  • Add checks for existing dimension scales during reading of an HDF5.Dataset and returning them alongside the dataset. Alternatively, add a function to check if a dataset has scales (HDF5.has_scales or HDF5.dimensions_with_scales?) and read the scale given a dataset, a la HDF5.read_dimension_scale( ds::HDF5.Dataset, dim::Integer)
  • Add a method to write dimension scales using the Dictionary interface as well as the existing write_dataset calls.

Mid-level implementations of low level library calls:

  • Add HDF5.is_scale(), which should return true if a supplied HDF5.Dataset (or HDF5.Scale) is a dimension scale
  • Add HDF5.attach_scale() and HDF5.detach_scale() to attach/detach a dimension scale from a supplied HDF5.Dataset
  • Add HDF5.set_label() and HDF5.get_label() to assign a label to a dimension scale. This might be ambiguous without the HDF5.Scale datatype though, so it might be best to exclude this if HDF5.Scale also isn't a good idea.
  • Add HDF5.set_scale() to convert an existing HDF5.Dataset to a dimension scale. Interestingly, there does not appear to be a corresponding unset_scale library call, though it seems like the only thing that makes a dataset a scale is the attributes, so HDF5.unset_scale() might just need to delete those attributes.
  • Add HDF5.get_num_scales() to return the number of scales attached to a given HDF5.Dataset
  • Add HDF5.dimensions_with_scales() to return a Vector{Integer} of dimensions with attached scales
  • Add HDF5.get_scale_name() to return the name (label) attached to a scale, if there is one
  • Add HDF5.is_attached() to return true if a supplied HDF5.Dataset (or HDF5.Scale) is attached to a dataset as a scale.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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