@azohra/meteo.j2k

中文文档
0.2.0发布于 2026/08/21MITTypeScriptES Module零依赖近 30 天下载 5061

A pure-TypeScript ITU-T T.800 JPEG 2000 decoder scoped to the codestream subset ECCC's GRIB2 feeds ship: single tile, single grayscale component, reversible 5/3 wavelet, single quality layer, default precincts, MQ-coded EBCOT. Anything outside that subset

原始使用文档

@azohra/meteo.j2k

A JPEG 2000 (ITU-T T.800) decoder in pure TypeScript, scoped to exactly the codestream subset ECCC's GRIB2 feeds ship, justified by explainability: every marker, MQ context, and lifting step lives in ten small modules with its clause of T.800 named. It is the production codec behind @azohra/meteo.grib/j2k-node, and owning the internals pays twice: decodeJ2kRegion decodes only the codeblocks a few requested gridpoints touch (bit-identical to the full decode at those points, ~16× faster per core on the largest ECCC field), and the worker pool fans one field's independent EBCOT codeblocks across threads for full decodes. Benchmarks, with dates and method: https://meteo.azohra.com/docs/j2k/performance/. Zero runtime dependencies, no Node APIs in src/.

pnpm add @azohra/meteo.j2k

Decode a real field

The workspace's golden corpus carries real ECCC messages; the codestream is the GRIB section 7 payload (DRT 5.40). This decodes one and reads a sample:

// decode-fixture.mjs — run inside j2k/ after `pnpm build` (and a grib build)
import { readFileSync } from "node:fs";
import { parseFields, splitMessages } from "../grib/dist/index.js";
import { decodeJ2k } from "./dist/index.js";

const bytes = readFileSync("../grib/test/fixtures/geps-orog-m00.grib2");
const [field] = parseFields(splitMessages(bytes)[0]);
const codestream = field.section7.subarray(5); // DRT 5.40: raw J2K after the section header

const { values, width, height, bitsPerSample, isSigned } = decodeJ2k(codestream);
console.log(`${width}x${height} = ${values.length} samples, ${bitsPerSample}-bit ${isSigned ? "signed" : "unsigned"}`);
console.log(`first samples: ${Array.from(values.slice(0, 4)).join(", ")}`);
720x361 = 259920 samples, 12-bit unsigned
first samples: 1166, 1166, 1166, 1166

When only a few gridpoints matter, decodeJ2kRegion(codestream, indices) returns the same integers decodeJ2k would put at those raster indexes while entropy-decoding only the codeblocks the points touch.

The decoder covers the measured subset the feeds ship and nothing more (everything outside it fails loudly with a named UnsupportedJ2kError); how every configuration is accepted — including region decode's exactness contract — is at https://meteo.azohra.com/docs/j2k/correctness/.

Documentation

The reference lives in docs/ (the subset, the two-ring correctness gate, and the measured performance each have a page) and is served at https://meteo.azohra.com/docs/j2k/.

MIT © Justin Watts

版本与发布记录

@azohra/meteo.j2k 共发布 4 个版本,首次发布于 2026/08/13;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.2.0latest2026/08/212 个月前
0.1.12026/08/142 个月前
0.1.1-preview.12026/08/142 个月前
0.1.02026/08/132 个月前

关于 @azohra/meteo.j2k 的常见问题

@azohra/meteo.j2k 是什么?

A pure-TypeScript ITU-T T.800 JPEG 2000 decoder scoped to the codestream subset ECCC's GRIB2 feeds ship: single tile, single grayscale component, reversible 5/3 wavelet, single quality layer, default precincts, MQ-coded EBCOT. Anything outside that subset

如何安装 @azohra/meteo.j2k?

在项目目录运行 npm install @azohra/meteo.j2k,或使用 pnpm add / yarn add / bun add。

@azohra/meteo.j2k 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@azohra/meteo.j2k 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@azohra/meteo.j2k 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@azohra/meteo.j2k 可以商用吗?

@azohra/meteo.j2k 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@azohra/meteo.j2k 的下载量有多少?

根据 npm 官方下载统计,@azohra/meteo.j2k 在 2026/10/08 – 2026/11/06 这 30 天内被下载 5,061 次,日均约 169 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@azohra/meteo.j2k 还在维护吗?

最新版本 0.2.0 发布于 2026/08/21(2 个月前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/08/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。