Public
Edited
Sep 23, 2023
Insert cell
Insert cell
view = {
// Create a store
const store = new zarr.FetchStore(url);

// Spy on the store's get method
const spied = tinyspy.spyOn(store, 'get');


// Open a zarr.Array
const arr = await zarr.open(store, { kind: "array" });
// {
// store: FetchStore,
// path: "/",
// dtype: "uint8",
// shape: [512, 512, 3],
// chunks: [100, 100, 1],
// }

// load a region of the array
const channelIndex = ["red", "green", "blue"].indexOf(radios);
const view = await zarr.get(arr, [null, null, channelIndex]);
// {
// data: Uint8Array,
// shape: [512, 512],
// stride: [512, 1],
// }

return [view, spied.calls, spied.returns];
}
Insert cell
zarr = import("https://cdn.jsdelivr.net/npm/zarrita@next/+esm")
Insert cell
tinyspy = import("tinyspy")
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more