NEP 4.0.0
NetCDF Expansion Pack
Loading...
Searching...
No Matches
Macros | Functions
nep.h File Reference

NetCDF Expansion Pack (NEP) - Public API. More...

#include <stdio.h>
#include <netcdf.h>
#include <netcdf_filter.h>

Go to the source code of this file.

Macros

#define NC_FLOAT16   17
 
#define NC_BFLOAT16   18
 
#define NC_FLOAT8_E4M3   19
 
#define NC_FLOAT8_E5M2   20
 
#define NC_FLOAT6_E2M3   21
 
#define NC_FLOAT6_E3M2   22
 
#define NC_FLOAT4_E2M1   23
 
#define NC_COMPLEX   24
 
#define NC_DOUBLECOMPLEX   25
 
#define NC_BITFIELD8   26
 
#define NC_BITFIELD16   27
 
#define NC_BITFIELD32   28
 
#define NC_BITFIELD64   29
 
#define NC_REF_OBJECT   30
 
#define NC_REF_REGION   31
 
#define BZIP2_ID   307
 
#define LZ4_ID   32004
 
#define LZF_ID   32000
 
#define NEP_UDF_GEOTIFF_BIGTIFF   NC_UDF0
 
#define NEP_UDF_GEOTIFF_STANDARD   NC_UDF1
 
#define NEP_UDF_GRIB2   NC_UDF2
 
#define NEP_UDF_CDF   NC_UDF4
 
#define NEP_UDF_FITS   NC_UDF3
 
#define NEP_UDF_PDS4   NC_UDF5
 
#define NEP_UDF_DICOM   NC_UDF6
 
#define NEP_UDF_PDB   NC_UDF7
 
#define NEP_UDF_MMCIF   NC_UDF8
 
#define NEP_UDF_NEXTCDF4   NC_UDF9
 
#define NC_NEXTCDF4   NEP_UDF_NEXTCDF4
 
#define NC_NETCDF4_MODEL   0x04000000
 
#define NEP_MAGIC_GEOTIFF_STANDARD   "II*"
 
#define NEP_MAGIC_GEOTIFF_BIGTIFF   "II+"
 
#define NEP_MAGIC_CDF   "\xCD\xF3\x00\x01"
 
#define NEP_MAGIC_GRIB2   "GRIB"
 
#define NEP_MAGIC_FITS   "SIMPLE"
 
#define NEP_MAGIC_PDS4   "<?xml"
 
#define NEP_MAGIC_DICOM   "DICM"
 
#define NEP_MAGIC_PDB   "HEADER"
 
#define NEP_MAGIC_MMCIF   "data_"
 
#define NEP_FORMAT_NAME_GEOTIFF   "GeoTIFF"
 
#define NEP_FORMAT_NAME_CDF   "NASA CDF"
 
#define NEP_FORMAT_NAME_GRIB2   "GRIB2"
 
#define NEP_FORMAT_NAME_FITS   "FITS"
 
#define NEP_FORMAT_NAME_PDS4   "PDS4"
 
#define NEP_FORMAT_NAME_DICOM   "DICOM"
 
#define NEP_FORMAT_NAME_PDB   "PDB"
 
#define NEP_FORMAT_NAME_MMCIF   "mmCIF"
 

Functions

int nc_def_var_bzip2 (int ncid, int varid, int level)
 
int nc_inq_var_bzip2 (int ncid, int varid, int *bzip2p, int *levelp)
 
int nc_def_var_lz4 (int ncid, int varid, int level)
 
int nc_inq_var_lz4 (int ncid, int varid, int *lz4p, int *levelp)
 
int nc_def_var_lzf (int ncid, int varid)
 
int nc_inq_var_lzf (int ncid, int varid, int *lzfp)
 

Detailed Description

NetCDF Expansion Pack (NEP) - Public API.

Defines compression filter IDs and API, and the centralized mapping of file formats to NetCDF User-Defined Format (UDF) slot numbers.

UDF Slot Allocation

NetCDF-C 4.10.0+ provides 10 UDF slots (UDF0-UDF9):

Author
Edward Hartnett
Date
Nov 13, 2025

Macro Definition Documentation

◆ BZIP2_ID

#define BZIP2_ID   307

The filter ID for BZIP2 compression.

◆ LZ4_ID

#define LZ4_ID   32004

The filter ID for LZ4 compression.

◆ LZF_ID

#define LZF_ID   32000

The filter ID for LZF compression.

◆ NC_BFLOAT16

#define NC_BFLOAT16   18

NEXTCDF-4 16-bit bfloat16 floating point type (HDF5 2.1.1+).

◆ NC_BITFIELD16

#define NC_BITFIELD16   27

