Skip to content
Novus Examples
nc512 B

Intentionally Corrupt NetCDF — Truncated Mid-Header (.nc)

An intentionally corrupt NetCDF file, cut to its first 512 bytes so the magic number and part of the header survive but the variable table and every data value do not. It is the fixture for the failure path where format detection succeeds and reading must not.

Preview — schema + first 5 rowsnc
FieldValue
Damageintentionally corrupt — truncated to 512 bytes
Original size1524 bytes
Magic bytesintact ('CDF' + 0x01), so sniffing succeeds
Headercut off part-way through the variable table
Expected behavioura clear parse error, not a crash and not silent zeros
Intentionally corrupt: the file identifies as NetCDF and then runs out of bytes.

Specifications

Intentionally Corrupt
true
Damage
truncated to the first 512 bytes
Original Bytes
1524
Kept Bytes
512
Magic Intact
true
Data Present
false

Testing contract

Expected to fail
Scenario
Open the file with a NetCDF reader and attempt to list its variables and read tas.
Expected result
Format sniffing recognises CDF-1 but the open or the first read raises a explicit truncation or malformed-header error rather than returning zeros, an empty variable list, or a segfault.

What is a .nc file?

NetCDF (.nc, Network Common Data Form) is a binary, self-describing format for array-oriented scientific data. It stores multidimensional variables (like temperature over latitude, longitude, and time) with named dimensions, units, and metadata attributes, and is a standard in climate, ocean, and geoscience.

How to use this file

Use an example .nc file to test NetCDF readers (netCDF4, xarray, Panoply), CF-convention validators, and gridded-data pipelines, or to verify dimension and variable extraction.

How to use this file for testing

“Intentionally Corrupt NetCDF — Truncated Mid-Header (.nc)” is a deterministic Novus Examples fixture for Scientific data, Error handling. Citation catalogs (BibTeX, RIS), chemistry structures (MDL Molfile, PDB), and gridded binary data (NetCDF, FITS) — for testing reference managers, molecule viewers, and scientific-data loaders.

Documented properties for this file: damage: truncated to the first 512 bytes · intentionally corrupt. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Scientific fixtures are small, valid, and fully synthetic — no real organism, patient, sample, or observation. Point your parser or loader at the file and check it reads the documented records, variables, or headers; binary formats ship a readable twin or metadata listing for comparison.

Generated by generation/scientific.py. Free for any use, no attribution required — license.