Attributes

Dictionary interface

HDF5.attrsFunction
attrs(object::Union{File,Group,Dataset,Datatype})

The attributes dictionary of object. Returns an AttributeDict, a Dict-like object for accessing the attributes of object.

attrs(object)["name"] = value  # create/overwrite an attribute
attr = attrs(object)["name"]   # read an attribute
delete!(attrs(object), "name") # delete an attribute
keys(attrs(object))            # list the attribute names
source
HDF5.attributesFunction
attributes(object::Union{File,Object})

The attributes of a file or object: this returns an Attributes object, which is Dict-like object for accessing the attributes of object: getindex will return an Attribute object, and setindex! will call write_attribute.

source

Mid-level Interface

HDF5.create_attributeFunction
create_attribute(
    parent::Union{File,Object},
    name::AbstractString,
    dtype::Union{Datatype, Type},
    dspace::Union{Dataspace, Dims, Nothing}
)

Create a new Attribute object named name on the object parent, with the corresponding Datatype and Dataspace.

source
create_attribute(
    parent::Union{File,Object},
    name::AbstractString,
    data
) -> Attribute, Datatype

Create a new Attribute object named name on the object parent for the object data, returning both the Attribute and the Datatype.

Note that no data will be written: use write_attribute to write the data.

source
HDF5.read_attributeFunction
read_attribute(parent::Union{File,Group,Dataset,Datatype}, name::AbstractString)

Read the value of the named attribute on the parent object.

Example

julia> HDF5.read_attribute(g, "time")
2.45
source
HDF5.rename_attributeFunction
rename_attribute(parent::Union{File,Object}, oldname::AbstractString, newname::AbstractString)

Rename the Attribute of the object parent named oldname to newname.

source

Convenience interface

HDF5.h5readattrFunction
h5readattr(filename, name::AbstractString)

Read the attributes of the object at name in the HDF5 file filename, returning a Dict.

source
HDF5.h5writeattrFunction
h5writeattr(filename, name::AbstractString, data::Dict)

Write data as attributes to the object at name in the HDF5 file filename.

source