Skip to contents

Instantiate an array from an initialized store.

Format

R6::R6Class

Details

The Zarr Array class.

Methods


Method new()

Create a new ZarrArray instance.

Usage

ZarrArray$new(
  store,
  path = NA,
  read_only = FALSE,
  chunk_store = NA,
  synchronizer = NA,
  cache_metadata = TRUE,
  cache_attrs = TRUE,
  write_empty_chunks = TRUE
)

Arguments

store

(Store)
Array store, already initialized.

path

(character(1))
Storage path.

read_only

(logical(1))
Whether the array is read-only.

chunk_store

(Store or NA)
Separate storage for chunks. If not provided, store will be used for both chunks and metadata.

synchronizer

(ANY or NA)
Object used to synchronize write access to the array.

cache_metadata

(logical(1))
Whether to cache metadata.

cache_attrs

(logical(1))
Whether to cache attributes.

write_empty_chunks

(logical(1))
Whether to write empty chunks.

Returns

A ZarrArray instance.


Method get_store()

get store from array.

Usage

ZarrArray$get_store()

Returns

Store.


Method get_path()

get array path

Usage

ZarrArray$get_path()

Returns

character(1) or NA.


Method get_name()

get full array name

Usage

ZarrArray$get_name()

Returns

character(1) or NA.


Method get_basename()

get the basename of an array

Usage

ZarrArray$get_basename()

Returns

character(1) or NA.


Method get_read_only()

get the read only property of an array (TRUE/FALSE)

Usage

ZarrArray$get_read_only()

Returns

logical(1).


Method set_read_only()

set the read only property of an array

Usage

ZarrArray$set_read_only(val)

Arguments

val

(logical(1))
Value to set.

Returns

NULL (called for side effects).


Method get_chunk_store()

get the chunk store for an array

Usage

ZarrArray$get_chunk_store()

Returns

Store.


Method get_shape()

get the shape of an array

Usage

ZarrArray$get_shape()

Returns

integer().


Method set_shape()

set or reset the size of an array

Usage

ZarrArray$set_shape(value)

Arguments

value

(integer())
Numeric size to set.

Returns

NULL (called for side effects).


Method resize()

Change the shape of the array by growing or shrinking one or more dimensions.

Usage

ZarrArray$resize(...)

Arguments

...

Arguments for do.call.

Returns

NULL (called for side effects).


Method get_chunks()

get the chunk metadata of an array

Usage

ZarrArray$get_chunks()

Returns

integer().


Method get_dtype()

get the Dtype of an array

Usage

ZarrArray$get_dtype()

Returns

Dtype.


Method get_compressor()

get the compressor of an array

Usage

ZarrArray$get_compressor()

Returns

Codec or NA.


Method get_fill_value()

get the fill value of an array

Usage

ZarrArray$get_fill_value()

Returns

Scalar fill value.


Method set_fill_value()

set the fill value of an array

Usage

ZarrArray$set_fill_value(val)

Arguments

val

Fill value to use.

Returns

NULL (called for side effects).


Method get_order()

get the storage order metadata of an array.

Usage

ZarrArray$get_order()

Returns

character(1), "C" or "F".


Method get_filters()

get the filters metadata of an array

Usage

ZarrArray$get_filters()

Returns

list() of Codec objects or NA.


Method get_synchronizer()

Get the synchronizer used to coordinate write access to the array.

Usage

ZarrArray$get_synchronizer()

Returns

Synchronizer object or NA.


Method get_attrs()

get attributes of array

Usage

ZarrArray$get_attrs()

Returns

Attributes.


Method get_ndim()

get number of dimensions of array

Usage

ZarrArray$get_ndim()

Returns

integer(1).


Method get_size()

Get the total number of elements in the array.

Usage

ZarrArray$get_size()

Returns

numeric(1).


Method get_itemsize()

Get the size in bytes of each item in the array.

Usage

ZarrArray$get_itemsize()

Returns

integer(1).


Method get_nbytes()

get number of bytes of an array

Usage

ZarrArray$get_nbytes()

Returns

numeric(1).


Method get_nbytes_stored()

Get the total number of stored bytes for the array, including metadata and compressed chunk data.

Usage

ZarrArray$get_nbytes_stored()

Returns

numeric(1).


Method get_cdata_shape()

Get the number of chunks along each dimension of the array.

Usage

ZarrArray$get_cdata_shape()

Returns

numeric().


Method get_nchunks()

Get the total number of chunks in the array.

Usage

ZarrArray$get_nchunks()

Returns

integer(1).


Method get_nchunks_initialized()

Get the number of chunks that have been initialized with data.

Usage

ZarrArray$get_nchunks_initialized()

Returns

integer(1).


Method get_is_view()

get is_view metadata of array

Usage

ZarrArray$get_is_view()

Returns

logical(1).


Method get_oindex()

get orthogonal index of array

Usage

ZarrArray$get_oindex()

Returns

OIndex.


Method get_vindex()

get vectorized index of array

Usage

ZarrArray$get_vindex()

Returns

VIndex.


Method get_write_empty_chunks()

get write empty chunks setting of array

Usage

ZarrArray$get_write_empty_chunks()

Returns

logical(1).


Method equals()

check if another object refers to the same array. does not check array data

Usage

ZarrArray$equals(other)

Arguments

other

Other object to check.

Returns

logical(1).


Method print()

Print a human-readable summary of the array.

Usage

ZarrArray$print(...)

Arguments

...

Ignored.

Returns

