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".
zarr::zarr_node -> zarr_group
children(read-only) The children of the group. This is a list of
zarr_group and zarr_array instances, 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.
new()Open a group in a Zarr hierarchy. The group must already exist in the store.
zarr_group$new(name, metadata, parent, store)nameThe name of the group. For a root group, this is the empty
string "".
metadataList with the metadata of the group.
parentThe parent zarr_group instance of this new group, can be
missing or NULL for the root group.
storeThe zarr_store instance to persist data in.
An instance of zarr_group.
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.
zarr_group$hierarchy(idx = 1L, total = 1L)idx, totalArguments to control indentation. Should both be 1 (the default) when called interactively. The values will be updated during recursion when there are groups below the current group.
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.
zarr_group$build_hierarchy()This zarr_group instance with all of its children linked.
get_node()Retrieve the group or array represented by the node located at the path relative from the current group.
zarr_group$get_node(path)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.
The zarr_group or zarr_array instance located at path, or
NULL if the path was not found.
count_arrays()Count the number of arrays in this group, optionally including arrays in sub-groups.
zarr_group$count_arrays(recursive = TRUE)recursiveLogical flag that indicates if arrays in sub-groups
should be included in the count. Default is TRUE.
add_group()Add a group to the Zarr hierarchy under the current group.
zarr_group$add_group(name)nameThe name of the new group.
The newly created zarr_group instance, or NULL if the group
could not be created.
add_array()Add an array to the Zarr hierarchy in the current group.
zarr_group$add_array(name, metadata)nameThe name of the new array.
metadataA list with the metadata for the new array, or an
instance of class array_builder whose data make a valid array
definition.
The newly created zarr_array instance, or NULL if the array
could not be created.
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!
zarr_group$delete(name)nameThe name of the group or array to delete. This will also accept a path to a group or array but the group or array must be a node directly under this group.
Self, invisibly.
delete_all()Delete all the groups and arrays contained by this group, including any sub-groups and arrays. Any specific metadata attached to this group is deleted as well - only a basic metadata document is maintained. Warning: this operation is irreversible for many stores!
zarr_group$delete_all()Self, invisibly.