NEP 4.3.0
NetCDF Expansion Pack
Loading...
Searching...
No Matches
NEP Format Readers

NEP implements NetCDF User Defined Format (UDF) handlers that allow external scientific data formats to be opened with the standard nc_open() API, plus an optional nxCDF backend that replaces the built-in NetCDF-4/HDF5 backend when selected explicitly. Most format readers are disabled by default and must be enabled at build time; the legacy PDB reader is enabled by default.

UDF Slot Assignments

Slot Format Magic / Detection Introduced
UDF0 GeoTIFF BigTIFF II+ v1.5.0
UDF1 GeoTIFF standard TIFF II* or MM\x00* v1.5.0
UDF2 GRIB2 GRIB v1.7.0
UDF3 FITS SIMPLE v2.0.0
UDF4 NASA CDF \xCD\xF3\x00\x01 v1.3.0
UDF5 NASA/ESA PDS4 XML root Product_Observational v2.2.0
UDF6 DICOM DICM at byte offset 128 v3.0.0
UDF7 Legacy PDB HEADER v3.3.0
UDF8 PDBx/mmCIF data_ v3.4.0
UDF9 nxCDF explicit NC_NXCDF v4.0.0

All readers can be enabled simultaneously — there are no mutual-exclusivity restrictions. The nxCDF backend can be enabled together with all readers.

Format Reference Pages

Each NEP format reader has a dedicated page with the full mapping, build options, dependencies, resources, and examples:

Format UDF Slot Reference Page
GeoTIFF UDF0 / UDF1 GeoTIFF
GRIB2 UDF2 GRIB2
FITS UDF3 FITS
NASA CDF UDF4 NASA CDF
NASA/ESA PDS4 UDF5 PDS4-to-NetCDF Mapping
DICOM UDF6 DICOM
Legacy PDB UDF7 PDB
PDBx/mmCIF UDF8 mmCIF
nxCDF UDF9 nxCDF

For NetCDF-4 LZ4/BZIP2 compression, see the separate nep-compress guide.


UDF Autoloading via .ncrc

NEP installs a .ncrc configuration file that enables NetCDF-C's UDF self-loading mechanism. Once configured, nc_open() and ncdump automatically select the correct format handler with no application code changes.

Setup — merge the installed file into ~/.ncrc:

cat /usr/local/share/.ncrc >> ~/.ncrc

For the conda package, the installed file is $CONDA_PREFIX/share/.ncrc:

cat "$CONDA_PREFIX/share/.ncrc" >> ~/.ncrc

Or point NCRCENV_RC at the installed file for a per-session override (this makes NetCDF-C ignore ~/.ncrc):

export NCRCENV_RC=/usr/local/share/.ncrc

Then open any supported format transparently:

nc_open("satellite_image.tif", NC_NOWRITE, &ncid); /* GeoTIFF */
nc_open("data.cdf", NC_NOWRITE, &ncid); /* CDF */
nc_open("gdaswave.t00z.wcoast.0p16.f000.grib2", NC_NOWRITE, &ncid); /* GRIB2 */
nc_open("image.fits", NC_NOWRITE, &ncid); /* FITS */
nc_open("image.dcm", NC_UDF6, &ncid); /* DICOM */
nc_open("structure.pdb", NC_UDF7, &ncid); /* Legacy PDB */
nc_open("example.nc", NC_NXCDF | NC_NOWRITE, &ncid); /* nxCDF */
#define NC_NXCDF
Definition nxcdf.h:35

Install path:

Build system Default Override
CMake ${prefix}/share/.ncrc -DNEP_NCRC_INSTALL_DIR=<path>

Note: .ncrc autoload works with NetCDF-C 4.10.1, which NEP already requires.

See the NetCDF UDF documentation for the full RC file format reference.