Format:NetCDF
| Magic | 43 44 46 01 / 02 / 05 (CDF + version); NetCDF-4: HDF5 signature |
|---|---|
| Extensions | .nc, .cdf, .nc4 |
| Endianness | big-endian (classic) |
| On this wiki | Facts · Code · Notes · Topics |
Network Common Data Form, the array-oriented scientific data format: the classic format starts with "CDF" and a version byte 01, 02 or 05 followed by a header listing dimensions, attributes and variables; NetCDF-4 files are HDF5 files instead.
Overview
NetCDF has two on-disk families. The classic family (also called netCDF-3) is a self-describing header followed by fixed-size and record variables; the NetCDF-4 family is a normal Format:HDF5 file using the library's conventions.
Identification
Classic files begin with 43 44 46 ("CDF") and a version byte: 01 classic, 02 64-bit offset, 05 CDF-5 (64-bit data). Unverified: a file that starts with the HDF5 signature is NetCDF-4 (or plain HDF5); the checked v1hpg.c only handles the classic family. Unverified: classic values are big-endian (XDR); the ncx routines were not read. See Fact:NetCDF/magic/Classic file magic.
Classic header
After the 4-byte magic comes the record count (numrecs; 4 bytes in versions 1 and 2, 8 bytes in version 5), then three lists in this order: dimensions, global attributes, variables. Each list starts with a 4-byte tag (0 for an absent list, 10 dimension, 11 variable, 12 attribute) and a count. Variable entries end with the data offset (begin), 4 bytes in version 1 and 8 bytes in versions 2 and 5. See Fact:NetCDF/struct/Classic header layout.
Code & repositories
The reference implementation is Unidata/netcdf-c (BSD-3-Clause).
- https://github.com/Unidata/netcdf-c @
bc148bf800d17525075c758f95c8adbaba964366· license: BSD-3-Clause
Reference netCDF C library; libsrc/v1hpg.c reads and writes the classic header
Tested on: source read, not run: source read only · checked 2026-10-19; last activity 2026-10-06