npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

grib-renderer

v1.0.1

Published

![Safe NPM](https://safenpm.herokuapp.com/status/grib-renderer.png)

Downloads

5

Readme

Node GFS GRIB Renderer

Safe NPM

This project is a thin wrapper around Jimp and grib2json which simplifies writing GRIB visualisations in pure JS.

There's not much practical use for this, but it's a nice and visual way to get into GRIB processing.

Example Image Output

Speed

Because all of the maths and image manipulation happens in JavaScript land, this is not particularly fast. Jimp is by design JavaScript only (ahem slow). This does however mean the image generation could be done in the browser.

Interesting Parts

GRIBs are hard, I made this as a way of better understanding how GRIB visualisation tools work and why they are the way they are.

If you're learning about GRIB visualisation, I'd recommend you look at these parts of code:

const newXCoord = ((xCoord + 180) % 360) - 180; 

GFS Grib files' Latitudes by default start where we mere mortals might expect to be the center of the map. It's necessary to wrap our co-ordinates if we're to render a normal looking map.

Usage

import * as path from 'path';
import { makeMap } from 'grib-renderer';
import grib2json from 'grib2json';

const worldBBox = <any>[-180, 90, 180, -90];

grib2json('./gfs.t06z.pgrb2.0p25.f000', { // LAND
    scriptPath: './grib2json-0.8.0-SNAPSHOT/bin/grib2json',
    names: true,
    data: true,
    category: 0,
    parameter: 218,
    surfaceType: 1,
    surfaceValue: 0,
}, function (err, landGrib) {
    if (err) return console.error(err);
    else {
        const landLayer = {
            grib: landGrib[0],
            getPixel: (value) => {
                let red = 0,
                    green = 0,
                    blue = 0,
                    alpha = 255;

                if (value === 0) { // Sea
                    red = 203;
                    green = 223;
                    blue = 218;
                    alpha = 255;
                }

                return [red, green, blue, alpha];
            }
        };

        makeMap([landLayer], worldBBox)
            .then((img) => {
                img.write('./out.png');
                console.info('Written to file [./out.png]')
            })
            .catch(err => console.error(err));
    }
});

Example

The example in example/example.ts was used to generate the image above (example.png). It defines a function called makeTemperatureMap which loads two separate parameters from the same GRIB file. Once the files are loaded, 3 layers are defined and passed into makeMap.

You can execute the native TypeScript example using ts-node:

> ts-node ./example/example.ts

Dependencies

  • grib2json (https://github.com/cambecc/grib2json)
  • Valid GFS GRIB file
  • NodeJS
> # Download Grib2JSON (see https://github.com/cambecc/grib2json)
> # Download a Grib File (see https://github.com/ISNIT0/gfs-scraper)
> npm i
> npm i -g typescript

Building

> tsc

License

MIT