Common Data Language

CDL is the human-readable text notation for the netCDF data model. Running ncdump -h on a file produces CDL: dimensions, variables with their types and shapes, and every attribute, printed as structured text. ncgen runs the transformation in reverse, building a netCDF file from a CDL description.

Its usefulness comes from putting a binary format’s structure into a form the ordinary text toolchain can handle.

What that enables

Reviewing metadata as a diff. ncdump -h on two files and diff on the output shows exactly what changed between them. When a processing chain silently alters units, drops an attribute, or renames a coordinate, this finds it in seconds. There is no equivalent for comparing binary files directly, and this is the use I reach for most.

Discussing structure without shipping data. A CDL header is a few kilobytes describing a file that may be gigabytes. For agreeing on a data standard, reporting a compliance problem, or asking whether a layout is right, the header is the part that matters and the only part worth sending.

Building test fixtures. ncgen generates small valid files from a CDL specification, so tests can run against realistic structure without large binaries in the repository. Writing the CDL first also forces the layout to be decided deliberately rather than accumulating from whatever the writing code happened to do.

Specifying a standard. Because CDL is precise about structure and readable by humans, it works as the normative form of a data specification. Both ATMODAT and the UC2 data standard are far easier to state as required CDL structure than as prose.

Its limit

CDL describes structure and metadata, not values. ncdump without -h will print the data too, but for anything of realistic size that output is unusable. CDL answers what the file contains and how it is arranged, never whether the numbers in it are right — those are separate questions and it is worth not confusing a clean header for a correct file.

See also: netCDF for the format it describes, CF conventions for what the attributes should say, and metadata.