Published
Edited
Dec 28, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Zstd = import(codecUrl + '/zstd').then(r => r.default)
Insert cell
LZ4 = import(codecUrl + '/lz4').then(r => r.default)
Insert cell
Insert cell
zstd = {
const meta = await files.get('data-zstd.zarr/.zarray').json();
return Zstd.fromConfig(meta.compressor);
}
Insert cell
lz4 = {
const meta = await files.get('data-lz4.zarr/.zarray').json();
return LZ4.fromConfig(meta.compressor);
}
Insert cell
Insert cell
decodedZstd = {
// load chunk as an ArrayBuffer
const buffer = await files.get('data-zstd.zarr/0.0').arrayBuffer();
// take view of compressed bytes
const cbytes = new Uint8Array(buffer);
// decompress bytes into new buffer
const dbytes = await zstd.decode(cbytes);
// take `i4` view of decompressed bytes
return new Int32Array(dbytes.buffer);
}
Insert cell
decodedLZ4 = {
const buffer = await files.get('data-lz4.zarr/0.0').arrayBuffer();
const cbytes = new Uint8Array(buffer);
const dbytes = await lz4.decode(cbytes);
return new Int32Array(dbytes.buffer);
}
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