Skip to main content

NetCDF source

Read selected variables without guessing the whole dataset.

The NetCDF source discovers variables, dimensions, attributes, and file metadata before materializing selected numeric slices. It provides a clear boundary between format discovery and raster data access.

The NetCDF query path

Inspect the header. Choose variables. Materialize a slice.

NetCDF dimensions are not automatically treated as map coordinates. The source reports the file’s structure and lets the application choose variables and named dimension ranges explicitly.

Discover

Variables, dimensions, attributes, and file size

Select

Named numeric variables and dimension slices

Read

Classic or 64-bit-offset data arrays

Output

Typed raster data with original metadata

Scan supported

OGC network Common Data Form (netCDF) standards suite

PropertyValue
Data sourceNetCDFSource

Scan support​

Detailed guide

NetCDF source details

The reference below documents scan support, metadata discovery, slicing, limitations, and the source API.

NetCDFSource and NetCDFLoader expose NetCDF classic and 64-bit-offset headers through the shared scan architecture. getQueryMetadata() discovers variable names, portable scalar types, variable attributes, dimensions, and file size without decoding data arrays. getRaster() then reads selected numeric variables and applies named dimension slices.

CapabilitySupportExecution
Entry point✅ getRaster()Typed raster data
Header and schema discovery✅ SupportedBounded leading range for remote files
Variable selection✅ SupportedSelected numeric variables
Dimension slices✅ SupportedResidual after loading the classic file
Slice syntax✅ Index or half-open [start, stop)Named dimensions
Bounds and level-of-detail❌ UnsupportedNetCDF dimensions are not assumed to be geospatial
Cancellation✅ SupportedRequest and cooperative slice materialization
Streaming or chunk pruning❌ Not implementedCurrent classic-file execution materializes the source
import {NetCDFSource} from '@loaders.gl/scientific/netcdf';

const source = new NetCDFSource('weather.nc', {});
const metadata = await source.getQueryMetadata();
const raster = await source.getRaster({
variables: ['temperature'],
slices: {time: 0, latitude: [20, 60], longitude: [40, 100]}
});

Multiple selected variables must retain the same shape and numeric type after slicing. A scalar dimension selection removes that dimension; a range retains it. The original variable and dimension names remain available in the result metadata.