NEXTCDF-4 16-bit bitfield type.

◆ NC_BITFIELD32

#define NC_BITFIELD32   28

NEXTCDF-4 32-bit bitfield type.

◆ NC_BITFIELD64

#define NC_BITFIELD64   29

NEXTCDF-4 64-bit bitfield type.

◆ NC_BITFIELD8

#define NC_BITFIELD8   26

NEXTCDF-4 8-bit bitfield type.

◆ NC_COMPLEX

#define NC_COMPLEX   24

NEXTCDF-4 single-precision complex number type.

◆ NC_DOUBLECOMPLEX

#define NC_DOUBLECOMPLEX   25

NEXTCDF-4 double-precision complex number type.

◆ NC_FLOAT16

#define NC_FLOAT16   17

NEXTCDF-4 16-bit IEEE 754 half-precision floating point type.

◆ NC_FLOAT4_E2M1

#define NC_FLOAT4_E2M1   23

NEXTCDF-4 4-bit E2M1 floating point type (HDF5 2.1.1+).

◆ NC_FLOAT6_E2M3

#define NC_FLOAT6_E2M3   21

NEXTCDF-4 6-bit E2M3 floating point type (HDF5 2.1.1+).

◆ NC_FLOAT6_E3M2

#define NC_FLOAT6_E3M2   22

NEXTCDF-4 6-bit E3M2 floating point type (HDF5 2.1.1+).

◆ NC_FLOAT8_E4M3

#define NC_FLOAT8_E4M3   19

NEXTCDF-4 8-bit E4M3 floating point type (HDF5 2.1.1+).

◆ NC_FLOAT8_E5M2

#define NC_FLOAT8_E5M2   20

NEXTCDF-4 8-bit E5M2 floating point type (HDF5 2.1.1+).

◆ NC_REF_OBJECT

#define NC_REF_OBJECT   30

NEXTCDF-4 object reference type.

◆ NC_REF_REGION

#define NC_REF_REGION   31

NEXTCDF-4 dataset region reference type.

Function Documentation

◆ nc_def_var_bzip2()

int nc_def_var_bzip2 ( int  ncid,
int  varid,
int  level 
)

nep supports compression filters for netCDF/HDF5 files which are not natively supported by the netCDF C library.

BZIP2

Bzip2 is a free and open-source file compression program that uses the Burrows–Wheeler algorithm. For more information see https://www.sourceware.org/bzip2/ and https://en.wikipedia.org/wiki/Bzip2.

In C:

In Fortran:

  • nf90_def_var_bzip2()
  • nf90_inq_var_bzip2() Turn on bzip2 compression for a variable.
Parameters
ncidFile ID.
varidVariable ID.
levelFrom 1 to 9. Set the block size to 100k, 200k ... 900k when compressing. (bzip2 default level is 9).
Returns
0 for success, error code otherwise.
Author
Edward Hartnett

◆ nc_def_var_lz4()

int nc_def_var_lz4 ( int  ncid,
int  varid,
int  level 
)

Turn on lz4 compression for a variable.

Parameters
ncidFile ID.
varidVariable ID.
levelFrom 1 to 9. Set the block size to 100k, 200k ... 900k when compressing. (lz4 default level is 9).
Returns
0 for success, error code otherwise.
Author
Edward Hartnett

◆ nc_def_var_lzf()

int nc_def_var_lzf ( int  ncid,
int  varid 
)

◆ nc_inq_var_bzip2()

int nc_inq_var_bzip2 ( int  ncid,
int  varid,
int *  bzip2p,
int *  levelp 
)

Learn whether bzip2 compression is on for a variable, and, if so, the level setting.

Parameters
ncidFile ID.
varidVariable ID.
bzip2pPointer that gets a 0 if bzip2 is not in use for this var, and a 1 if it is. Ignored if NULL.
levelpPointer that gets the level setting (from 1 to 9), if bzip2 is in use. Ignored if NULL.
Returns
0 for success, error code otherwise.
Author
Edward Hartnett

◆ nc_inq_var_lz4()

int nc_inq_var_lz4 ( int  ncid,
int  varid,
int *  lz4p,
int *  levelp 
)

Learn whether lz4 compression is on for a variable, and, if so, the level setting.

Parameters
ncidFile ID.
varidVariable ID.
lz4pPointer that gets a 0 if lz4 is not in use for this var, and a 1 if it is. Ignored if NULL.
levelpPointer that gets the acceleration setting (from 1 to 9). Ignored if NULL.
Returns
0 for success, error code otherwise.
Author
Edward Hartnett

◆ nc_inq_var_lzf()

int nc_inq_var_lzf ( int  ncid,
int  varid,
int *  lzfp 
)