Zarrita-compatible codec implementations shared across projects:
Blosc2Codec—blosc2/numcodecs.blosc2bytes-to-bytes codec, decoding Blosc2 chunks by reframing them as Blosc1 and delegating to zarrita's built-inblosccodecFletcher32Codec—numcodecs.fletcher32checksum codecGribscanRawGribCodec—numcodecs.gribscan.rawgribraw GRIB1/GRIB2 decoderLogBinsCodec—numcodecs.log_binsarray-to-array quantization codec
Only decode() (reading) is implemented; write-operations via encode() are currently not supported.
Register the codecs on a zarrita registry the same way you would any other codec:
import { registry } from "zarrita";
import {
Blosc2Codec,
Fletcher32Codec,
GribscanRawGribCodec,
LogBinsCodec,
} from "codecita";
registry.set("blosc2", async () => Blosc2Codec);
registry.set("numcodecs.blosc2", async () => Blosc2Codec);
registry.set("numcodecs.fletcher32", async () => Fletcher32Codec);
registry.set("numcodecs.gribscan.rawgrib", async () => GribscanRawGribCodec);
registry.set("numcodecs.log_bins", async () => LogBinsCodec);Each codec also has its own entry point, so you can load it without importing the other codecs:
import { Blosc2Codec } from "codecita/blosc2";
import { Fletcher32Codec } from "codecita/fletcher32";
import { GribscanRawGribCodec } from "codecita/gribscan";
import { LogBinsCodec } from "codecita/logBins";The blosc2 entry point requires zarrita at runtime. The other codec entry
points do not import zarrita at runtime.
Use a dynamic import to load a codec when zarrita requests it:
import { registry } from "zarrita";
registry.set(
"numcodecs.fletcher32",
async () => (await import("codecita/fletcher32")).Fletcher32Codec
);npm run build— compilessrctodistnpm test— runs the vitest suite againstsrcnpm run lint/npm run lint:fix— eslintnpm run format/npm run format:check— prettiernpm run typecheck—tsc --noEmit
Blosc2Codecreframes chunks per the Blosc2 chunk format documented by the Blosc development team.LogBinsCodecis a TypeScript port of thelog_binscodec from the Chalmers Cloud Ice Climatology (CCIC) project.GribscanRawGribCodecreimplements the raw GRIB1/GRIB2 decoding used by gribscan/gribscan.
All codec implementations are mostly vibe coded.
0 comments
log in to comment.