From 9115ac1b4f05ddca3bb064dac7a69927da7098bd Mon Sep 17 00:00:00 2001 From: zoj613 Date: Mon, 22 Jul 2024 22:13:03 +0000 Subject: [PATCH] deploy: 95d30bd839a7f9f8550462c5c3ae2983d8a19c3f --- index.html | 2 +- zarr/Zarr/Codecs/Chain/index.html | 8 +++--- zarr/Zarr/Codecs/index.html | 2 +- zarr/Zarr/index.html | 47 ++++++++++++++++++++++++++++++- 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 72104ad2..c510bc95 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@

OCaml package documentation

    -
  1. zarr
  2. +
  3. zarr 0.1.0
diff --git a/zarr/Zarr/Codecs/Chain/index.html b/zarr/Zarr/Codecs/Chain/index.html index f18dda93..87f5f265 100644 --- a/zarr/Zarr/Codecs/Chain/index.html +++ b/zarr/Zarr/Codecs/Chain/index.html @@ -1,13 +1,13 @@ Chain (zarr.Zarr.Codecs.Chain)

Module Codecs.Chain

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

type t

A type representing a valid chain of codecs for decoding/encoding a Zarr array chunk.

val create : - ('a, 'b) Zarr__.Util.array_repr -> + ('a, 'b) array_repr -> codec_chain -> (t, [> error ]) Stdlib.result

create r c returns a type representing a chain of codecs defined by chain c and decoded array representation type r.

val default : t

default returns the default codec chain that contains only the required codecs as defined in the Zarr Version 3 specification.

val is_just_sharding : t -> bool

is_just_sharding t is true if the codec chain t contains only the sharding_indexed codec.