self (invisibly).


Method islice()

Iterate over the array or a range of it, yielding successive slices along the first dimension. Uses chunk caching for efficient sequential access.

Usage

ZarrArray$islice(start = NA, end = NA)

Arguments

start

Start index of the iteration range (1-based, inclusive).

end

End index of the iteration range (1-based, inclusive).

Returns

list() of NestedArray slices.


Method length()

Return the length of the first dimension. Raises an error for zero-dimensional arrays.

Usage

ZarrArray$length()

Returns

integer(1).


Method get_item()

Subset the array.

Usage

ZarrArray$get_item(selection)

Arguments

selection

Selection specifying the subset to retrieve.

Returns

NestedArray.


Method get_basic_selection()

Get a selection of an array based on a "basic" list of slices.

Usage

ZarrArray$get_basic_selection(selection = NA, out = NA, fields = NA)

Arguments

selection

Selection specifying the subset to retrieve.

out

Not yet implemented.

fields

Not yet implemented.

Returns

NestedArray.


Method get_orthogonal_selection()

Retrieve data using orthogonal (outer) indexing.

Usage

ZarrArray$get_orthogonal_selection(selection = NA, out = NA, fields = NA)

Arguments

selection

Selection specifying the subset to retrieve.

out

Not yet implemented.

fields

Not yet implemented.

Returns

NestedArray.


Method get_coordinate_selection()

Retrieve data using coordinate (point) indexing. Not yet implemented.

Usage

ZarrArray$get_coordinate_selection(selection = NA, out = NA, fields = NA)

Arguments

selection

Selection specifying the subset to retrieve.

out

Not yet implemented.

fields

Not yet implemented.

Returns

NestedArray.


Method get_mask_selection()

Retrieve data using a boolean mask. Not yet implemented.

Usage

ZarrArray$get_mask_selection(selection = NA, out = NA, fields = NA)

Arguments

selection

Selection specifying the subset to retrieve.

out

Not yet implemented.

fields

Not yet implemented.

Returns

NestedArray.


Method set_item()

Set a subset of the array.

Usage

ZarrArray$set_item(selection, value)

Arguments

selection

Selection specifying the subset to set.

value

The value to set, as an R array() or a Zarr NestedArray instance.

Returns

NULL (called for side effects).


Method set_basic_selection()

Set a selection of the array using basic (integer/slice) indexing.

Usage

ZarrArray$set_basic_selection(selection, value, fields = NA)

Arguments

selection

Selection specifying the subset to set.

value

The value to set.

fields

Not yet implemented.

Returns

NULL (called for side effects).


Method set_orthogonal_selection()

Set data using orthogonal (outer) indexing. Not yet implemented.

Usage

ZarrArray$set_orthogonal_selection(selection, value, fields = NA)

Arguments

selection

Selection specifying the subset to set.

value

Not yet implemented.

fields

Not yet implemented.

Returns

NULL (called for side effects).


Method set_coordinate_selection()

Set data using coordinate (point) indexing. Not yet implemented.

Usage

ZarrArray$set_coordinate_selection(selection, value, fields = NA)

Arguments

selection

Selection specifying the subset to set.

value

Not yet implemented.

fields

Not yet implemented.

Returns

NULL (called for side effects).


Method set_mask_selection()

Set data using a boolean mask. Not yet implemented.

Usage

ZarrArray$set_mask_selection(selection, value, fields = NA)

Arguments

selection

Selection specifying the subset to set.

value

Not yet implemented.

fields

Not yet implemented.

Returns

NULL (called for side effects).


Method get_info()

Get array diagnostic info. Not yet implemented.

Usage

ZarrArray$get_info()

Returns

character(1).


Method get_digest()

Compute a checksum digest of the array data. Not yet implemented.

Usage

ZarrArray$get_digest(hashname = "sha1")

Arguments

hashname

Name of hash.

Returns

character(1).


Method get_hexdigest()

Compute a hex-string checksum digest. Not yet implemented.

Usage

ZarrArray$get_hexdigest(hashname = "sha1")

Arguments

hashname

Name of hash.

Returns

character(1).


Method append()

Append data to the array along the specified axis.

Usage

ZarrArray$append(data, axis = 1)

Arguments

data

Data to append. Will be coerced to array if needed.

axis

Axis to append along (1-indexed, R convention). Default 1.

Returns

NULL (called for side effects).


Method view()

Return a view on the array with modified interpretation. Not yet implemented.

Usage

ZarrArray$view(
  shape = NA,
  chunks = NA,
  dtype = NA,
  fill_value = NA,
  filters = NA,
  read_only = NA,
  synchronizer = NA
)

Arguments

shape

Not yet implemented.

chunks

Not yet implemented.

dtype

Not yet implemented.

fill_value

Not yet implemented.

filters

Not yet implemented.

read_only

Not yet implemented.

synchronizer

Not yet implemented.

Returns

ZarrArray.


Method astype()

Return a view with a different dtype. Not yet implemented.

Usage

ZarrArray$astype(dtype)

Arguments

dtype

Not yet implemented.

Returns

ZarrArray.


Method get_dimension_separator()

Get the dimension separator used in chunk keys.

Usage

ZarrArray$get_dimension_separator()

Returns

character(1).


Method as.array()

Convert Zarr object to R array (for S3 method). Note that this loads all data into memory.

Usage

ZarrArray$as.array()

Returns

An R array.


Method clone()

The objects of this class are cloneable with this method.

Usage

ZarrArray$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.