Module Zarr.Codecs

An array has an associated list of codecs. Each codec specifies a bidirectional transform (an encode transform and a decode transform). This module contains building blocks for creating and working with a chain of codecs.

exception Array_to_bytes_invariant

raised when a codec chain contains more than 1 array->bytes codec.

exception Invalid_transpose_order

raised when a codec chain contains a Transpose codec with an incorrect order.

exception Invalid_sharding_chunk_shape

raise when a codec chain contains a shardingindexed codec with an incorrect inner chunk shape.

exception Invalid_codec_ordering

raised when a codec chain has incorrect ordering of codecs. i.e if the ordering is not arraytoarray list -> 1 arraytobytes -> bytestobytes list.

exception Invalid_zstd_level

raised when a codec chain contains a Zstd codec with an incorrect compression value.

type arraytoarray = [
  1. | `Transpose of int array
]

The type of array -> array codecs.

type compression_level =
  1. | L0
  2. | L1
  3. | L2
  4. | L3
  5. | L4
  6. | L5
  7. | L6
  8. | L7
  9. | L8
  10. | L9

A type representing valid Gzip codec compression levels.

type fixed_bytestobytes = [
  1. | `Crc32c
]

A type representing bytes -> bytes codecs that produce fixed sized encoded strings.

type variable_bytestobytes = [
  1. | `Gzip of compression_level
  2. | `Zstd of int * bool
]

A type representing bytes -> bytes codecs that produce variable sized encoded strings.

type bytestobytes = [
  1. | fixed_bytestobytes
  2. | variable_bytestobytes
]

The type of bytes -> bytes codecs.

type endianness =
  1. | LE
  2. | BE

A type representing the configured endianness of an array.

type loc =
  1. | Start
  2. | End

A type representing the location of a shard's index array in an encoded byte string.

type fixed_arraytobytes = [
  1. | `Bytes of endianness
]

The type of array -> bytes codecs that produce fixed sized encoded string.

type variable_array_tobytes = [
  1. | `ShardingIndexed of shard_config
]

The type of array -> bytes codecs that produce variable sized encoded string.

and shard_config = {
  1. chunk_shape : int array;
  2. codecs : [ arraytoarray | fixed_arraytobytes | `ShardingIndexed of shard_config | bytestobytes ] list;
  3. index_codecs : [ arraytoarray | fixed_arraytobytes | fixed_bytestobytes ] list;
  4. index_location : loc;
}

A type representing the Sharding indexed codec's configuration parameters.

type array_tobytes = [
  1. | fixed_arraytobytes
  2. | variable_array_tobytes
]

The type of array -> bytes codecs.

type codec_chain = [ arraytoarray | array_tobytes | bytestobytes ] list

A type used to build a user-defined chain of codecs when creating a Zarr array.

type 'a array_repr = {
  1. kind : 'a Ndarray.dtype;
  2. shape : int array;
}

The type summarizing the decoded/encoded representation of a Zarr array or chunk.

module Chain : sig ... end

A module containing functions to encode/decode an array chunk using a predefined set of codecs.

module Make (Io : Types.IO) : sig ... end