NetCDF _FillValue, missing_value and NaN Together (.nc)
One variable that hides absent data three different ways at once: two _FillValue cells, one legacy missing_value cell and one raw NaN, with valid_min and valid_max also declared. Averaging the raw array without honouring all three gives roughly -60 K instead of a real mean.
| Cell (time,lat,lon) | Stored value | Convention | Should read as |
|---|---|---|---|
| (0,0,0) | -9999.0 | _FillValue | masked / missing |
| (1,2,3) | -9999.0 | _FillValue | masked / missing |
| (2,4,1) | -8888.0 | missing_value (legacy) | masked / missing |
| (3,1,5) | NaN | raw IEEE-754 NaN | masked / missing |
| all others | 260 to 292 | real value | a temperature in K |
Specifications
- Fill Value
- -9999
- Missing Value
- -8888
- Raw Na N
- true
- Fill Cells
- 2
- Missing Cells
- 1
- Nan Cells
- 1
- Valid Min
- 200
- Valid Max
- 330
- Total Cells
- 120
Testing contract
Expected to pass- Scenario
- Read tas with masking enabled and compute the mean of the unmasked cells only.
- Expected result
- Exactly four of the 120 cells mask out and the resulting mean falls between 260 K and 292 K; ignoring any one convention drags the mean below zero or leaves a NaN.
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
“NetCDF _FillValue, missing_value and NaN Together (.nc)” is a deterministic Novus Examples fixture for Scientific data, Serialization testing, 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: NC · 1,480 bytes. 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.
Related files
- binDICOM-Shaped Stream — No Preamble, No DICM Magic (.bin)The identical element stream with the 128-byte preamble and the DICM magic stripped, which is how DICOM often arrives out of a network transfer or a database blob column. It is not a conformant Part 10 file and its content is entirely recoverable, so a reader should fall back rather than reject.

- fitsFITS BLANK — Undefined Integer Pixels (.fits)Integer FITS images mark undefined pixels with the BLANK keyword, and BLANK is compared against the stored value before BZERO and BSCALE are applied. Scale first and the four undefined pixels turn into a perfectly plausible zero, which is the ordering bug this file exists to expose.

- fitsFITS Header-Only — Valid File With No Pixels (.fits)A completely valid FITS file consisting of one 2880-byte header block and no data unit, which the standard permits whenever NAXIS is 0. It separates readers that model the data array as optional from readers that treat 'no pixels' as corruption.

- fitsFITS Image — float32 with NaN and Inf Pixels (.fits)Single-precision FITS pixels including two NaNs, which is the only way the standard marks undefined data for floating BITPIX, plus one +Inf. Statistics computed without NaN-aware reductions come back as NaN for the entire frame.

- h5HDF5 Degenerate Shapes — Scalar, Zero-Length and Null (.h5)Five degenerate but entirely legal datasets — a rank-0 scalar, a zero-length vector, a (0, 5) array, a single-element vector and a NULL dataspace — plus an empty group. None of them is corrupt, and a reader that reports them as errors is the thing being tested.

- h5HDF5 Hard, Soft and Dangling Links (.h5)One array reachable under four names: itself, a hard link sharing its object address, a soft link resolved at access time, and a soft link pointing nowhere. A walker that counts names instead of object addresses reports four arrays and then crashes on the dangling one.

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