Skip to content

Commit

Permalink
Update readme file with new function names.
Browse files Browse the repository at this point in the history
  • Loading branch information
zoj613 committed Jul 4, 2024
1 parent 4760020 commit 0441ad6
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Below is a demonstration of the library's basic API.
### setup
```ocaml
open Zarr
open Zarr.Node
open Zarr.Codecs
open Zarr.Storage
Expand All @@ -23,14 +24,14 @@ let store =
### create group
```ocaml
let group_node =
Result.get_ok @@ Node.of_path "/some/group";;
Result.get_ok @@ GroupNode.of_path "/some/group";;
FilesystemStore.create_group store group_node;;
```
### create an array
```ocaml
let array_node =
Result.get_ok @@ Node.(group_node / "name");;
Result.get_ok @@ ArrayNode.(group_node / "name");;
let codec_chain =
{a2a = [Transpose [|2; 0; 1|]]
Expand Down Expand Up @@ -78,7 +79,7 @@ R[73,1] -INF -INF -INF -INF -INF -INF *)
### create an array with sharding
```ocaml
let config =
{chunk_shape = [|10; 3; 5|]
{chunk_shape = [|5; 3; 5|]
;codecs =
{a2a = [Transpose [|2; 0; 1|]]
;a2b = Bytes Little
Expand All @@ -93,7 +94,7 @@ let codec_chain =
;a2b = ShardingIndexed config
;b2b = [Crc32c]};;
let shard_node = Result.get_ok @@ Node.(group_node / "another");;
let shard_node = Result.get_ok @@ ArrayNode.(group_node / "another");;
FilesystemStore.create_array
~codecs:codec_chain
Expand All @@ -106,8 +107,11 @@ FilesystemStore.create_array
```
### exploratory functions
```ocaml
FilesystemStore.find_all_nodes store |> List.map Node.to_path;;
(* - : string list = ["/"; "/some"; "/some/group/another"; "/some/group/name"; "/some/group"] *)
let a, g = FilesystemStore.find_all_nodes store;;
List.map ArrayNode.to_path a;;
(*- : string list = ["/some/group/name"; "/some/group/another"] *)
List.map GroupNode.to_path g;;
(*- : string list = ["/"; "/some"; "/some/group"] *)
FilesystemStore.reshape store array_node [|25; 32; 10|];;
Expand All @@ -116,11 +120,18 @@ let meta =
FilesystemStore.group_metadata group_node store;;
GroupMetadata.show meta;; (* pretty prints the contents of the metadata *)
FilesystemStore.is_member store shard_node;;
FilesystemStore.array_exists store shard_node;;
FilesystemStore.group_exists store group_node;;
FilesystemStore.find_child_nodes store group_node;;
let a, g =
Result.get_ok @@
FilesystemStore.find_child_nodes store group_node;;
List.map ArrayNode.to_path a;;
(*- : string list = ["/some/group/name"; "/some/group/another"] *)
List.map GroupNode.to_path g;;
(*- : string list = [] *)
FilesystemStore.erase_node store group_node;;
FilesystemStore.erase_group_node store group_node;;
```

[1]: https://codecov.io/gh/zoj613/zarr-ml/graph/badge.svg?token=KOOG2Y1SH5
Expand Down

0 comments on commit 0441ad6

Please sign in to comment.