val encode : t -> ('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t -> (string, [> error ]) Stdlib.result

encode t x computes the encoded byte string representation of array chunk x. Returns an error upon failure.

val decode : t -> - ('a, 'b) Zarr__.Util.array_repr -> + ('a, 'b) array_repr -> string -> (('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t, [> `Store_read of string | error ]) @@ -17,13 +17,13 @@ (string list, [> `Store_read of string | error ] as 'c) Stdlib.result) -> partial_setter -> int -> - ('a, 'b) Zarr__.Util.array_repr -> + ('a, 'b) array_repr -> (int array * 'a) list -> (unit, 'c) Stdlib.result
val partial_decode : t -> ((int * int option) list -> (string list, [> `Store_read of string | error ] as 'c) Stdlib.result) -> int -> - ('a, 'b) Zarr__.Util.array_repr -> + ('a, 'b) array_repr -> (int * int array) list -> ((int * 'a) list, 'c) Stdlib.result
val (=) : t -> t -> bool

x = y returns true if chain x is equal to chain y, and false otherwise.

val of_yojson : Yojson.Safe.t -> (t, string) Stdlib.result

of_yojson x returns a code chain of type t from its json object representation.

val to_yojson : t -> Yojson.Safe.t

to_yojson x returns a json object representation of codec chain x.

diff --git a/zarr/Zarr/Codecs/index.html b/zarr/Zarr/Codecs/index.html index dc08adee..a37cae9f 100644 --- a/zarr/Zarr/Codecs/index.html +++ b/zarr/Zarr/Codecs/index.html @@ -7,4 +7,4 @@ | `Bytes of endianness | `ShardingIndexed of shard_config | fixed_bytestobytes ] - list;
  • index_location : loc;
  • }

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

    type codec_chain = [ arraytoarray | arraytobytes | bytestobytes ] list

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

    type error = [
    1. | `Extension of string
    2. | `Gzip of Ezgzip.error
    3. | `Transpose_order of int array * string
    4. | `CodecChain of string
    5. | `Sharding of int array * int array * string
    ]

    The type of errors returned upon failure when an calling a function on a Chain type.

    type partial_setter = ?append:bool -> (int * string) list -> unit
    module Chain : sig ... end

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

    + list;
  • index_location : loc;
  • }

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

    type codec_chain = [ arraytoarray | arraytobytes | bytestobytes ] list

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

    type error = [
    1. | `Extension of string
    2. | `Gzip of Ezgzip.error
    3. | `Transpose_order of int array * string
    4. | `CodecChain of string
    5. | `Sharding of int array * int array * string
    ]

    The type of errors returned upon failure when an calling a function on a Chain type.

    type partial_setter = ?append:bool -> (int * string) list -> unit
    type ('a, 'b) array_repr = {
    1. kind : ('a, 'b) Stdlib.Bigarray.kind;
    2. shape : int array;
    3. fill_value : 'a;
    }

    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.

    diff --git a/zarr/Zarr/index.html b/zarr/Zarr/index.html index a74ab860..1b849547 100644 --- a/zarr/Zarr/index.html +++ b/zarr/Zarr/index.html @@ -1,2 +1,47 @@ -Zarr (zarr.Zarr)

    Module Zarr

    type ('a, 'b) array_repr
    module Node : sig ... end

    This module provides functionality for manipulating Zarr nodes.

    module Indexing : sig ... end

    A module housing functions for creating and manipulating indices and slices for working with Zarr arrays.

    module ArrayMetadata : sig ... end

    A module which contains functionality to work with a parsed JSON Zarr array metadata document.

    module GroupMetadata : sig ... end

    A module which contains functionality to work with a parsed JSON Zarr group metadata document.

    module Storage : sig ... end
    module Codecs : sig ... end

    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.

    +Zarr (zarr.Zarr)

    Module Zarr

    zarr Provides an Ocaml implementation of the Zarr version 3 storage format specification. It supports creation of arrays and groups as well as chunking arrays along any dimension. One can store a Zarr hierarchy in memory or on disk. Zarr also supports reading zarr hierarchies created using other implementations, as long as they are spec-compliant.

    Consult the examples and limitations for more info.

    References

    Node

    module Node : sig ... end

    This module provides functionality for manipulating Zarr nodes.

    Metadata

    module ArrayMetadata : sig ... end

    A module which contains functionality to work with a parsed JSON Zarr array metadata document.

    module GroupMetadata : sig ... end

    A module which contains functionality to work with a parsed JSON Zarr group metadata document.

    Storage

    module Storage : sig ... end

    Codecs

    module Codecs : sig ... end

    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.

    Indexing

    module Indexing : sig ... end

    A module housing functions for creating and manipulating indices and slices for working with Zarr arrays.

    Examples

    Create, read & write array.

    open Zarr
    +open Zarr.Node
    +open Zarr.Codecs
    +open Zarr.Storage
    +
    +let store =
    +  Result.get_ok @@ FilesystemStore.open_or_create "testdata.zarr" in
    +let group_node = Result.get_ok @@ GroupNode.of_path "/some/group" in
    +FilesystemStore.create_group store group_node;
    +let array_node = Result.get_ok @@ ArrayNode.(group_node / "name") in
    +FilesystemStore.create_array
    +  ~codecs:[`Transpose [|2; 0; 1|]; `Bytes BE; `Gzip L2]
    +  ~shape:[|100; 100; 50|]
    +  ~chunks:[|10; 15; 20|]
    +  Bigarray.Float32 
    +  Float.neg_infinity
    +  array_node
    +  store;
    +let slice = Owl_types.[|R [0; 20]; I 10; R []|] in
    +let x =
    +  Result.get_ok @@
    +  FilesystemStore.get_array store array_node slice Bigarray.Float32 in
    +let x' =
    +  Owl.Dense.Ndarray.Generic.map
    +    (fun _ -> Owl_stats_dist.uniform_rvs 0. 10.) x in
    +FilesystemStore.set_array store array_node slice x';

    Using sharding codec.

    let config =
    +  {chunk_shape = [|5; 3; 5|]
    +  ;codecs = [`Transpose [|2; 0; 1|]; `Bytes LE; `Gzip L5]
    +  ;index_codecs = [`Bytes BE; `Crc32c]
    +  ;index_location = Start} in
    +let shard_node = Result.get_ok @@ ArrayNode.(group_node / "another") in
    +FilesystemStore.create_array
    +  ~codecs:[`ShardingIndexed config]
    +  ~shape:[|100; 100; 50|]
    +  ~chunks:[|10; 15; 20|]
    +  Bigarray.Complex32
    +  Complex.zero
    +  shard_node
    +  store;

    Explore a Zarr hierarchy.

    Functions to query a zarr hierarchy are provided. These include listing all nodes, finding children of a group node, resizing an array, deleting nodes, obtaining metadata of a node, and more.

    let a, g = FilesystemStore.find_all_nodes store in
    +FilesystemStore.reshape store array_node [|25; 32; 10|];
    +let meta =
    +  Result.get_ok @@ FilesystemStore.group_metadata store group_node in
    +GroupMetadata.show meta;
    +FilesystemStore.array_exists store shard_node;
    +let a, g = FilesystemStore.find_child_nodes store group_node in
    +FilesystemStore.erase_group_node store group_node;

    Extension Points

    This library also provides custom extensions not defined in the version 3 specification. These are tabulated below:

    Extension Point

    Details

    Data Types

    char, complex32, int (63-bit integer), nativeint

    Limitations

    Although this implementation tries to be spec compliant, it does come with a few limitations: