This class implements the common features of objects that make
up Zarr. This class is the ancestor of zarr_node and thus the
zarr_group and zarr_array classes. This class manages common features
such as names and attribute management. This class may also be used by
other descendant classes that need a name and attributes (such as the
coordinate system classes in package geozarr).
The main function of this class is to manage attributes of a Zarr object.
Groups and arrays can have attributes, but other object descending from
this class may have attributes as well. In order to accommodate the various
applications, all methods dealing with attributes take a list object with
the attributes as the first argument - the class has no private or public
field to hold the attributes.
This class should never have to be instantiated or accessed directly.
Instead, use instances of zarr_group or zarr_array. Function arguments
are largely not checked, the group and array instances should do so prior
to calling methods here. The big exception is checking the validity of node
names.
Methods
zarr_object$print_attributes()
Print attributes to the console. Usually called by the
zarr_group and zarr_array print() methods.
zarr_object$attribute()
Retrieve a specific attribute by path.
zarr_object$set_attribute()
Add an attribute to the metadata of the object. If an
attribute name already exists, it will be overwritten.
Arguments
attsThe
listobject with the attributes.nameThe name of the attribute. The name may be a compound path, relative to the "attributes" entry in the metadata, using a slash "/" as path separator. Each of the elements in the path (between slashes) must begin with a letter and be composed of letters, digits, and underscores and can be at most 255 characters long. Missing path elements will be created.
valueThe value of the attribute. This can be of any supported type, including a vector or list of values. In general, an attribute should be a character value, a numeric value, a logical value, or a short vector or list of any of these.
zarr_object$append_array_attribute()
Append an attribute to an array in the metadata of the
object. If an attribute name already exists, it will be overwritten.
Arguments
attsThe
listobject with the attributes.nameThe name of the attribute. The name may be a compound path, relative to the "attributes" entry in the metadata, using a slash "/" as path separator. Each of the elements in the path (between slashes) must begin with a letter and be composed of letters, digits, and underscores and can be at most 255 characters long. Missing path elements will be created.
valueThe value of the attribute. This can be of any supported type, including a vector or list of values. In general, an attribute should be a character value, a numeric value, a logical value, or a short vector or list of any of these.
afterA subscript, after which
valueis to be appended. The default isNULL, meaning thatvaluewill be placed after the existing values. Specifyingafter = 0Lwill placevaluebefore the existing values.
zarr_object$delete_attribute()
Delete an attribute or array element. If the attribute is not present, this method simply returns.
Arguments
attsThe
listobject with the attributes.nameCharacter. The name (path) of the attribute to delete, using
/as separator for nested attributes, e.g."first/second/my_att". Thenameis relative to theattributesentry in the metadata of the node. To target an element of a JSON array attribute, append the 1-based index as the path segment, e.g."first/second/my_arr/2"to delete the second element in the array, or"first/second/my_arr/2/description"to delete only thedescriptionfield inside it. This nesting can be arbitrarily deep, including over multiple JSON arrays.