@azohra/meteo.grib

中文文档
0.1.4发布于 2026/08/21MITTypeScriptES Module近 30 天下载 5148

GRIB2 decoder in pure TypeScript: section parsing, multi-field messages, grid geometry with O(1) nearest-gridpoint lookup (regular, rotated, and Lambert conformal grids), simple and complex packing, JPEG 2000 via an injected decoder, and NOMADS .idx range

原始使用文档

@azohra/meteo.grib

A GRIB2 decoder in pure TypeScript, written because the forecast engine needs grid template 3.1 (rotated latitude-longitude: every ECCC HRDPS, RDPS, REPS, and RAQDPS field) and multi-field messages (NCEP's paired U/V submessages), and no maintained JavaScript decoder provides either. The browser-safe core carries no I/O; JPEG 2000 and the worker pool live in the Node-only @azohra/meteo.grib/j2k-node subpath.

pnpm add @azohra/meteo.grib

Decode a real field

This decodes a committed HRDPS 2 m temperature field (rotated grid, JPEG 2000 packing, the combination that motivated the package) and samples one launch:

// decode-fixture.mjs — run inside grib/ after `pnpm build`
import { readFileSync } from "node:fs";
import {
  decodeFieldValues,
  nearestGridpoint,
  parseFields,
  parseGrid,
  splitMessages,
} from "./dist/index.js";
import { createNodeJ2kDecoder } from "./dist/j2k-node.js";

const bytes = readFileSync("test/fixtures/hrdps-continental-tmp-2m.grib2");
const [field] = parseFields(splitMessages(bytes)[0]);
const grid = parseGrid(field.section3); // rotated lat-lon (GDT 3.1)
const decodeJ2k = await createNodeJ2kDecoder(); // every ECCC field is JPEG 2000
const { values } = decodeFieldValues(field, { decodeJ2k });
const site = nearestGridpoint(grid, 49.3634, -117.2361); // a launch near Nelson, BC
console.log(`${grid.kind} ${grid.ni}x${grid.nj} = ${values.length} points`);
console.log(site);
console.log(`2 m temperature: ${(values[site.index] - 273.15).toFixed(2)} C`);
rotated 2540x1290 = 3276600 points
{
  index: 879425,
  latitude: 49.3642714812993,
  longitude: -117.23441055371016,
  distanceKm: 0.1560769875776412
}
2 m temperature: 23.05 C

Every decode path is accepted bit-for-bit against ecCodes over the frozen twenty-message corpus in test/fixtures/; the gate's full story is at https://meteo.azohra.com/docs/grib/correctness/.

Documentation

The reference lives in docs/ (coverage, the ecCodes gate, and the JPEG 2000 codecs and worker pool each have a page) and is served at https://meteo.azohra.com/docs/grib/.

MIT © Justin Watts

版本与发布记录

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

版本发布日期距今
0.1.4latest2026/08/212 个月前
0.1.32026/08/162 个月前
0.1.22026/08/152 个月前
0.1.12026/08/142 个月前
0.1.1-preview.1preview2026/08/142 个月前
0.1.02026/08/132 个月前

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

@azohra/meteo.grib 是什么?

GRIB2 decoder in pure TypeScript: section parsing, multi-field messages, grid geometry with O(1) nearest-gridpoint lookup (regular, rotated, and Lambert conformal grids), simple and complex packing, JPEG 2000 via an injected decoder, and NOMADS .idx range

如何安装 @azohra/meteo.grib?

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

@azohra/meteo.grib 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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

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

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