manzt / zarrita.js

A JavaScript toolkit for working with chunked, compressed, n-dimensional arrays
https://zarrita.dev
MIT License
44 stars 5 forks source link

Cookbook docs not consistent #217

Open ondave opened 3 weeks ago

ondave commented 3 weeks ago

Cookbook docs out of date? Args for zarr.create are different from @zarrita/core docs.

https://zarrita.dev/cookbook.html#create-an-array

import * as zarr from "zarrita";
import { FileSystemStore } from "@zarrita/storage";

const store = new FileSystemStore("tempstore");
const arr = await zarr.create(store, {
    shape: [10, 10],
    chunks: [5, 5],
    dtype: "int32",
});
arr; // zarr.Array<"int32", FileSystemStore>

https://zarrita.dev/packages/core.html#create-an-array-or-group

import * as zarr from "@zarrita/core";

let root = zarr.root(new Map());
let grp = await zarr.create(root);
let arr = await zarr.create(root.resolve("foo"), {
    data_type: "int32",
    shape: [4, 4],
    chunk_shape: [2, 2],
});
console.log(root.store);
// Map(2) {
//   '/zarr.json' => Uint8Array(66) [ ... ],
//   '/foo/zarr.json' => Uint8Array(392) [ ... ],
// }
manzt commented 2 weeks ago

Thanks for pointing this out. The snake_case usage is correct, although before making a non- prerelease release we want to migrate to camelCase for all public APIs.