Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cleanup unit tests #95

Merged
merged 4 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
- **Zero dependencies** (optionally
[`scijs/ndarray`](https://github.com/scijs/ndarray))
- Runs natively in **Node**, **Browsers**, and **Deno** (ESM)
- Supports **v2** or **v3** protocols, C & F-order arrays, and diverse
data-types
- Supports **v2** or **v3** protocols, C & F-order arrays, diverse data-types,
and [ZEP2 Sharding](https://zarr.dev/zeps/draft/ZEP0002.html)
- Allows flexible **storage** backends and **compression** codecs
- Provides rich, in-editor **type information** via
[template literal types](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html)
Expand All @@ -17,9 +17,8 @@

```javascript
import * as zarr from "zarrita";
import { FetchStore } from "@zarrita/storage";

const store = new FetchStore("http://localhost:8080/data.zarr");
const store = new zarr.FetchStore("http://localhost:8080/data.zarr");
const arr = await zarr.open(store, { kind: "array" }); // zarr.Array<DataType, FetchStore>

// read chunk
Expand All @@ -36,6 +35,8 @@ const full = await get(arr); // ndarray.Ndarray<Int32Array>
const region = await get(arr, [null, zarr.slice(6)]);
```

Read [the documentation](https://manzt.github.io/zarrita.js) to learn more.

### Zarr building blocks

zarrita's API is almost entirely tree-shakeable, meaning users are able to pick
Expand Down Expand Up @@ -116,3 +117,14 @@ pnpm install
pnpm build
pnpm test
```

The tests are run with [Vitest](https://github.com/vitest-dev/vitest), which is
a Node.js test runner. To try our a development version of **zarrita** in the
browser, run `pnpm build` and start a web-server in the root of the repository:

```sh
python3 -m http.server .
# navigate to localhost:8000
```

You can edit the contents of `index.html` and refresh the page.
17 changes: 16 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"3d.chunked.mixed.i2.F",
"3d.contiguous.i2",
]) {
let arr = await zarr.open.v2(grp.resolve(fixture), { kind: "array" });
let arr = await zarr.open.v2(grp.resolve(fixture), { kind: "array", attrs: false });
let { data, shape, stride } = await get(arr);
let pre = document.createElement("pre");
pre.textContent = `\
Expand All @@ -76,23 +76,38 @@
kind: "group",
});
for (let fixture of [
"1d.chunked.compressed.sharded.i2",
"1d.chunked.filled.compressed.sharded.i2",
"1d.chunked.i2",
"1d.chunked.ragged.i2",
"1d.contiguous.b1",
"1d.contiguous.blosc.i2",
"1d.contiguous.compressed.sharded.b1",
"1d.contiguous.compressed.sharded.f4",
"1d.contiguous.compressed.sharded.f8",
"1d.contiguous.compressed.sharded.i2",
"1d.contiguous.compressed.sharded.i4",
"1d.contiguous.compressed.sharded.u1",
"1d.contiguous.f4.be",
"1d.contiguous.f4.le",
"1d.contiguous.f8",
"1d.contiguous.gzip.i2",
"1d.contiguous.i4",
"1d.contiguous.raw.i2",
"1d.contiguous.u1",
"2d.chunked.compressed.sharded.filled.i2",
"2d.chunked.compressed.sharded.i2",
"2d.chunked.i2",
"2d.chunked.ragged.compressed.sharded.i2",
"2d.chunked.ragged.i2",
"2d.contiguous.compressed.sharded.i2",
"2d.contiguous.i2",
"3d.chunked.compressed.sharded.i2",
"3d.chunked.i2",
"3d.chunked.mixed.compressed.sharded.i2",
"3d.chunked.mixed.i2.C",
"3d.chunked.mixed.i2.F",
"3d.contiguous.compressed.sharded.i2",
"3d.contiguous.i2",
]) {
let arr = await zarr.open.v3(grp.resolve(fixture), { kind: "array" });
Expand Down
Loading