The Zarr "transpose" codec registers the storage order of a data object relative to the canonical row-major ordering of Zarr. If the registered ordering is different from the native ordering on the platform where the array is being read, the data object will be permuted upon reading.
R data is arranged in column-major order. The most efficient storage arrangement between Zarr and R is thus column-major ordering, avoiding encoding to the canonical row-major ordering during storage and decoding to column-major ordering during a read. If the storage arrangement is not row-major ordering, a transpose codec must be added to the array definition. Note that within R, both writing and reading are no-ops when data is stored in column-major ordering. On the other hand, when no transpose codec is defined for the array, there will be an automatic transpose of the data on writing and reading to maintain compatibility with the Zarr specification. Using the array_builder will automatically add the transpose codec to the array definition.
For maximum portability (e.g. with Zarr implementations outside of R that do not implement the transpose codec), data should be stored in row-major order, which can be achieved by not including this codec in the array definition.
Super classes
zarr::zarr_extension -> zarr::zarr_codec -> zarr_codec_transpose
Active bindings
orderSet or retrieve the 0-based ordering of the dimensions of the array when storing
Methods
Inherited methods
Method new()
Create a new "transpose" codec object.
Usage
zarr_codec_transpose$new(shape_length, configuration = list())Arguments
shape_lengthThe length of the shape of the array that this codec operates on.
configurationOptional. A list with the configuration parameters for this codec. The element
orderspecifies the ordering of the dimensions of the shape relative to the Zarr canonical arrangement. An integer vector with a length equal to argumentshape_length. The ordering must be 0-based. If not given, the default R ordering is used.