Skip to main content

Chunked array module

Read the chunks that cover the question.

The Zarr module opens chunked multidimensional data and exposes source APIs for spatial, multiscale, and named-dimension selection. It supports Earth-science rasters as well as OME-Zarr bioimaging data.

Windowed raster access

Read the window that answers the question.

Raster sources use metadata before pixels: discover the layout, choose the useful window, and decode only the ranges or chunks that cover it.

01 · discover

Zarr / GeoZarr / OME-Zarr

Arrays, dimensions, scales, and conventions describe independently addressable chunks.

dimensionschunksscales

02 · select

Select a named window

Choose variables, channels, levels, time, or spatial slices before reading chunks.

windowvariablelevel

03 · application result

Typed array result

Values return with dimension metadata and coordinate meaning intact. ↗

valuesdimensionsmetadata

A local file may use direct offsets; a cloud source may use HTTP ranges or object-store chunks. The application-facing selection remains the same.

The chunked-array path

Discover the array, then select a window.

Zarr stores large arrays as independently addressable chunks. Source metadata identifies dimensions, scales, variables, and coordinate meaning before a request reads the selected region.

Datasets

GeoZarr, OME-Zarr, and generic Zarr arrays

Selection

Spatial windows, bands, channels, time, and levels

Access

Chunk reads from local files or object storage

Output

Typed raster data with source metadata

See Coordinate Reference Systems for GeoZarr CRS discovery, current native-CRS behavior, and the raster-warping roadmap.

From-v5.0Status: ExperimentalScan supported

The @loaders.gl/scientific module reads chunked, multidimensional Zarr arrays. It supports the existing pixel-pyramid API, an OME-Zarr source API for bioimaging, and a GeoZarr/CF source API for georeferenced Earth-science rasters.

Detailed guide

Zarr source and array details

The sections below cover installation, source APIs, metadata discovery, chunk selection, and the supported Zarr conventions.

Installation​

npm install @loaders.gl/core @loaders.gl/scientific

APIs​

  • OMEZarrLoader opens OME-Zarr v2 and v3 image groups through createDataSource() or load().
  • GeoZarrLoader opens one georeferenced Zarr data variable and reads native spatial windows with named time, vertical, or band selections.
  • SpatialDataLoader discovers named images, labels, points, shapes, and tables from a SpatialData root. It opens Zarr-backed raster and AnnData array elements directly and reports interoperable Parquet-dataset and GeoParquet URLs for points and shapes.
  • loadZarrConsolidatedMetadata() probes .zmetadata, zmetadata, and zarr.json documents and reports top-level arrays and groups.
  • loadZarr() and ZarrPixelSource provide the legacy Zarr v2 pixel-pyramid API.

Example​

import {createDataSourceSync} from '@loaders.gl/core';
import {OMEZarrLoader} from '@loaders.gl/scientific/zarr';

const source = createDataSourceSync('https://example.com/spatialdata.zarr', [OMEZarrLoader], {
zarr: {path: 'images/example-image'}
});

const metadata = await source.getMetadata();
const raster = await source.getRaster({level: 0, channels: [0, 1, 2]});

The OME-Zarr example demonstrates browsing a SpatialData-style root and selecting an image pyramid.

For climate, weather, ocean, satellite, and other Earth-science stores, use GeoZarrLoader. It recognizes the current GeoZarr proj: and spatial: conventions as well as the regular one-dimensional coordinate arrays commonly written by xarray/CF workflows. The GeoZarr deck.gl example reads a public NASA POWER climatology store directly from S3 and renders monthly solar irradiance on an interactive map.

Feature matrix​

CapabilityZarr v2Zarr v3OME-ZarrGeoZarr / CFStatus
Browser and Node.js reads✅ Yes✅ Yes✅ Yes✅ Yes✅ Available
HTTP range/chunked access✅ Yes✅ Yes✅ Yes✅ Yes✅ Available
Consolidated metadata discovery.zmetadata, zmetadatazarr.json✅ Yes✅ Yes✅ Available
Multidimensional arrays and named dimensions✅ Yes✅ Yes✅ Yes✅ Yes✅ Available
Chunk-aware raster reads✅ Yes✅ Yes✅ Yes✅ Yes✅ Available
OME image channels, time, and z planes——✅ Yes—✅ Available
OME multiscale pyramids——✅ Yes—✅ Available
Automatic display-level selection——✅ Yes—✅ Available
Scan metadata and source discovery——✅ Yes✅ Yes✅ Available through both raster sources
GeoZarr proj: and spatial: metadata———✅ Yes✅ Available
CF/xarray coordinates, time, vertical, and band selection———✅ Yes✅ Available
Viewport-driven geospatial windows———✅ Yes✅ Available
Typed planar or interleaved channel output✅ Yes✅ Yes✅ Yes✅ Yes✅ Available
Zarrita-backed v2/v3 implementation✅ Yes✅ Yes✅ Yes✅ Yes✅ Available
SpatialData images, labels, points, shapes, and tables——✅ Yes—⚠️ Discovery and typed storage references available
Codec expansion and broader multiscale layouts⚠️ Partial⚠️ Partial❌ Planned❌ Planned❌ Planned
Common raster query execution——Levels, channels, and slicesNative spatial windows and named selections✅ Available

Scan support​

Zarr participates through two raster sources. Both read only the selected chunks and preserve typed array output, but their query vocabulary reflects the kind of array being opened.

CapabilityOME-ZarrGeoZarr / CF
Entry pointgetRaster()getRaster()
Metadata discoveryChannels, dimensions, multiscale levelsVariable, dtype, dimensions, bounds, CRS
Spatial windowImage windowNative-CRS viewport bounds
ResolutionMultiscale level pushdownNative resolution; explicit level unsupported
Non-spatial selectionChannels, time, and z slicesNamed time, vertical, band, or other dimension indices
Physical accessSelected Zarr chunks and codecsSelected Zarr chunks and codecs
OutputTyped planar or interleaved pixelsTyped raster data
ReprojectionNot applicable to ordinary OME image coordinates❌ Not performed

Query metadata is suitable for populating source-neutral controls before pixel data is requested. GeoZarr bounds must use the source CRS; callers should reproject the viewport before requesting a window when necessary.

SpatialData containers​

SpatialDataLoader normalizes the five standard SpatialData namespaces without loading element payloads. Each element retains its axes, coordinate transformations, format version, and original attributes. Image and label descriptors use ome-zarr; point descriptors use parquet-dataset; shape descriptors use geoparquet; and table descriptors use anndata-zarr.

import {createDataSourceSync} from '@loaders.gl/core';
import {SpatialDataLoader} from '@loaders.gl/scientific/zarr';

const source = createDataSourceSync(rootUrl, [SpatialDataLoader]);
const metadata = await source.getMetadata();
const image = await source.createRasterSource('image', metadata.images[0].name);
const expression = await source.createTableArraySource('annotations', 'X');

SpatialData points are Dask-style Parquet datasets and shapes are GeoParquet files. Their normalized descriptors expose the canonical points.parquet and shapes.parquet URLs so applications can hand them to the corresponding loaders.gl Parquet sources without coupling the lightweight Zarr module to the complete Parquet runtime.

Attributions​

The OME-Zarr source uses zarrita.js under the MIT license. The legacy Zarr v2 API wraps zarr.js under the MIT license.