-
Notifications
You must be signed in to change notification settings - Fork 6
/
demo.html
128 lines (125 loc) · 4.26 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>zarrita.js</title>
<script type="importmap">
{
"imports": {
"@zarrita/core": "./packages/core/dist/src/index.js",
"@zarrita/typedarray": "./packages/typedarray/dist/src/index.js",
"@zarrita/indexing": "./packages/indexing/dist/src/index.js",
"@zarrita/storage/fetch": "./packages/storage/dist/src/fetch.js",
"numcodecs/blosc": "./packages/core/node_modules/numcodecs/blosc.js",
"numcodecs/lz4": "./packages/core/node_modules/numcodecs/lz4.js",
"numcodecs/zlib": "./packages/core/node_modules/numcodecs/zlib.js",
"numcodecs/zstd": "./packages/core/node_modules/numcodecs/zstd.js",
"numcodecs/gzip": "./packages/core/node_modules/numcodecs/gzip.js"
}
}
</script>
</head>
<script type="module">
import * as zarr from "@zarrita/core";
import { get } from "@zarrita/indexing";
import FetchStore from "@zarrita/storage/fetch";
let store = zarr.root(new FetchStore(new URL("fixtures", import.meta.url)));
{
let grp = await zarr.open.v2(store.resolve("v2/data.zarr"), {
kind: "group",
});
for (let fixture of [
"1d.chunked.i2",
"1d.chunked.ragged.i2",
"1d.contiguous.S7",
"1d.contiguous.U13.be",
"1d.contiguous.U13.le",
"1d.contiguous.U7",
"1d.contiguous.b1",
"1d.contiguous.blosc.i2",
"1d.contiguous.f4.be",
"1d.contiguous.f4.le",
"1d.contiguous.f8",
"1d.contiguous.i4",
"1d.contiguous.lz4.i2",
"1d.contiguous.raw.i2",
"1d.contiguous.u1",
"1d.contiguous.zlib.i2",
"1d.contiguous.zstd.i2",
"2d.chunked.U7",
"2d.chunked.i2",
"2d.chunked.ragged.i2",
"2d.contiguous.i2",
"3d.chunked.i2",
"3d.chunked.mixed.i2.C",
"3d.chunked.mixed.i2.F",
"3d.contiguous.i2",
]) {
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 = `\
{
path: ${JSON.stringify(arr.path)},
data: ${data.constructor.name}(${JSON.stringify(Array.from(data))}),
shape: ${JSON.stringify(shape)},
stride: ${JSON.stringify(stride)},
}`;
document.body.appendChild(pre);
}
}
{
let grp = await zarr.open.v3(store.resolve("v3/data.zarr"), {
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" });
let { data, shape, stride } = await get(arr);
let pre = document.createElement("pre");
pre.textContent = `\
{
path: ${JSON.stringify(arr.path)},
data: ${data.constructor.name}(${JSON.stringify(Array.from(data))}),
shape: ${JSON.stringify(shape)},
stride: ${JSON.stringify(stride)},
}`;
document.body.appendChild(pre);
}
}
</script>
<body></body>
</html>