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

@oceanum/deck-gl-grid

v9.2.5

Published

A package with custom deck.gl layers for visualizing gridded data, developed by Oceanum.

Readme

Deck-gl-grid

A package with custom deck.gl layers for visualizing gridded data, developed by Oceanum.

Features

Installation

NPM

npm install @oceanum/deck-gl-grid

Yarn

yarn add @oceanum/deck-gl-grid

Dependencies

This package has the following peer dependencies:

"@deck.gl/core": "^9.1.0",
"@deck.gl/geo-layers": "^9.1.0",
"@deck.gl/layers": "^9.1.0",
"@deck.gl/react": "^9.1.0",
"@luma.gl/constants": "^9.1.0",
"@luma.gl/core": "^9.1.0",
"@luma.gl/engine": "^9.1.0",
"@luma.gl/shadertools": "^9.1.0",
"@luma.gl/webgl": "^9.1.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"

Make sure these are installed in your project.

Building from Source

  1. Clone the repository
git clone https://github.com/oceanum/deck-gl-grid.git
cd deck-gl-grid
  1. Install dependencies
npm install
  1. Build the package
npm run build
  1. For pydeck compatibility
npm run build:pydeck

Usage

Importing the Layers

import {
  GContourLayer,
  ImageLayer,
  MaskLayer,
  ParticleLayer,
  PartmeshLayer,
  PcolorLayer
} from '@oceanum/deck-gl-grid';

Layer Examples

GContourLayer

The GContourLayer renders contour lines for gridded data.

const contourLayer = new GContourLayer({
  id: 'contour-layer',
  data: gridData,
  datakeys: {
    x: 'longitude',
    y: 'latitude',
    c: 'temperature' // Or use u/v for vector magnitude
  },
  colormap: COLORMAP_OBJECT, // Optional color mapping
  linewidth: 1,
  altitude: 0,
  opacity: 1.0,
  levels: [0, 5, 10, 15, 20], // Contour levels
});

PcolorLayer

The PcolorLayer renders gridded data as colored cells.

const pcolorLayer = new PcolorLayer({
  id: 'pcolor-layer',
  data: gridData,
  datakeys: {
    x: 'longitude',
    y: 'latitude',
    c: 'temperature'
  },
  colormap: COLORMAP_OBJECT,
  altitude: 0,
  opacity: 1.0,
});

ParticleLayer

The ParticleLayer animates particles based on vector field data.

const particleLayer = new ParticleLayer({
  id: 'particle-layer',
  data: vectorData,
  datakeys: {
    x: 'longitude',
    y: 'latitude',
    u: 'u_component',
    v: 'v_component'
  },
  colormap: COLORMAP_OBJECT, // Optional
  altitude: 0,
  opacity: 1.0,
  size: 3, // Particle size
  length: 12, // Particle trail length
  speed: 1.0, // Animation speed
  npart: 1000, // Number of particles
});

ImageLayer

The ImageLayer displays image data as a texture overlay.

const imageLayer = new ImageLayer({
  id: 'image-layer',
  data: imageData, // Can be from GeoTIFF or other sources
  datakeys: {
    x: 'longitude',
    y: 'latitude',
    b: 'band' // Optional band key
  },
  altitude: 0,
  opacity: 1.0,
});

MaskLayer

The MaskLayer creates masked regions using vector tile data.

const maskLayer = new MaskLayer({
  id: 'mask-layer',
  maskUrl: 'https://api.mapbox.com/v4/mapbox.country-boundaries-v1/{z}/{x}/{y}.vector.pbf?access_token=YOUR_MAPBOX_TOKEN',
  invert: false, // Whether to invert the mask
});

PartmeshLayer

The PartmeshLayer renders a mesh representation of vector field data.

const partmeshLayer = new PartmeshLayer({
  id: 'partmesh-layer',
  data: vectorData,
  datakeys: {
    x: 'longitude',
    y: 'latitude',
    u: 'u_component',
    v: 'v_component'
  },
  colormap: COLORMAP_OBJECT, // Optional
  altitude: 0,
  opacity: 1.0,
});

Data Format

The layers expect data in the following format:

{
  variables: {
    longitude: { data: [lon1, lon2, ...] },
    latitude: { data: [lat1, lat2, ...] },
    temperature: { data: [[val1, val2, ...], [val3, val4, ...], ...] },
    // For vector fields
    u_component: { data: [[u1, u2, ...], [u3, u4, ...], ...] },
    v_component: { data: [[v1, v2, ...], [v3, v4, ...], ...] }
  }
}

Alternatively, the data can be structured with coords and data_vars:

{
  coords: {
    longitude: { data: [lon1, lon2, ...] },
    latitude: { data: [lat1, lat2, ...] }
  },
  data_vars: {
    temperature: { data: [[val1, val2, ...], [val3, val4, ...], ...] },
    // For vector fields
    u_component: { data: [[u1, u2, ...], [u3, u4, ...], ...] },
    v_component: { data: [[v1, v2, ...], [v3, v4, ...], ...] }
  }
}

Colormap Format

Colormaps are defined as objects with scale and domain properties:

const COLORMAP = {
  scale: [
    '#6271b7', '#39619f', '#4a94a9', '#4d8d7b', '#53a553',
    '#359f35', '#a79d51', '#9f7f3a', '#a16c5c', '#813a4e'
  ],
  domain: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
};

Using with pydeck

The package includes Python bindings for use with pydeck. Install the pydeck-grid package:

pip install pydeck-grid

Example usage:

import pydeck as pdk
from pydeck_grid import PcolorLayer

# Create a layer
layer = PcolorLayer(
    id="pcolor-layer",
    data=grid_data,
    get_position=["longitude", "latitude"],
    get_color=["temperature"],
    colormap={"scale": ["blue", "green", "red"], "domain": [0, 50, 100]},
    opacity=0.8
)

# Create a deck
deck = pdk.Deck(
    layers=[layer],
    initial_view_state=pdk.ViewState(
        latitude=0,
        longitude=0,
        zoom=2
    )
)

# Display the deck
deck.show()

Examples

See the stories directory for more examples of how to use each layer.

Development

Running the demo

npm start

Running Storybook

npm run storybook

License

MIT