|
NEP 4.3.0
NetCDF Expansion Pack
|
nxCDF is a clean-room rewrite of the NetCDF-4/HDF5 backend delivered as a NEP User Defined Format (UDF) expansion pack. A UDF is a plug-in file format registered with netcdf-c's dispatch mechanism; released NetCDF-C 4.10.1 provides 10 UDF slots and the pinned development revision provides 64, and nxCDF occupies slot 9 (NC_UDF9) in both schemes. The backend provides the full NetCDF-4 enhanced data model, variable I/O, storage features, and a set of new atomic types while coexisting with netcdf-c's built-in HDF5 backend. See nxCDF Architecture for how the dispatch table, per-object state, and hidden attributes fit together.
Explicit selection required: because HDF5 files already belong to netcdf-c's built-in NetCDF-4 backend, nxCDF does not register the HDF5 magic number. Open and create nxCDF files by passing NC_NXCDF.
Feature coverage: Not all NetCDF-4 features are implemented; see the Known Limitations section below.
With nxCDF and Fortran enabled, use nep_nxcdf provides initialization, mode/type constants and nf90_{get,put}_var_{float16,bfloat16} bit-buffer generics (scalar–rank 7, optional start/count/stride). NetCDF-Fortran >=4.6.2 and compatible compiler modules are required. See nxCDF Fortran for one-based selection conventions, installed NEP::nepnxcdff linkage and a complete example. Reference wrappers and broader enhanced-type value interfaces are deferred beyond v4.3.0; exported constants alone do not provide those interfaces.
nxCDF converts all supported numeric variable and attribute data with the private, NEP-owned nxcdf_convert_type() engine, selected as the permanent engine after Sprint 1H's OFF/ON comparison. It replaced the temporary NEP_INTERNAL_CONVERT CMake option; passing that option now fails at configure time. There is no runtime or file-format switch.
Standard float/double calls on bfloat16 use round-to-nearest-even, with single rounding from double and signed infinity on finite overflow. For example, 449 narrows to 448 instead of HDF5's 450. IEEE float16 conversion joined the engine in Sprint 1J (v4.3.0), with the same round-to-nearest-even and NC_ERANGE semantics; the former HDF5 H5Tconvert path was removed. HDF5 also handles file byte order and storage representation.
Matching-type raw-bit I/O, FP8/FP6/FP4 typed-call restrictions and the independent nc_*_bfloat16/nc_*_float16 wrappers are unchanged. Float/double conversion for bfloat16 attributes is supported; fill-value limitations still apply. Variable/attribute conversions and quantized writes complete all values, then return NC_ERANGE on finite overflow, integer range violations or nonfinite-to-integer conversion (#381). A range warning does not roll back writes: every value is processed, attributes may be replaced and unlimited dimensions may grow. Ordinary precision loss, fractional truncation and floating underflow do not cause range errors; floating NaN/infinity inputs remain valid for floating destinations. Structural, permission and HDF5 failures take precedence over range warnings. Historical HDF5-engine benchmark artifacts are kept for comparison in examples/nxcdf/conversion_*.csv; new measurements use the internal engine.
nxCDF also supports .ncrc autoload via UDF slot 9 (NETCDF.UDF9.LIBRARY and NETCDF.UDF9.INIT), but files must still be selected with NC_NXCDF; autoload only avoids calling NC_NXCDF_initialize() explicitly.
CMake:
Dependencies:
NC_NXCDF and NC_FORMATX_NXCDF come from the selected C headers. The Fortran nf90_nxcdf parameter is selected and checked against those headers at build time. Rebuild NEP, its Fortran module and applications when switching UDF encodings; cross-scheme binary compatibility is not supported. File-format and caller-owned allocation contracts are unchanged: reclaim dynamic results before closing the file. See Architecture for the legacy private metadata-model adaptation.
nxCDF availability is advertised at compile time through nep_meta.h:
| Mode | Base flag | Compatibility flag | Superblock | Purpose |
|---|---|---|---|---|
| Native | NC_NXCDF | — | v3 | Full enhanced model and all new types |
| Classic model | NC_NXCDF | NC_CLASSIC_MODEL | v3 | NetCDF-3 data model on HDF5 |
| NetCDF-4 model | NC_NXCDF | NC_NETCDF4_MODEL | v1 | Files readable by upstream netcdf-c |
Native mode allows all nxCDF-specific types and HDF5 2.1.1 features.
NC_CLASSIC_MODEL restricts the file to the classic NetCDF-3 data model: root group only, one unlimited dimension, classic atomic types, no chunking, compression, filters, or user-defined types.
NC_NETCDF4_MODEL produces files that upstream netcdf-c linked against HDF5 1.10+ can open. It allows the standard enhanced NetCDF-4 data model (groups, user-defined types, chunking, compression) but forbids nxCDF-specific atomic types (NC_FLOAT16, small floats, complex, bitfield, reference) so the file remains fully compatible with upstream.
NC_CLASSIC_MODEL and NC_NETCDF4_MODEL are mutually exclusive.
nc_set_fill(ncid, NC_FILL/NC_NOFILL, &old_mode) changes a session default shared by all groups. Each session begins with NC_FILL; eligible variables capture the default when defined, not at nc_enddef. Existing variables are unchanged. Standard numeric/character and NEP fixed-size numeric/complex/bitfield variables inherit it; strings, user-defined types and references retain their existing fill rules. nc_def_var_fill remains the per-variable override before commitment. Read-only calls return NC_EPERM, and invalid modes return NC_EINVAL. Unwritten no-fill values are unspecified. Changing the file default neither rebuilds datasets nor persists a new file-wide attribute.
nc_set_var_chunk_cache(ncid, varid, bytes, slots, preemption) applies real HDF5 raw chunk-cache settings. Preemption must be finite and in [0,1]; zero bytes/slots are allowed. Calls work in define/data mode, read-only sessions and all compatibility modes. Pending variables retain requests until creation; live datasets reopen with the new access properties, closing/reopening coordinate-scale aliases together. Values, filters, attributes and dimension attachments are preserved. nc_get_var_chunk_cache reports effective live chunked-dataset properties (stored requests for pending/nonchunked variables) and accepts NULL outputs. Scalar/contiguous variables accept settings but have no raw chunk cache to tune. Overrides last only for the open session; definitions and opens start from nc_set_chunk_cache global defaults.
nc_rename_grp(grpid, name) works in native and NC_NETCDF4_MODEL modes, as does group creation. Rename moves the parent link and flushes it, preserving group/descendant IDs, data, types and dimension relationships; inquiries immediately use the new path. Enhanced-mode rename may automatically enter define mode; call nc_enddef before subsequent reads. Root rename returns NC_EBADGRPID, read-only rename NC_EPERM, and duplicate names (including the existing name) NC_ENAMEINUSE. Classic-model groups remain unsupported (NC_ENOTNC4). Object-reference identity is preserved; previously saved path strings are not rewritten.
nxCDF supports ordinary serial disk files and optional MPI-IO sessions in v4.3.0. Its create/open entries reject NC_DISKLESS, NC_INMEMORY, NC_MPIIO/NC_MPIPOSIX (aliases), NC_SHARE, NC_PERSIST and NC_MMAP with NC_EINVAL, before creating, clobbering or opening a file. NetCDF-C may reject incompatible flag combinations before backend dispatch. Use NetCDF-C's memory APIs when testing memory requests: passing NC_INMEMORY directly to ordinary nc_open without an image parameter can assert inside upstream model inference before nxCDF is reached.
nxCDF supports MPI-IO file access through the upstream parallel entry points when built with -DNEP_ENABLE_NXCDF_PARALLEL=ON (default OFF). The option requires an MPI C compiler, an MPI-enabled HDF5 (HDF5_IS_PARALLEL), and a NetCDF-C built with parallel support (NC_HAS_PARALLEL4); a missing piece is a configure-time FATAL_ERROR. Availability is reported as NEP_HAS_NXCDF_PARALLEL in nep_meta.h. The parallel ctest label is nxcdf_parallel, gated on NEP_ENABLE_PARALLEL_TESTS.
The communicator and info handle arrive in the dispatch parameters pointer, are duplicated into file state (freed at nc_close), and configure the MPI-IO virtual file driver (H5Pset_fapl_mpio) plus collective metadata operations (H5Pset_all_coll_metadata_ops, H5Pset_coll_metadata_write) on the file access property list — the same semantics as upstream's built-in NetCDF-4/HDF5 backend. Consequently all ranks in the communicator must make identical define-mode calls (nc_def_dim, nc_def_var, nc_put_att, nc_enddef, nc_redef, nc_sync, nc_close); metadata operations are collective.
nc_var_par_access(ncid, varid, NC_COLLECTIVE) selects collective transfers for one variable; NC_INDEPENDENT restores independent mode. Access preferences are session-only, start independent on definition/open and survive dataset rebuilds/cache-handle reopens. The selector works in define/data mode and read-only parallel sessions, returns NC_ENOPAR on serial sessions/builds, NC_EINVAL for an invalid mode or independent filtered access, and the normal identifier errors for invalid IDs. All ranks must select the same mode and follow matching collective call sequences; call nc_enddef collectively before independent data access.
Collective data calls require every rank in the file communicator, including ranks with zero counts or reads satisfied entirely by fill. Zero-count buffers may be NULL; nonempty selections and scalars require a buffer. Independent in-bounds transfers need not be called by every rank. Overlapping writes require application coordination; examples/tests use disjoint selections. Collective unlimited-dimension writes negotiate the maximum extent across ranks and update dimension scales without shrinking shared logical lengths. Independent writes that need physical dataset growth return NC_ECANTEXTEND before mutation. Unwritten fill regions retain the variable's fill value; no-fill values remain unspecified.
Adding any filter in a parallel session forces that variable to collective access. Per the HDF5 parallel filter rule, independent filtered writes return NC_EINVAL, as does selecting independent access on a filtered variable; independent filtered reads are permitted, matching upstream. Reopening resets preferences to independent, so explicitly select collective mode before writing a filtered variable. Built-in deflate, shuffle and fletcher32 are covered in four-rank CI by the ported upstream nc_test4 parallel tests (tst_parallel_zlib, tst_parallel_compress, tst_quantize_par), and the external zstd plugin — plus bzip2 when its plugin is installed — is exercised in parallel through HDF5_PLUGIN_PATH by tst_nxcdf_parallel_plugin. No new plugin installation/path is required.
Parallel variable transfers support fixed-size standard types, enum/opaque/recursively fixed-size compounds, complex/bitfields and small floats. Float16/bfloat16 retain NEP typed float/double conversion; FP8/FP6/FP4 remain raw-bit only. NC_STRING, recursively dynamic user types and NC_STD_REF variable data I/O return NC_ENOTBUILT before automatic enddef, conversion or extent mutation; serial support is unchanged. Parallel reference-helper support is not certified. Conversion range warnings (NC_ERANGE) are rank-local, returned after completed I/O; they do not skip collective participation. Invalid rank-local arguments/allocation failures are not made recoverable through a general error-consensus protocol: applications must provide valid arguments and matching collective order.
NEP requests a collective HDF5 DXPL, but HDF5 may internally choose independent I/O; the API does not promise a particular physical MPI algorithm. The tested local/CI stack uses Open MPI, parallel HDF5 2.1.1 and parallel NetCDF-C with 64-slot UDF support; .github/workflows/ci-parallel-mpich.yml additionally runs the nxcdf_parallel label on a separate cached MPICH + parallel HDF5 2.1.1 + NetCDF-C main stack, so both MPI implementations are covered. MPICH is an alternative MPI implementation, not an additional dependency. The focused four-rank CTest programs have 180-second timeouts; run ctest --test-dir build -L nxcdf_parallel --output-on-failure with NEP_ENABLE_PARALLEL_TESTS=ON.
Upstream nc_test4 parallel tests are ported near-verbatim in test/nxcdf/nc_test4/ (tst_parallel, tst_parallel3-6, tst_parallel_zlib, tst_parallel_compress, tst_quantize_par); every port runs in both native NC_NXCDF and NC_NXCDF | NC_NETCDF4_MODEL mode. tst_nxcdf_interchange verifies interchange in both directions: nxCDF opens unmarked upstream NetCDF-4 files, and upstream NetCDF-C reads nxCDF NC_NETCDF4_MODEL files. A disk-bound four-rank collective write+read benchmark lives at examples/nxcdf/parallel_perf.c (under NEP_ENABLE_BENCHMARKS), with committed reference results in reference_parallel_*.csv/reference_parallel_machine.txt. SWMR is a separate serial writer/reader interface described below; it cannot be combined with MPI-IO.
When NEP is built without parallel support, nc_create_par/nc_open_par on a nxCDF file return NC_ENOPAR from the backend. Deprecated NC_MPIIO/NC_MPIPOSIX mode flags remain rejected with NC_EINVAL; NC_PAR is not the interface. In-memory image files remain unsupported. Native serial SWMR writer and reader sessions are supported as described below.
Native nxCDF supports a single serial writer publishing data to independent HDF5 SWMR readers. This is distinct from MPI-IO: a parallel-built HDF5 library can serve a serial writer, but an actual MPI-IO session cannot use SWMR. No new CMake option or dependency is needed beyond NEP_ENABLE_NXCDF. Include nep.h and link libncnxcdf for these interfaces:
The following complete program checks every call. It creates an unlimited coordinate and data variable, activates the writer, appends and publishes a record.
To start on an existing native file, instead use nc_open(path, NC_NXCDF | NC_WRITE, &ncid) followed by nc_start_swmr_write(ncid), or open with NC_NXCDF | NC_WRITE | NC_SWMR_WRITE. Opening without the flag later restores an ordinary session; SWMR activation is not a persistent NEP mode marker.
Only native files with actual superblock v3 and a SWMR-capable VFD are accepted; old files are not upgraded. NC_CLASSIC_MODEL, NC_NETCDF4_MODEL (including modes recovered from file markers), MPI-IO sessions and read-only flagged opens return NC_EINVAL. Explicit start on a read-only file returns NC_EPERM. Variable types must be fixed-size atomic: standard numeric/character types, small floats, complex and bitfields. String/reference/user-defined variables and any declared user type, even unused or attribute-only, return NC_ENOTBUILT. Existing atomic attributes may remain but are frozen. Failed start leaves an inactive, closable session; definitions already committed by enddef are not rolled back.
Once active, schema and attributes cannot change: define/rename/group/type/attribute operations, nc_redef, reference creation and file-default fill changes return NC_EPERM. Dataset-property setters return NC_ELATEDEF. Reads, in-bounds writes, unlimited growth, existing conversion/range behavior and session chunk-cache tuning remain available. Define filters before activation: unfiltered, deflate, shuffle+deflate and fletcher32 datasets have live-reader coverage. This does not certify arbitrary external plugins. Missing-plugin behavior is unchanged.
Publication means reader visibility, not power-loss durability or an atomic multi-variable timestep. HDF5 may flush before an explicit flush; lengths can grow before all values of a logical record are written. Use an application completion protocol for records spanning variables. A partial flush failure returns NC_EHDFERR without rollback. The filesystem must provide the consistency semantics required by HDF5 SWMR; do not disable file locking to bypass errors.
NEP readers open with NC_SWMR_READ (0x10000000), a read-only flag combined with NC_NXCDF at nc_open. The file opens through HDF5's H5F_ACC_RDONLY | H5F_ACC_SWMR_READ access (there is no H5Fstart_swmr_read function); combining it with NC_WRITE, NC_SWMR_WRITE, NC_CLASSIC_MODEL, deprecated mode flags or MPI parameters returns NC_EINVAL, and passing it to nc_create is invalid. Any file HDF5 accepts for SWMR read opens: a live writer's file, a quiescent file after the writer closed, or a file that was never SWMR-written — including NC_NETCDF4_MODEL files whose actual superblock is v3. Pre-v3 superblock files return NC_EINVAL and are never upgraded.
nc_swmr_refresh(int ncid) refreshes every variable dataset and every dimension-scale dataset through H5Drefresh, then reloads each dimension's cached length from its scale dataset's current extent, so records the writer appended and published with nc_swmr_flush()/nc_sync() become visible through ordinary nc_inq_dimlen() and nc_get_vara() calls. Calling it on an ordinary read-only, writable or writer session returns NC_EINVAL; nc_swmr_flush on a reader session returns NC_EPERM. The effective mode reported by nc_inq_format_extended() carries NC_SWMR_READ.
Refresh is not a re-open: because the writer froze its schema and attributes at activation, new variables, dimensions, attributes or types are never expected and are never discovered mid-session — reopen to see such changes. Reads mid-append are well defined at the dataset level, but a logical record spanning several variables still needs an application completion protocol. One implementation detail: HDF5 currently requires a single open handle per object for correct SWMR reads, so the backend collapses each coordinate variable's scale/variable handle pair when the reader session opens.
tst_nxcdf_swmr launches a separately executed raw-HDF5 reader and a NEP reader (tst_nxcdf_swmr_nep_reader) with bounded pipe handshakes, including two simultaneous readers and both writer/reader close orders; it runs under the nxcdf_swmr label in existing normal, sanitizer and coverage full-suite CI.
nxCDF uses the distinct ELOG(()) macro, patterned after netcdf-c's LOG(()) convention in libsrc4 and libhdf5. NEP logging is independent of the underlying NetCDF-C logging build. It is compiled in by default and can be disabled with -DNEP_ENABLE_LOGGING=OFF. Build-time availability is reported in nep_meta.h:
The default runtime verbosity is -1, which suppresses all NEP logging even when logging support is compiled in. Set NEP_LOG_LEVEL=-1 to explicitly select this silent mode; NEP_LOG_LEVEL=0 enables errors only.
To control diagnostics:
Messages are written to stderr. Instrumented nxCDF paths include file creation and open, close/abort, define/end-define mode transitions, dimension and variable definition, and the metadata loader. HDF5 failures additionally dump the HDF5 error stack.
| NetCDF Type | HDF5 Type | Compatibility Mode |
|---|---|---|
| NC_BYTE | H5T_STD_I8LE/BE | All |
| NC_UBYTE | H5T_STD_U8LE/BE | All |
| NC_CHAR | H5T_C_S1 | All |
| NC_SHORT | H5T_STD_I16LE/BE | All |
| NC_USHORT | H5T_STD_U16LE/BE | All |
| NC_INT | H5T_STD_I32LE/BE | All |
| NC_UINT | H5T_STD_U32LE/BE | All |
| NC_INT64 | H5T_STD_I64LE/BE | All |
| NC_UINT64 | H5T_STD_U64LE/BE | All |
| NC_FLOAT | H5T_IEEE_F32LE/BE | All |
| NC_DOUBLE | H5T_IEEE_F64LE/BE | All |
| NC_FLOAT16 | H5T_IEEE_F16LE/BE | Native only |
| NC_BFLOAT16 | H5T_FLOAT_BFLOAT16LE/BE | Native only |
| NC_FLOAT8_E4M3 | H5T_FLOAT_F8E4M3 | Native only |
| NC_FLOAT8_E5M2 | H5T_FLOAT_F8E5M2 | Native only |
| NC_FLOAT6_E2M3 | H5T_FLOAT_F6E2M3 | Native only |
| NC_FLOAT6_E3M2 | H5T_FLOAT_F6E3M2 | Native only |
| NC_FLOAT4_E2M1 | H5T_FLOAT_F4E2M1 | Native only |
| NC_COMPLEX | H5T_COMPLEX over H5T_NATIVE_FLOAT | Native only |
| NC_DOUBLECOMPLEX | H5T_COMPLEX over H5T_NATIVE_DOUBLE | Native only |
| NC_BITFIELD8/16/32/64 | H5T_STD_B*LE/BE | Native only |
| NC_STD_REF | H5T_STD_REF | Native only |
Small floating-point and bitfield types are exchanged as raw bit patterns by the untyped calls; NC_FLOAT16 and NC_BFLOAT16 also accept typed float/double calls (see NXCDF_float16.md). Complex numbers use the memory layout { float r; float i; } or { double r; double i; } but are stored as native HDF5 2.x H5T_COMPLEX datatypes, not as ordinary compounds — a user compound with {r,i} fields remains an ordinary user compound. NC_STD_REF variables store 64-byte H5R_ref_t reference tokens; the nc_ref_*/nc_deref_* functions create and resolve them.
nxCDF supports the enhanced-model user types — compounds (with atomic, enum, opaque, array, nested-compound and vlen fields), integer enums, fixed-size opaque types and variable-length types — as variables and attributes in both native and NC_NETCDF4_MODEL files, fully interchangeable with upstream NetCDF-4:
Semantics:
Each standalone string element is a char *; an array is a char **. Vlen-of-string payloads are arrays of pointers, not character arrays. Compound string fields use pointer-sized slots at the declared offsets. Write calls borrow application buffers for the duration of the call; attribute and fill caches deep-copy their contents. NULL standalone input elements are normalized to empty strings. String values are NUL-terminated: bytes after the first NUL are not part of the value. New files tag variable-length strings as UTF-8, matching upstream, without validating, normalizing or transcoding payload bytes. Legacy ASCII-tagged variable-length strings remain readable and writable; memory datatypes preserve stored character-set tags recursively.
Successful reads return independently owned payloads. Free standalone arrays with nc_free_string(count, values); this releases the strings, not the pointer array. Use nc_reclaim_data(ncid, xtype, values, count) for nested values, then free an allocated outer buffer yourself, or use nc_reclaim_data_all for both. Reclaim nested values before closing the file because type metadata is needed. Vlen element helpers still borrow/copy descriptors and pointer values; those aliases are not additional owned deep copies.
Standalone string variables default to an allocated empty string on read. Custom nc_def_var_fill/_FillValue strings are owned internally, and fill inquiries return independent copies. nc_def_var_fill(..., NC_NOFILL, ...) returns NC_EINVAL for standalone strings. File-wide fill defaults do not change string/user-type fill rules. Dynamic user-type defaults remain zeroed descriptors (empty vlens/null embedded pointers). Dynamic filled datasets use early HDF5 allocation at creation/extension: this materializes fills while writable, avoiding HDF5 2.1.1's attempt to write a vlen heap when reading an unallocated chunk read-only. Large sparse dynamic datasets can therefore consume more storage when extended.
NC_NETCDF4_MODEL string output is readable by upstream netcdf-c; nxCDF can read and update upstream-created string variables/attributes and nested types. Foreign anonymous compound reads retain the packed-native-layout limitation described above. One-byte fixed-length HDF5 strings remain NC_CHAR; wider fixed-length HDF5 strings are unsupported. This is selected string interoperability, not support for every HDF5 schema or the entire upstream test suite. The three upstream ports tst_strings, tst_strings2 and tst_atts_string_rewrite run in both modes alongside focused regressions under the nxcdf_strings CTest label and the existing normal/sanitizer CI jobs.
nxCDF stores NetCDF dimensions as HDF5 dimension scales and attaches them to variable datasets. It writes the following hidden attributes for fast, reliable round-tripping:
| Attribute | Location | Purpose |
|---|---|---|
| _NxcdfBackend | root group | Identifies the file as created by nxCDF |
| _NxcdfModel | root group | Present only in NC_NETCDF4_MODEL mode |
| _Netcdf4Dimid | dimension scale | Stores the stable dimension ID |
| _NxcdfVarid | variable dataset | Stores the stable variable ID |
| _Netcdf4Coordinates | variable | Stores the variable's dimension IDs |
These attributes are filtered from user-visible attribute lists.
nxCDF also writes the upstream provenance attributes so h5dump, ncdump -s and third-party tools treat its files exactly like upstream NetCDF-4 files:
| Attribute | Storage | Content |
|---|---|---|
| _NCProperties | stored on root group | version=2,netcdf=<netcdf-c version>,hdf5=<HDF5 version>,nxcdf=<NEP version> — upstream's shape plus a nxcdf key |
| _nc3_strict | stored on root group | 1 (int), NC_CLASSIC_MODEL files only |
| _IsNetcdf4 | virtual | 1 when the file carries netCDF-4 markers; synthesized on name lookup |
| _SuperblockVersion | virtual | the HDF5 FCPL superblock version; synthesized on name lookup |
Like upstream, _NCProperties/_nc3_strict are written at _enddef/nc_sync/nc_close, only for files nxCDF created, and never overwrite an existing stamp — an updated file keeps its original creator's provenance, and a file that never had a stamp stays unstamped. _IsNetcdf4 and _SuperblockVersion are never stored: nc_inq_att/nc_get_att answer them by name on the global attribute list (NC_INT, length 1), nc_inq_attid returns NC_EATTMETA, and none of the names appear in nc_inq_natts/nc_inq_attname. _Format is synthesized by tools from nc_inq_format (NC_FORMAT_NETCDF4), not stored. All of these names remain reserved — nc_put_att/nc_rename_att/nc_del_att reject them.
nxCDF supports the full NetCDF-4 filter model on non-scalar variables. Filters are stored in the shared NC_VAR_INFO_T::filters list — the same structure upstream netcdf-c uses — and are applied to the HDF5 dataset creation property list in pipeline order.
Semantics match upstream netcdf-c:
Plugin filters work through HDF5's plugin mechanism: set HDF5_PLUGIN_PATH (or install plugins in HDF5's default plugin directory) and the filter becomes available to nc_def_var_filter and to data I/O. When a file is opened whose variable uses a filter that is unavailable in the current process, the variable's metadata — including the filter pipeline — remains readable, but reads and writes return NC_ENOFILTER.
NC_CLASSIC_MODEL files permit no filters: every filter and storage setter (nc_def_var_filter, nc_def_var_deflate, nc_def_var_fletcher32, nc_def_var_szip, nc_def_var_chunking) returns NC_EINVAL.
Filters may be applied to coordinate variables. Setter-triggered dataset rebuilds are deferred to _enddef, which detaches and re-attaches dependent variables' dimension-scale references around the recreation, so dependents keep valid attachments in any definition order.
bfloat16 (brain floating point) is a 16-bit floating-point format with 1 sign bit, 8 exponent bits and 7 mantissa bits. It has the same range as float32 — the exponent width is identical — but only about 2-3 significant decimal digits of precision, and takes half the storage. NC_BFLOAT16 halves the file size for data where a relative error of up to 2^-8 (about 0.4%) is acceptable.
nxCDF stores bfloat16 as raw bit patterns; conversion between float32 and bfloat16 can be done in user code or by the internal conversion engine through the typed calls. The rules for NC_BFLOAT16 variables:
See NXCDF_float16.md for the full float16/bfloat16 user guide, a walkthrough of the examples/nxcdf/bfloat16.c example, and the benchmark results.
nxCDF exposes HDF5 2.x unified references (H5T_STD_REF / H5R_ref_t) as NC_STD_REF, with functions for creating and resolving object, region, and attribute references — including references into external files. These are only available in native mode and are declared in nep.h. See refs.md for the full reference.
Region references identify a regular strided hyperslab selection inside a variable; attribute references name an attribute on any object kind:
Tokens hold an open reference to their file — release them with nc_ref_free() before closing the file.
Remote references are a separate mechanism: a stored (URL, object path) string convention resolved by nc_ref_open_remote() and nc_ref_resolve() through nc_open() — DAP2, DAP4 or NCZarr byte-range dispatch, returning an ordinary upstream session ncid. They require building with NEP_ENABLE_REMOTE_REFS=ON and a remote-capable NetCDF-C; otherwise the functions return NC_ENOTBUILT. See refs.md.