package zarr
Install
Dune Dependency
Authors
Maintainers
Sources
md5=df6bb0048a4479632c2867d5259c9b27
sha512=341b9db6910a90bb3663c36ae75afb84324c52980b7c6866809424f40cdcc4490eb1f606f5d2a3b1cc91e54671bb09cfc9feae3d9bb55474a66762658d26860c
doc/zarr/Zarr/index.html
Module Zarr
Source
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
Metadata
This module provides functionality for manipulating a Zarr node's metadata JSON document.
Storage
module Storage : sig ... end
A Zarr store is a system that can be used to store and retrieve data from a Zarr hierarchy. For a store to be compatible with this specification, it must support a set of operations defined in the Abstract store interface STORE
. The store interface can be implemented using a variety of underlying storage technologies.
module Memory : 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
Utils
Ndarray
Examples
Create, read & write array.
Here we show how the library's asynchronous API using Lwt's concurrency monad can be used.
open Zarr.Metadata
open Zarr.Node
open Zarr.Codecs
open Zarr_lwt.Storage
open FilesystemStore.Deferred.Syntax
let _ =
Lwt_main.run begin
let store = FilesystemStore.create "testdata.zarr" in
let group_node = GroupNode.of_path "/some/group" in
let* () = FilesystemStore.create_group store group_node in
let array_node = ArrayNode.(group_node / "name") in
let* () = FilesystemStore.create_array
~codecs:[`Bytes BE] ~shape:[|100; 100; 50|] ~chunks:[|10; 15; 20|]
Bigarray.Float32 Float.neg_infinity array_node store in
let slice = Owl_types.[|R [0; 20]; I 10; R []|] in
let* x = FilesystemStore.read_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.write_array store array_node slice x'
end
Extension Points
This library also provides custom extensions not defined in the version 3 specification. These are tabulated below:
Extension Point | Details |
---|---|
Data Types |
|
Limitations
Although this implementation tries to be spec compliant, it does come with a few limitations:
- Ocaml does not have support for unsigned integers as array data types and thus this library cannot support reading values of datatypes
uint32
,uint64
andcomplex128
.