package zarr

  1. Overview
  2. Docs

A functor for minting a new storage type as long as it's argument module implements the STORE interface.

Parameters

module Io : Types.IO

Signature

module Deferred : Types.Deferred with type 'a t = 'a Io.Deferred.t
type t = Io.t

The storage type.

val create_group : ?attrs:Yojson.Safe.t -> t -> Node.GroupNode.t -> unit Deferred.t

create_group ?attrs t node creates a group node in store t containing attributes attrs. This is a no-op if node is already a member of this store.

val create_array : ?sep:[< `Dot | `Slash Slash ] -> ?dimension_names:string option list -> ?attributes:Yojson.Safe.t -> codecs:Codecs.codec_chain -> shape:int array -> chunks:int array -> 'a Ndarray.dtype -> 'a -> Node.ArrayNode.t -> t -> unit Deferred.t

create_array ~sep ~dimension_names ~attributes ~codecs ~shape ~chunks kind fill node t creates an array node in store t where:

  • Separator sep is used in the array's chunk key encoding.
  • Dimension names dimension_names and user attributes attributes are included in it's metadata document.
  • A codec chain defined by codecs.
  • The array has shape shape and chunk shape chunks.
  • The array has data kind kind and fill value fv.
  • raises Codecs.Bytes_to_bytes_invariant

    if codecs contains more than one bytes->bytes codec.

array_metadata node t returns the metadata of array node node.

group_metadata node t returns the metadata of group node node.

val find_child_nodes : t -> Node.GroupNode.t -> (Node.ArrayNode.t list * Node.GroupNode.t list) Deferred.t

find_child_nodes t n returns a tuple of child nodes of group node n. This operation returns a pair of empty lists if node n has no children or is not a member of store t.

  • raises Parse_error

    if any child node has invalid node_type metadata.

val find_all_nodes : t -> (Node.ArrayNode.t list * Node.GroupNode.t list) Deferred.t

find_all_nodes t returns Some p where p is a pair of lists representing all nodes in store t. The first element of the pair is a list of all array nodes, and the second element is a list of all group nodes. This operation returns a pair of empty lists if store t is empty.

  • raises Parse_error

    if any node has invalid node_type metadata.

val erase_group_node : t -> Node.GroupNode.t -> unit Deferred.t

erase_group_node t n erases group node n from store t. This also erases all child nodes of n. If node n is not a member of store t then this is a no-op.

val erase_array_node : t -> Node.ArrayNode.t -> unit Deferred.t

erase_array_node t n erases group node n from store t. This also erases all child nodes of n. If node n is not a member of store t then this is a no-op.

val erase_all_nodes : t -> unit Deferred.t

erase_all_nodes t clears the store t by deleting all nodes. If the store is already empty, this is a no-op.

val group_exists : t -> Node.GroupNode.t -> bool Deferred.t

group_exists t n returns true if group node n is a member of store t and false otherwise.

val array_exists : t -> Node.ArrayNode.t -> bool Deferred.t

array_exists t n returns true if array node n is a member of store t and false otherwise.

val write_array : t -> Node.ArrayNode.t -> Ndarray.Indexing.index array -> 'a Ndarray.t -> unit Deferred.t

write_array t n s x writes n-dimensional array x to the slice s of array node n in store t.

  • raises Invalid_data_type

    if the kind of x is not compatible with node n's data type as described in its metadata document.

read_array t n s k reads an n-dimensional array of size determined by slice s from array node n.

  • raises Invalid_data_type

    if kind k is not compatible with node n's data type as described in its metadata document.

val reshape : t -> Node.ArrayNode.t -> int array -> unit Deferred.t

reshape t n shape resizes array node n of store t into new size shape.

OCaml

Innovation. Community. Security.