This class implements a Zarr group. A Zarr group is a node in the hierarchy of a Zarr object. A group is a container for other groups and arrays.
A Zarr group is identified by a JSON file having required metadata,
specifically the attribute "node_type": "group".
Super class
zarr::zarr_node -> zarr_group
Active bindings
children(read-only) The children of the group. This is a list of
zarr_groupandzarr_arrayinstances, or the empty list if the group has no children.groups(read-only) Retrieve the paths to the sub-groups of the hierarchy starting from the current group, as a character vector.
arrays(read-only) Retrieve the paths to the arrays of the hierarchy starting from the current group, as a character vector.
Methods
Method new()
Open a group in a Zarr hierarchy. The group must already exist in the store.
Usage
zarr_group$new(name, metadata, parent, store)Arguments
nameThe name of the group. For a root group, this is the empty string
"".metadataList with the metadata of the group.
parentThe parent
zarr_groupinstance of this new group, can be missing orNULLfor the root group.storeThe zarr_store instance to persist data in.
Method hierarchy()
Prints the hierarchy of the group and its subgroups and arrays to the console. Usually called from the Zarr object or its root group to display the full group hierarchy.
Method build_hierarchy()
Return the hierarchy contained in the store as a tree of
group and array nodes. This method only has to be called after opening
an existing Zarr store - this is done automatically by user-facing
code. After that, users can access the children property of this
class.
Method get_node()
Retrieve the group or array represented by the node located at the path relative from the current group.
Arguments
pathThe path to the node to retrieve. The path is relative to the group, it must not start with a slash "/". The path may start with any number of double dots ".." separated by slashes "/" to denote groups higher up in the hierarchy.
Returns
The zarr_group or zarr_array instance located at path, or
NULL if the path was not found.
Method count_arrays()
Count the number of arrays in this group, optionally including arrays in sub-groups.
Method add_array()
Add an array to the Zarr hierarchy in the current group.
Arguments
nameThe name of the new array.
metadataA
listwith the metadata for the new array, or an instance of class array_builder whose data make a valid array definition.
Method delete()
Delete a group or an array contained by this group. When deleting a group it cannot contain other groups or arrays. Warning: this operation is irreversible for many stores!