Interface

SpaceDataModel.jl provides a set of abstractions and generic functions that can be extended by users to create custom implementations. This page documents these interfaces and provides examples of how to use them.

References

  • DataAPI.jl: A data-focused namespace for packages to share functions

Metadata

The package exports the following functions for metadata handling:

  • getmeta: Get metadata for an object
  • setmeta: Update metadata for an object
  • setmeta!: Update metadata for an object in-place

These functions are generic and can be extended to support custom data types.

SpaceDataModel.getmetaFunction
getmeta(x)

Get metadata for object x. If x does not have metadata, return NoMetadata().

source
getmeta(x, key, default=nothing)

Get metadata value associated with key for object x, or default if key is not present.

source
SpaceDataModel.setmetaFunction
setmeta(x, key => value, ...; symbolkey => value2, ...)
setmeta(x, dict::AbstractDict)

Update metadata for object x for key key to have value value and return x.

source
SpaceDataModel.setmeta!Function
setmeta!(x, key => value, ...; symbolkey => value2, ...)
setmeta!(x, dict::AbstractDict)

Update metadata for object x in-place and return x. The metadata container must be mutable.

The arguments could be multiple key-value pairs or a dictionary of metadata; keyword arguments are also accepted.

Examples

setmeta!(x, :units => "m/s", :source => "sensor")
setmeta!(x, Dict(:units => "m/s", :quality => "good"))
setmeta!(x; units="m/s", calibrated=true)

Throws an error if the metadata is not mutable. Use setmeta for immutable metadata.

source