NEP 4.3.0
NetCDF Expansion Pack
Loading...
Searching...
No Matches
nxcdf_internal.h File Reference

Private state and shared helpers for the nxCDF backend. More...

#include <hdf5.h>
#include "nep_nc4.h"
#include "nep.h"
#include "nxcdf/nxcdf.h"
#include "nxcdf_err.h"

Go to the source code of this file.

Data Structures

struct  NXCDF_FILE_INFO
 Per-file state owned by the nxCDF dispatch layer. More...
struct  NXCDF_GRP_INFO
 nxCDF-private state hung off NC_GRP_INFO_T::format_grp_info: the group's open HDF5 handle. More...
struct  NXCDF_DIM_INFO
 nxCDF-private state hung off NC_DIM_INFO_T::format_dim_info: the dimension's scale dataset handle. More...
struct  NXCDF_VAR_INFO
 nxCDF-private state hung off NC_VAR_INFO_T::format_var_info: the variable's dataset handle plus status flags. Filter state itself lives on the shared NC_VAR_INFO_T::filters list, exactly as in upstream netcdf-c. More...
struct  NXCDF_TYPE_INFO
 nxCDF-private state hung off NC_TYPE_INFO_T::format_type_info: the user-defined type's HDF5 datatype handle (transient until committed). More...

Macros

#define NXCDF_CLOSE_WEAK   0x40000000
 Private open-mode bit for nc_ref_open_target(): open the HDF5 file with the default FAPL close degree instead of H5F_CLOSE_STRONG. HDF5's internal reopen of an external reference token pins the target file with a default FAPL, so a session that must coexist with such tokens has to use the matching close degree or H5Fopen fails with "file close degree doesn't match". Never set by user code; stripped before the mode is recorded.
#define NXCDF_BACKEND_ATT   "_NxcdfBackend"
 Hidden root attribute identifying a nxCDF-created file.
#define NXCDF_MODEL_ATT   "_NxcdfModel"
 Hidden root attribute marking NC_NETCDF4_MODEL compatibility mode, so the mode survives reopen.
#define NXCDF_BACKEND_VALUE   "nxCDF/1.0"
 Backend version string stored in NXCDF_BACKEND_ATT.
#define NXCDF_DIMID_ATT   "_Netcdf4Dimid"
 Hidden attribute on a dimension scale storing its stable NetCDF dimid, so ids survive reopen independent of link order.
#define NXCDF_VARID_ATT   "_NxcdfVarid"
 Hidden attribute on a variable dataset storing its stable NetCDF varid.
#define NXCDF_VARDIMIDS_ATT   "_Netcdf4Coordinates"
 Hidden attribute on a variable dataset storing its dimid list — the fast path for recovering a variable's dimensions at open; attached dimension scales are the fallback.
#define NXCDF_DIMCLASS   "DIMENSION_SCALE"
 HDF5 dimension scale class marker written on every dimension's scale dataset.
#define NXCDF_DIMNAME_ATT   "NAME"
#define NXCDF_NON_COORD_PREPEND   "_nc4_non_coord_"
 Upstream-compatible link prefix on a dataset whose netCDF variable name collides with a dimension it is not the coordinate variable of — the variable keeps its name, the dataset is stored as _nc4_non_coord_<name> (upstream NON_COORD_PREPEND).

Typedefs

typedef struct NXCDF_FILE_INFO NXCDF_FILE_INFO_T
 Per-file state owned by the nxCDF dispatch layer.
typedef struct NXCDF_GRP_INFO NXCDF_GRP_INFO_T
 nxCDF-private state hung off NC_GRP_INFO_T::format_grp_info: the group's open HDF5 handle.
typedef struct NXCDF_DIM_INFO NXCDF_DIM_INFO_T
 nxCDF-private state hung off NC_DIM_INFO_T::format_dim_info: the dimension's scale dataset handle.
typedef struct NXCDF_VAR_INFO NXCDF_VAR_INFO_T
 nxCDF-private state hung off NC_VAR_INFO_T::format_var_info: the variable's dataset handle plus status flags. Filter state itself lives on the shared NC_VAR_INFO_T::filters list, exactly as in upstream netcdf-c.
typedef struct NXCDF_TYPE_INFO NXCDF_TYPE_INFO_T
 nxCDF-private state hung off NC_TYPE_INFO_T::format_type_info: the user-defined type's HDF5 datatype handle (transient until committed).

Functions

int NXCDF_check_mode (int mode)
 Validate unsupported create/open flags; return NC_EINVAL if present.
int NXCDF_var_par_access (int ncid, int varid, int par_access)
 Select a variable's session-only parallel transfer mode.
int NXCDF_set_fill (int ncid, int fillmode, int *old_modep)
 Set the session fill default for subsequently defined variables.
int NXCDF_rename_grp (int grpid, const char *name)
 Rename a non-root enhanced-model group and flush its link.
int NXCDF_set_var_chunk_cache (int ncid, int varid, size_t size, size_t nelems, float preemption)
 Set session cache parameters and reopen an existing dataset.
int NXCDF_get_var_chunk_cache (int ncid, int varid, size_t *sizep, size_t *nelemsp, float *preemptionp)
 Inquire effective live chunk-cache settings or pending requests.
int NXCDF_create (const char *path, int cmode, size_t initialsz, int basepe, size_t *chunksizehintp, void *parameters, const NC_Dispatch *dispatch, int ncid)
 Dispatch-table entry behind nc_create() with NC_NXCDF: creates the HDF5 file and writes the backend marker attributes.
int NXCDF_open (const char *path, int mode, int basepe, size_t *chunksizehintp, void *parameters, const NC_Dispatch *dispatch, int ncid)
 Dispatch-table entry behind nc_open() with NC_NXCDF: opens the HDF5 file, validates the marker attributes and loads all metadata.
int NXCDF_abort (int ncid)
 Dispatch-table entry behind nc_abort(): releases the file's resources; shares the close path.
int NXCDF_close (int ncid, void *parameters)
 Dispatch-table entry behind nc_close(): ends define mode if needed, flushes, closes all HDF5 objects and frees state.
int NXCDF_sync (int ncid)
 Dispatch-table entry behind nc_sync(): flushes a writable file to storage.
int NXCDF_inq_format (int ncid, int *formatp)
 Dispatch-table entry behind nc_inq_format(): reports NC_FORMAT_NETCDF4 — nxCDF files are in the NetCDF-4/HDF5 family.
int NXCDF_inq_format_extended (int ncid, int *formatp, int *modep)
 Dispatch-table entry behind nc_inq_format_extended(): reports NC_FORMATX_NXCDF and the effective mode flags.
int nxcdf_swmr_validate (NC_FILE_INFO_T *h5, NXCDF_FILE_INFO_T *file)
 Preflight native serial SWMR without changing definitions or file bounds.
int nxcdf_swmr_activate (NC_FILE_INFO_T *h5, NXCDF_FILE_INFO_T *file)
 Activate a committed session without recursively entering enddef.
int nxcdf_swmr_flush (NC_FILE_INFO_T *h5, NXCDF_FILE_INFO_T *file)
 Publish all variable data before flushing dimension scales and the file.
int nxcdf_swmr_refresh (NC_FILE_INFO_T *h5, NXCDF_FILE_INFO_T *file)
 Refresh all variable data before reloading dimension-scale extents.
int nxcdf_swmr_read_aliases (NC_GRP_INFO_T *grp)
 Collapse coordinate-variable alias handles to a single dataset id.
int NXCDF_add_file (int ncid, const char *path, int mode, NXCDF_FILE_INFO_T **filep)
 Allocate per-file state and attach it to netcdf-c's open-file list.
int NXCDF_get_file (int ncid, NC_FILE_INFO_T **h5p, NXCDF_FILE_INFO_T **filep)
 Resolve both the shared and nxCDF-private file state for an ncid.
int nxcdf_ref_file (int ncid, NC_FILE_INFO_T **h5p, NXCDF_FILE_INFO_T **filep)
 Map a public ncid to the internal file state, rejecting any file not opened through the nxCDF backend.
int NXCDF_free_file (NXCDF_FILE_INFO_T *file)
 Close a NXCDF_FILE_INFO_T's HDF5 handles and free it.
int nxcdf_build_ncproperties (char **out)
 Build the _NCProperties value for a new file.
int nxcdf_read_ncproperties (NXCDF_FILE_INFO_T *file)
 Read an existing _NCProperties attribute at open.
int nxcdf_write_provenance (NXCDF_FILE_INFO_T *file)
 Write _NCProperties and _nc3_strict to a file nxCDF created.
int nxcdf_get_att_special (NXCDF_FILE_INFO_T *file, const char *name, nc_type *xtypep, nc_type mem_type, size_t *lenp, int *attnump, void *data)
 Answer a name lookup for a provenance attribute.
int NXCDF_write_markers (NXCDF_FILE_INFO_T *file)
 Write the hidden marker attributes identifying the file as nxCDF.
int NXCDF_read_markers (NXCDF_FILE_INFO_T *file)
 Read and validate the hidden marker attributes at open.
int NXCDF_check_write_define (NC_FILE_INFO_T *h5, NXCDF_FILE_INFO_T *file)
 Check that a file is writable and currently in define mode.
int NXCDF_map_hdf_type (nc_type xtype, hid_t *typep)
 Map an atomic nc_type to its on-disk HDF5 datatype.
void nxcdf_close_group_hdf (NC_GRP_INFO_T *grp)
 Recursively close the HDF5 objects belonging to a group.
void nxcdf_scrub_extended_atomic_data (NC_GRP_INFO_T *grp)
 Release attribute data and variable fill values that netcdf-c's teardown cannot reclaim.
int nxcdf_find_type (NC_GRP_INFO_T *grp, nc_type xtype, NC_TYPE_INFO_T **typep)
 Find the user-defined type record an nc_type id refers to.
int nxcdf_type_size (NC_GRP_INFO_T *grp, nc_type xtype, size_t *sizep)
 Resolve the in-memory element size of any supported type.
int nxcdf_file_type (NC_GRP_INFO_T *grp, nc_type xtype, hid_t *typep)
 Produce an owned HDF5 datatype with the type's file layout.
int nxcdf_memory_type (NC_GRP_INFO_T *grp, nc_type xtype, hid_t *typep)
 Produce an owned HDF5 memory datatype for any supported type.
int nxcdf_storage_memory_type (hid_t memory, hid_t storage, hid_t *typep)
 Preserve storage string character sets in a native memory layout.
int nxcdf_copy_data (NC *nc, nc_type xtype, const void *src, size_t count, void *dst)
 Deep-copy values with initialized, reclaim-safe partial results.
int nxcdf_hdf_type_match (NC_GRP_INFO_T *grp, hid_t htype, NC_TYPE_INFO_T **typep)
 Resolve an HDF5 datatype to a registered committed user type by object identity.
void nxcdf_free_type_info (NC_TYPE_INFO_T *type)
 Release a type's nxCDF-private record and its HDF5 datatype handle, if any.
int nxcdf_flush_pending_atts (NC_GRP_INFO_T *grp)
 Materialize attributes deferred while their datatype or dataset was pending — called at _enddef.
int NXCDF_type_size (nc_type xtype, size_t *sizep)
 Return the in-memory size, in bytes, of an atomic nc_type.
hid_t NXCDF_memory_type (nc_type type, int *closep)
 Map a netCDF atomic type to the HDF5 datatype describing the caller's memory buffer.
int nxcdf_convert_type (const void *src, void *dest, nc_type src_type, nc_type dest_type, size_t len, int *range_error, const void *fill_value, int strict_nc3, int quantize_mode, int nsd, int fill_on_overflow)
 NEP's internal numeric conversion engine for nxCDF.
const char * NXCDF_type_name (nc_type xtype)
 Return the short name for an atomic nc_type.
int NXCDF_check_atomic_type (NXCDF_FILE_INFO_T *file, nc_type xtype)
 Check whether an atomic type is allowed for the file's compatibility mode.
int NXCDF_load_metadata (NXCDF_FILE_INFO_T *file, NC_FILE_INFO_T *h5)
 Load all metadata for an open nxCDF file — the entry point NXCDF_open() calls after checking the marker attributes.
int NXCDF__enddef (int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align)
 Materialize pending metadata and leave define mode — the nc_enddef() dispatch entry.
int NXCDF_redef (int ncid)
 Return the file to define mode — the nc_redef() dispatch entry.
int NXCDF_def_dim (int ncid, const char *name, size_t len, int *idp)
 Define a dimension — the nc_def_dim() dispatch entry.
int NXCDF_inq_dim (int ncid, int dimid, char *name, size_t *lenp)
 Inquire about a dimension — the nc_inq_dim() dispatch entry.
int NXCDF_def_var (int ncid, const char *name, nc_type xtype, int ndims, const int *dimidsp, int *varidp)
 Define a variable — the nc_def_var() dispatch entry.
int nxcdf_find_var_for_write (int ncid, int varid, NC_FILE_INFO_T **h5, NXCDF_FILE_INFO_T **file, NC_GRP_INFO_T **grp, NC_VAR_INFO_T **var)
 Common prologue for the def-var setter dispatch functions.
int nxcdf_create_var_dataset (NC_VAR_INFO_T *var, NC_FILE_INFO_T *h5, NXCDF_FILE_INFO_T *file, NC_GRP_INFO_T *grp)
 Create or re-create the HDF5 dataset for a variable.
int nxcdf_apply_filters (hid_t dcpl, NC_VAR_INFO_T *var)
 Apply a variable's filter list to a dataset creation property list.
int nxcdf_load_filters (hid_t dcpl, NC_VAR_INFO_T *var, NXCDF_VAR_INFO_T *vinfo)
 Read a variable's filter pipeline from a dataset creation property list.
int NXCDF_def_var_chunking (int ncid, int varid, int storage, const size_t *chunksizesp)
 Set storage and chunk sizes — the nc_def_var_chunking() dispatch entry.
int NXCDF_def_var_deflate (int ncid, int varid, int shuffle, int deflate, int deflate_level)
 Set deflate compression — the nc_def_var_deflate() dispatch entry.
int NXCDF_def_var_fletcher32 (int ncid, int varid, int fletcher32)
 Enable the Fletcher32 checksum — the nc_def_var_fletcher32() dispatch entry.
int NXCDF_def_var_fill (int ncid, int varid, int no_fill, const void *fill_value)
 Set fill behavior — the nc_def_var_fill() dispatch entry.
int NXCDF_def_var_endian (int ncid, int varid, int endianness)
 Set the on-disk byte order — the nc_def_var_endian() dispatch entry.
int NXCDF_def_var_quantize (int ncid, int varid, int quantize_mode, int nsd)
 Set quantization — the nc_def_var_quantize() dispatch entry.
int NXCDF_def_var_filter (int ncid, int varid, unsigned int id, size_t nparams, const unsigned int *params)
 Define an HDF5 filter on a variable — the nc_def_var_filter() dispatch entry.
int NXCDF_inq_var (int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp)
 Inquire about a variable's name, type, dimensions, and attributes — the nc_inq_var() dispatch entry.
int NXCDF_inq_var_all (int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp, int *shufflep, int *deflatep, int *deflate_levelp, int *fletcher32p, int *contiguousp, size_t *chunksizesp, int *no_fillp, void *fill_valuep, int *endiannessp, unsigned int *idp, size_t *nparamsp, unsigned int *params)
 Inquire about all supported properties of a variable — the nc_inq_var_all() dispatch entry.
int NXCDF_inq_var_filter_ids (int ncid, int varid, size_t *nfiltersp, unsigned int *ids)
 Inquire the filter ids applied to a variable — the nc_inq_var_filter_ids() dispatch entry.
int NXCDF_inq_var_filter_info (int ncid, int varid, unsigned int id, size_t *nparamsp, unsigned int *params)
 Inquire the parameters of one variable filter — the nc_inq_var_filter_info() dispatch entry.
int NXCDF_inq_filter_avail (int ncid, unsigned int id)
 Test whether an HDF5 filter is available — the nc_inq_filter_avail() dispatch entry.
int NXCDF_get_vara (int ncid, int varid, const size_t *startp, const size_t *countp, void *data, nc_type memtype)
 Read a hyperslab — the nc_get_vara_* dispatch entry.
int NXCDF_put_vara (int ncid, int varid, const size_t *startp, const size_t *countp, const void *data, nc_type memtype)
 Write a hyperslab — the nc_put_vara_* dispatch entry.
int NXCDF_get_vars (int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, void *data, nc_type memtype)
 Read a strided hyperslab — the nc_get_vars_* dispatch entry.
int NXCDF_put_vars (int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const void *data, nc_type memtype)
 Write a strided hyperslab — the nc_put_vars_* dispatch entry.
int NXCDF_get_varm (int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, void *data, nc_type memtype)
 Mapped hyperslab read (nc_get_varm_*); not implemented.
int NXCDF_put_varm (int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, const void *data, nc_type memtype)
 Mapped hyperslab write (nc_put_varm_*); not implemented.
int NXCDF_put_att (int ncid, int varid, const char *name, nc_type xtype, size_t len, const void *value, nc_type memtype)
 Create or replace an attribute — the nc_put_att_* dispatch entry.
int NXCDF_inq_att (int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp)
 Inquire about an attribute — the nc_inq_att() dispatch entry.
int NXCDF_inq_attid (int ncid, int varid, const char *name, int *attnump)
 Learn an attribute's index by name — the nc_inq_attid() dispatch entry.
int NXCDF_get_att (int ncid, int varid, const char *name, void *value, nc_type memtype)
 Read an attribute's value — the nc_get_att_* dispatch entry.
int NXCDF_rename_att (int ncid, int varid, const char *name, const char *newname)
 Rename an attribute — the nc_rename_att() dispatch entry.
int NXCDF_rename_dim (int ncid, int dimid, const char *name)
 Rename a dimension and update its HDF5 link.
int NXCDF_rename_var (int ncid, int varid, const char *name)
 Rename a variable and update its HDF5 link.
int NXCDF_del_att (int ncid, int varid, const char *name)
 Delete an attribute from a group or variable.
int NXCDF_def_grp (int ncid, const char *name, int *grpidp)
 Create a subgroup — the nc_def_grp() dispatch entry.
int NXCDF_inq_ncid (int ncid, const char *name, int *grpidp)
 Get the ncid of a named subgroup — the nc_inq_ncid() dispatch entry.
int NXCDF_inq_grps (int ncid, int *numgrps, int *grpidsp)
 Get the ncids of all subgroups — the nc_inq_grps() dispatch entry.
int NXCDF_inq_grpname (int ncid, char *name)
 Get a group's (short) name — the nc_inq_grpname() dispatch entry.
int NXCDF_inq_grpname_full (int ncid, size_t *lenp, char *name)
 Get a group's full path name — the nc_inq_grpname_full() dispatch entry.
int NXCDF_inq_grp_parent (int ncid, int *parentidp)
 Get a group's parent ncid — the nc_inq_grp_parent() dispatch entry.
int NXCDF_inq_grp_full_ncid (int ncid, const char *full_name, int *grpidp)
 Get the ncid of a group given its full path — the nc_inq_grp_full_ncid() dispatch entry.
int NXCDF_inq_typeids (int ncid, int *ntypes, int *typeids)
 Get the type ids of the user-defined types in a group — the nc_inq_typeids() dispatch entry.
int NXCDF_def_compound (int ncid, size_t size, const char *name, nc_type *typeidp)
 Define a compound type — the nc_def_compound() dispatch entry.
int NXCDF_insert_compound (int ncid, nc_type typeid, const char *name, size_t offset, nc_type xtype)
 Insert a scalar field into a compound type — the nc_insert_compound() dispatch entry.
int NXCDF_insert_array_compound (int ncid, nc_type typeid, const char *name, size_t offset, nc_type xtype, int ndims, const int *dim_sizesp)
 Insert a scalar or fixed-size array field into a compound type — the nc_insert_array_compound() dispatch entry.
int NXCDF_inq_compound_field (int ncid, nc_type typeid, int fieldid, char *name, size_t *offsetp, nc_type *fieldtypep, int *ndimsp, int *dim_sizesp)
 Inquire a field of a compound type — the nc_inq_compound_field() dispatch entry.
int NXCDF_inq_compound_fieldindex (int ncid, nc_type typeid, const char *name, int *fieldidxp)
 Get a compound field's index by name — the nc_inq_compound_fieldindex() dispatch entry.
int NXCDF_def_vlen (int ncid, const char *name, nc_type base_typeid, nc_type *typeidp)
 Define a variable-length type — the nc_def_vlen() dispatch entry.
int NXCDF_put_vlen_element (int ncid, int typeid, void *vlen_element, size_t len, const void *data)
 Write a vlen element value — the nc_put_vlen_element() dispatch entry.
int NXCDF_get_vlen_element (int ncid, int typeid, const void *vlen_element, size_t *lenp, void *data)
 Read a vlen element value — the nc_get_vlen_element() dispatch entry.
int NXCDF_def_enum (int ncid, nc_type base_typeid, const char *name, nc_type *typeidp)
 Define an enum type — the nc_def_enum() dispatch entry.
int NXCDF_insert_enum (int ncid, nc_type typeid, const char *name, const void *value)
 Insert a member into an enum type — the nc_insert_enum() dispatch entry.
int NXCDF_inq_enum_member (int ncid, nc_type typeid, int idx, char *name, void *value)
 Inquire an enum member by index — the nc_inq_enum_member() dispatch entry.
int NXCDF_inq_enum_ident (int ncid, nc_type typeid, long long value, char *identifier)
 Get an enum member name by value — the nc_inq_enum_ident() dispatch entry.
int NXCDF_def_opaque (int ncid, size_t size, const char *name, nc_type *typeidp)
 Define an opaque type — the nc_def_opaque() dispatch entry.
int NXCDF_write_types (NC_FILE_INFO_T *h5)
 Commit every pending user-defined type — called by NXCDF__enddef() before the metadata writer runs, so committed datatypes exist when variable datasets are created.
int NXCDF_inq_user_type (int ncid, nc_type typeid, char *name, size_t *sizep, nc_type *base_typep, size_t *nfieldsp, int *classp)
 Inquire a user-defined type — the nc_inq_user_type() dispatch entry.
int NXCDF_inq_typeid (int ncid, const char *name, nc_type *typeidp)
 Get a type's id by name — the nc_inq_typeid() dispatch entry.
int NXCDF_inq_type_equal (int ncid1, nc_type typeid1, int ncid2, nc_type typeid2, int *equalp)
 Compare two types for equality — the nc_inq_type_equal() dispatch entry.
int NXCDF_get_type_size (nc_type xtype, size_t *sizep)
 Return the in-memory size of an atomic type — a thin public wrapper over NXCDF_type_size().

Variables

const NC_Dispatch * NXCDF_dispatch_table
 Active nxCDF dispatch table, or NULL before initialization.

Detailed Description

Private state and shared helpers for the nxCDF backend.

Author
Edward Hartnett
Date
2026-08-28

Macro Definition Documentation

◆ NXCDF_BACKEND_ATT

#define NXCDF_BACKEND_ATT   "_NxcdfBackend"

Hidden root attribute identifying a nxCDF-created file.

Written at create; checked by NXCDF_read_markers() at open to distinguish nxCDF files from upstream netCDF-4/HDF5 files.

◆ NXCDF_BACKEND_VALUE

#define NXCDF_BACKEND_VALUE   "nxCDF/1.0"

Backend version string stored in NXCDF_BACKEND_ATT.

◆ NXCDF_CLOSE_WEAK

#define NXCDF_CLOSE_WEAK   0x40000000

Private open-mode bit for nc_ref_open_target(): open the HDF5 file with the default FAPL close degree instead of H5F_CLOSE_STRONG. HDF5's internal reopen of an external reference token pins the target file with a default FAPL, so a session that must coexist with such tokens has to use the matching close degree or H5Fopen fails with "file close degree doesn't match". Never set by user code; stripped before the mode is recorded.

◆ NXCDF_DIMCLASS

#define NXCDF_DIMCLASS   "DIMENSION_SCALE"

HDF5 dimension scale class marker written on every dimension's scale dataset.

◆ NXCDF_DIMID_ATT

#define NXCDF_DIMID_ATT   "_Netcdf4Dimid"

Hidden attribute on a dimension scale storing its stable NetCDF dimid, so ids survive reopen independent of link order.

◆ NXCDF_DIMNAME_ATT

#define NXCDF_DIMNAME_ATT   "NAME"

Optional dimension scale name attribute.

◆ NXCDF_MODEL_ATT

#define NXCDF_MODEL_ATT   "_NxcdfModel"

Hidden root attribute marking NC_NETCDF4_MODEL compatibility mode, so the mode survives reopen.

◆ NXCDF_NON_COORD_PREPEND

#define NXCDF_NON_COORD_PREPEND   "_nc4_non_coord_"

Upstream-compatible link prefix on a dataset whose netCDF variable name collides with a dimension it is not the coordinate variable of — the variable keeps its name, the dataset is stored as _nc4_non_coord_<name> (upstream NON_COORD_PREPEND).

◆ NXCDF_VARDIMIDS_ATT

#define NXCDF_VARDIMIDS_ATT   "_Netcdf4Coordinates"

Hidden attribute on a variable dataset storing its dimid list — the fast path for recovering a variable's dimensions at open; attached dimension scales are the fallback.

◆ NXCDF_VARID_ATT

#define NXCDF_VARID_ATT   "_NxcdfVarid"

Hidden attribute on a variable dataset storing its stable NetCDF varid.

Typedef Documentation

◆ NXCDF_DIM_INFO_T

nxCDF-private state hung off NC_DIM_INFO_T::format_dim_info: the dimension's scale dataset handle.

◆ NXCDF_FILE_INFO_T

Per-file state owned by the nxCDF dispatch layer.

Hung off netcdf-c's NC_FILE_INFO_T::format_file_info by NXCDF_add_file(); holds the open HDF5 handles and the mode flags the dispatch entries consult. See nxCDF Architecture.

◆ NXCDF_GRP_INFO_T

nxCDF-private state hung off NC_GRP_INFO_T::format_grp_info: the group's open HDF5 handle.

◆ NXCDF_TYPE_INFO_T

nxCDF-private state hung off NC_TYPE_INFO_T::format_type_info: the user-defined type's HDF5 datatype handle (transient until committed).

◆ NXCDF_VAR_INFO_T

nxCDF-private state hung off NC_VAR_INFO_T::format_var_info: the variable's dataset handle plus status flags. Filter state itself lives on the shared NC_VAR_INFO_T::filters list, exactly as in upstream netcdf-c.

Function Documentation

◆ NXCDF__enddef()

int NXCDF__enddef ( int ncid,
size_t h_minfree,
size_t v_align,
size_t v_minfree,
size_t r_align )

Materialize pending metadata and leave define mode — the nc_enddef() dispatch entry.

Materialize pending root-group metadata to HDF5 and exit define mode.

While a file is in define mode, nc_def_dim/nc_def_var/ nc_put_att only build the in-memory NC_*_INFO_T tree. _enddef is where it all becomes HDF5: NXCDF_write_types() and the metadata writer in nxcdf_meta.c create the committed datatypes, dimension scales, variable datasets and attributes, then the file flushes and switches to data mode. The alignment arguments exist in the dispatch signature for netcdf-c compatibility but are ignored.

Parameters
ncidNetCDF file identifier.
h_minfreeIgnored (reserved for future alignment control).
v_alignIgnored (reserved for future alignment control).
v_minfreeIgnored (reserved for future alignment control).
r_alignIgnored (reserved for future alignment control).
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_abort()

int NXCDF_abort ( int ncid)
extern

Dispatch-table entry behind nc_abort(): releases the file's resources; shares the close path.

Dispatch-table entry behind nc_abort(): releases the file's resources; shares the close path.

For nxCDF abort and close share the release path; HDF5 simply discards unflushed state.

Parameters
ncidNetCDF file identifier.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_add_file()

int NXCDF_add_file ( int ncid,
const char * path,
int mode,
NXCDF_FILE_INFO_T ** filep )

Allocate per-file state and attach it to netcdf-c's open-file list.

Allocate and register per-file nxCDF state.

Called by both NXCDF_create() and NXCDF_open(). netcdf-c's nc4_file_list_add creates the shared NC_FILE_INFO_T (with a root NC_GRP_INFO_T); this function then allocates the nxCDF-private NXCDF_FILE_INFO_T and hangs it on format_file_info, plus a NXCDF_GRP_INFO_T on the root group. New files start in define mode with hdfid/rootid unset.

Parameters
ncidNetCDF file identifier.
pathFile-system path.
modeEffective NetCDF mode.
filepDestination for the allocated state.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ nxcdf_apply_filters()

int nxcdf_apply_filters ( hid_t dcpl,
NC_VAR_INFO_T * var )

Apply a variable's filter list to a dataset creation property list.

Apply a variable's filter list to a dataset creation property list.

Iterates var->filters in pipeline order: fletcher32, shuffle, deflate and szip get their dedicated H5Pset_* calls; every other filter is attached with H5Pset_filter() and H5Z_FLAG_OPTIONAL so HDF5 skips it silently on types it cannot process (matching upstream).

Parameters
dcplDataset creation property list identifier.
varVariable.
Returns
NC_NOERR on success, NC_EFILTER on bad parameters, or NC_EHDFERR on an HDF5 failure.

◆ nxcdf_build_ncproperties()

int nxcdf_build_ncproperties ( char ** out)

Build the _NCProperties value for a new file.

Build the _NCProperties value for a newly created file.

Produces version=2,netcdf=<netcdf-c version>,hdf5=<hdf5 version>, nxcdf=<nep version> — upstream's property string plus a nxcdf key, which the version-2 format tolerates. The netcdf-c version is the first token of nc_inq_libvers(); the HDF5 version comes from H5get_libversion; the NEP version is the build-time NEP_VERSION.

Parameters
outDestination for a malloc'd string the caller frees.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_check_atomic_type()

int NXCDF_check_atomic_type ( NXCDF_FILE_INFO_T * file,
nc_type xtype )

Check whether an atomic type is allowed for the file's compatibility mode.

Validate a fixed-size atomic type for the active model.

Called at nc_def_var/nc_put_att time. NC_CLASSIC_MODEL files accept only the six classic types; NC_NETCDF4_MODEL adds the enhanced types (unsigned ints, int64, string) but not the nxCDF-only types (small floats, complex, bitfields, references), keeping the file readable by upstream netcdf-c. See the mode table in nxCDF Architecture.

Parameters
filenxCDF file state.
xtypeCandidate NetCDF type.
Returns
NC_NOERR or NC_EBADTYPE/NC_ENOTNC4.

◆ NXCDF_check_mode()

int NXCDF_check_mode ( int mode)

Validate unsupported create/open flags; return NC_EINVAL if present.

Validate unsupported create/open flags; return NC_EINVAL if present.

Parameters
modeNetCDF create/open flags, including the UDF selector.
Returns
NC_NOERR for supported flags, otherwise NC_EINVAL.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ NXCDF_check_write_define()

int NXCDF_check_write_define ( NC_FILE_INFO_T * h5,
NXCDF_FILE_INFO_T * file )

Check that a file is writable and currently in define mode.

Verify the file is in define mode and not read-only.

Common guard for every metadata-changing dispatch entry (nc_def_*, nc_rename_*, nc_put_att, nc_del_att). netCDF semantics require define mode for metadata changes; files opened read-only reject them outright. A metadata call in data mode silently re-enters define mode, as upstream NC4_redef does; classic-model files keep the strict NC_ENOTINDEFINE rule.

Parameters
h5NetCDF-4 file state (may be NULL).
filenxCDF file state.
Returns
NC_NOERR, NC_EPERM (read-only file), or NC_ENOTINDEFINE.

◆ NXCDF_close()

int NXCDF_close ( int ncid,
void * parameters )
extern

Dispatch-table entry behind nc_close(): ends define mode if needed, flushes, closes all HDF5 objects and frees state.

Dispatch-table entry behind nc_close(): ends define mode if needed, flushes, closes all HDF5 objects and frees state.

A file still in define mode is _enddef'd first (materializing its pending metadata), then all HDF5 handles are closed recursively, the file is flushed if writable, and the state is freed and removed from netcdf-c's open-file list.

Parameters
ncidNetCDF file identifier.
parametersOptional close parameters; currently ignored.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ nxcdf_close_group_hdf()

void nxcdf_close_group_hdf ( NC_GRP_INFO_T * grp)

Recursively close the HDF5 objects belonging to a group.

Find a user-defined type visible from a group. Recursively close HDF5 objects and free per-group format info.

At close time every open hid_t under a group must be released: the group's own NXCDF_GRP_INFO_T::hdf_group (skipping the root, whose handle is closed separately via rootid), each variable's dataset hid_t, each dimension's scale hid_t, then all children. HDF5 calls are wrapped in H5E_BEGIN_TRY/H5E_END_TRY so a partially-closed tree does not print spurious error stacks.

Parameters
grpGroup.

◆ nxcdf_convert_type()

int nxcdf_convert_type ( const void * src,
void * dest,
nc_type src_type,
nc_type dest_type,
size_t len,
int * range_error,
const void * fill_value,
int strict_nc3,
int quantize_mode,
int nsd,
int fill_on_overflow )

NEP's internal numeric conversion engine for nxCDF.

Convert numeric buffers using the internal engine.

Converts between standard numeric atomic types, and between NC_BFLOAT16/NC_FLOAT16 storage and NC_FLOAT/NC_DOUBLE buffers. Modeled on netcdf-c's libsrc4/nc4var.c conversion but owned by NEP so behavior (in particular NC_ERANGE reporting, issue #381) is consistent across all I/O paths: variable I/O, attributes and quantized writes.

Three strategies: standard numerics convert elementwise in C with exact range checks; NC_FLOAT16 pairs use decode_half() and encode_half()/encode_half_double(); NC_BFLOAT16 pairs use encode_bfloat() with round-to-nearest-even. Both 16-bit types decode exactly and narrow with round-to-nearest-even, single rounding from double — HDF5 performs no application numeric conversion. Quantization is applied to the converted output last. Callers may probe with NULL buffers to validate a conversion before allocating.

Parameters
srcSource buffer (may be NULL for a validation-only probe).
destDestination buffer (may be NULL for a probe).
src_typeResolved source type.
dest_typeResolved destination type.
lenElement count.
range_errorRequired output range flag.
fill_valueOptional destination fill.
strict_nc3Classic byte-range convention.
quantize_modeQuantization mode.
nsdQuantization precision.
fill_on_overflowNonzero to store the fill value on real-to-integer overflow (NEP variable semantics); zero stores the raw truncated cast like netcdf-c (attribute read semantics).
Returns
NC_NOERR or a type, argument, allocation or HDF5 error; overflow is reported via range_error, not the return value.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ nxcdf_copy_data()

int nxcdf_copy_data ( NC * nc,
nc_type xtype,
const void * src,
size_t count,
void * dst )

Deep-copy values with initialized, reclaim-safe partial results.

Parameters
ncFile controller owning user-type metadata.
xtypeAtomic or user-defined type.
srcBorrowed source element buffer.
countNumber of elements.
dstUninitialized destination element buffer.
Returns
NC_NOERR or a NetCDF error; failure leaves a zeroed destination.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ NXCDF_create()

int NXCDF_create ( const char * path,
int cmode,
size_t initialsz,
int basepe,
size_t * chunksizehintp,
void * parameters,
const NC_Dispatch * dispatch,
int ncid )
extern

Dispatch-table entry behind nc_create() with NC_NXCDF: creates the HDF5 file and writes the backend marker attributes.

Dispatch-table entry behind nc_create() with NC_NXCDF: creates the HDF5 file and writes the backend marker attributes.

This is the dispatch-table entry netcdf-c calls when a user calls nc_create() with NC_NXCDF in the mode flags. It validates the mode, requires HDF5 2.1.1 or newer at run time (the build enforces the same minimum), registers the file's in-memory state, and creates the HDF5 file with a superblock bound matching the requested model: H5F_LIBVER_LATEST (superblock v3) for native and classic-model files, H5F_LIBVER_V110 for NC_NETCDF4_MODEL files so upstream netcdf-c linked against HDF5 1.10 can read them.

Only the hidden marker attributes are written here — dimensions, variables and attributes are materialized later by _enddef (see NXCDF__enddef() and nxCDF Architecture).

Parameters
pathFile-system path to create.
cmodeNetCDF create-mode flags.
initialszRequested initial file size; currently ignored.
basepeBase processing element; currently ignored.
chunksizehintpChunk-size hint; currently ignored.
parametersNon-NULL when the user called nc_create_par(): points at an NXCDF_MPI_INFO carrying the MPI communicator and info handle. nc_create_par() also requires NC_NETCDF4 in the mode flags (upstream rejects other creates without PnetCDF), so parallel creates pass NC_NXCDF|NC_NETCDF4.
dispatchDispatch table selected by netcdf-c.
ncidNetCDF file identifier allocated by netcdf-c.
Returns
NC_NOERR on success, NC_EINVAL for bad mode flags, NC_ENOTBUILT when HDF5 is too old, NC_EEXIST for a NC_NOCLOBBER collision, NC_ENOPAR for a parallel request when nxCDF was built without parallel support, NC_EPARINIT when the MPI-IO driver cannot be set, or another NetCDF error code.

◆ nxcdf_create_var_dataset()

int nxcdf_create_var_dataset ( NC_VAR_INFO_T * var,
NC_FILE_INFO_T * h5,
NXCDF_FILE_INFO_T * file,
NC_GRP_INFO_T * grp )

Create or re-create the HDF5 dataset for a variable.

Create or re-create the HDF5 dataset for a variable.

Called by NXCDF_def_var and from NXCDF__enddef for every variable a def-var setter marked dcpl_dirty: because HDF5 dataset creation properties are immutable, changing chunking/compression/fill/endian requires deleting the dataset link and recreating it with a new creation property list. Recreation detaches the dimension-scale references that point at the old object, rewrites the hidden id attributes and the variable's scale attachments, re-attaches a coordinate variable's dependents to the new scale, and restores the user attributes the delete dropped. The variable's filter pipeline comes from var->filters via nxcdf_apply_filters().

Parameters
varVariable.
h5NetCDF-4 file state.
filenxCDF file state.
grpGroup.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_compound()

int NXCDF_def_compound ( int ncid,
size_t size,
const char * name,
nc_type * typeidp )

Define a compound type — the nc_def_compound() dispatch entry.

Define a compound type.

A compound type is a C-struct-like record of named fields at byte offsets. Creates an empty transient H5T_COMPOUND, registers the NC_TYPE_INFO_T, and attaches the datatype uncommitted — fields are added by NXCDF_insert_compound() and the type is committed at _enddef.

Parameters
ncidNetCDF file identifier.
sizeSize of the compound type in bytes.
nameType name.
typeidpDestination for the new type id.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_dim()

int NXCDF_def_dim ( int ncid,
const char * name,
size_t len,
int * idp )

Define a dimension — the nc_def_dim() dispatch entry.

Define a dimension in the root group.

nxCDF stores each dimension as an HDF5 dimension scale: a 1-D int8 dataset marked CLASS = "DIMENSION_SCALE" with hidden NAME and _Netcdf4Dimid attributes. An unlimited dimension (len == 0) becomes a chunked dataset with H5S_UNLIMITED extent. Classic-model files get at most one unlimited dimension.

Parameters
ncidNetCDF file identifier.
nameDimension name.
lenDimension length, or 0 for unlimited.
idpDestination for the assigned dimension id.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_enum()

int NXCDF_def_enum ( int ncid,
nc_type base_typeid,
const char * name,
nc_type * typeidp )

Define an enum type — the nc_def_enum() dispatch entry.

Define an enum type.

An enum is named constants over an integer base type. Creates a transient H5Tenum_create datatype and attaches it uncommitted; members are added by NXCDF_insert_enum() and the type is committed at _enddef.

Parameters
ncidNetCDF file identifier.
base_typeidInteger base type id.
nameType name.
typeidpDestination for the new type id.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_grp()

int NXCDF_def_grp ( int ncid,
const char * name,
int * grpidp )

Create a subgroup — the nc_def_grp() dispatch entry.

Create a subgroup below a group.

Validates define-mode write access, creates the HDF5 group under the parent's hid_t, adds the matching NC_GRP_INFO_T to the in-memory tree, and returns the child ncid. Groups are an enhanced-model feature: native and NC_NETCDF4_MODEL files accept them, while NC_CLASSIC_MODEL files return NC_ENOTNC4.

Parameters
ncidNetCDF file identifier of the parent group.
nameSubgroup name.
grpidpDestination for the new subgroup ncid.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_opaque()

int NXCDF_def_opaque ( int ncid,
size_t size,
const char * name,
nc_type * typeidp )

Define an opaque type — the nc_def_opaque() dispatch entry.

Define an opaque type.

An opaque type is a fixed-size blob the library does not interpret. Like vlens it has no members, so the H5T_OPAQUE datatype is committed immediately.

Parameters
ncidNetCDF file identifier.
sizeSize of the opaque data in bytes.
nameType name.
typeidpDestination for the new type id.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_var()

int NXCDF_def_var ( int ncid,
const char * name,
nc_type xtype,
int ndims,
const int * dimidsp,
int * varidp )

Define a variable — the nc_def_var() dispatch entry.

Define a fixed-size atomic variable in the root group.

Builds the NC_VAR_INFO_T record and creates the HDF5 dataset immediately: scalar variables get a scalar dataspace, dimensioned variables a simple dataspace (unlimited dims force chunked layout). The hidden _Netcdf4Varid and _Netcdf4Coordinates attributes are written on the dataset, and each dimension's scale is attached with H5DSattach_scale. A 1-D variable named after its only dimension is a coordinate variable — it replaces the dimension's scale dataset so the variable's data is the scale.

var->storage starts at -1 ("not specified") so that layout is decided here and a later def-var setter cannot silently change it (issue #382).

Parameters
ncidNetCDF file identifier.
nameVariable name.
xtypeNetCDF atomic type.
ndimsNumber of dimensions.
dimidspArray of dimension ids.
varidpDestination for the assigned variable id.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_var_chunking()

int NXCDF_def_var_chunking ( int ncid,
int varid,
int storage,
const size_t * chunksizesp )

Set storage and chunk sizes — the nc_def_var_chunking() dispatch entry.

Variable storage-property dispatch callbacks.

Records the layout and per-dimension chunk sizes and marks the variable dcpl_dirty; layout is fixed at dataset creation in HDF5, so _enddef rebuilds the dataset once with the new creation properties.

Parameters
ncidNetCDF file identifier.
varidVariable identifier.
storageStorage class (NC_CHUNKED or NC_CONTIGUOUS; NC_COMPACT is rejected).
chunksizespChunk size for each dimension, or NULL.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_var_deflate()

int NXCDF_def_var_deflate ( int ncid,
int varid,
int shuffle,
int deflate,
int deflate_level )

Set deflate compression — the nc_def_var_deflate() dispatch entry.

Set shuffle and deflate compression on a variable.

Upstream NC4_def_var_deflate semantics: shuffle is set first, then deflate is added only when deflate is nonzero and deflate_level is 1-9 — level 0 means "no compression" and adds no filter. Once defined, a filter cannot be removed; re-calling only replaces parameters.

Parameters
ncidNetCDF file identifier.
varidVariable id.
shuffleNonzero to enable the shuffle filter.
deflateNonzero to enable deflate compression.
deflate_levelDeflate level (0-9).
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_var_endian()

int NXCDF_def_var_endian ( int ncid,
int varid,
int endianness )

Set the on-disk byte order — the nc_def_var_endian() dispatch entry.

Set the endianness on a variable.

Records the byte order on the variable and marks it dcpl_dirty; the _enddef rebuild applies it to the dataset's datatype. NC_ENDIAN_NATIVE leaves the little-endian default produced by NXCDF_map_hdf_type().

Parameters
ncidNetCDF file identifier.
varidVariable id.
endiannessNC_ENDIAN_NATIVE, NC_ENDIAN_LITTLE or NC_ENDIAN_BIG.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_var_fill()

int NXCDF_def_var_fill ( int ncid,
int varid,
int no_fill,
const void * fill_value )

Set fill behavior — the nc_def_var_fill() dispatch entry.

Set fill behavior and the fill value on a variable.

Stores the no-fill flag and a private copy of the fill value on the variable and marks it dcpl_dirty: fill value and fill time are HDF5 creation properties, so _enddef rebuilds the dataset once with them.

Parameters
ncidNetCDF file identifier.
varidVariable id.
no_fillNonzero to suppress fill values.
fill_valueFill value, or NULL for the type default.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_var_filter()

int NXCDF_def_var_filter ( int ncid,
int varid,
unsigned int id,
size_t nparams,
const unsigned int * params )

Define an HDF5 filter on a variable — the nc_def_var_filter() dispatch entry.

Set an HDF5 filter on a variable.

Follows upstream NC4_hdf5_def_var_filter(): the filter must be available to HDF5, the variable must be non-scalar and not yet committed to disk (nxcdf_find_var_for_write rejects that with NC_ELATEDEF), and deflate/szip carry the usual parameter and mutual-exclusion rules. A re-defined filter id replaces its parameters in place. Defining any filter forces chunked storage and marks the variable dcpl_dirty, since HDF5 creation properties are immutable — _enddef rebuilds the dataset once.

Parameters
ncidNetCDF file identifier.
varidVariable id.
idHDF5 filter identifier.
nparamsNumber of filter parameters.
paramsFilter parameter values.
Returns
NC_NOERR on success, NC_ENOFILTER when the filter is unavailable, NC_ELATEDEF on a committed variable, or a NetCDF error code.

◆ NXCDF_def_var_fletcher32()

int NXCDF_def_var_fletcher32 ( int ncid,
int varid,
int fletcher32 )

Enable the Fletcher32 checksum — the nc_def_var_fletcher32() dispatch entry.

Set the Fletcher32 checksum on a variable.

NC_FLETCHER32 adds the checksum filter (always first in the pipeline); NC_NOCHECKSUM is a no-op, matching upstream — filters cannot be removed once defined.

Parameters
ncidNetCDF file identifier.
varidVariable id.
fletcher32NC_FLETCHER32 to enable, NC_NOCHECKSUM ignored.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_var_quantize()

int NXCDF_def_var_quantize ( int ncid,
int varid,
int quantize_mode,
int nsd )

Set quantization — the nc_def_var_quantize() dispatch entry.

Set quantization on a variable.

Quantization records a mode and precision on the variable; it is applied at write time by nxcdf_convert_type(), so no dataset recreation is needed here.

Parameters
ncidNetCDF file identifier.
varidVariable id.
quantize_modeNC_NOQUANTIZE, NC_QUANTIZE_BITGROOM, NC_QUANTIZE_GRANULARBR or NC_QUANTIZE_BITROUND.
nsdNumber of significant digits.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_def_vlen()

int NXCDF_def_vlen ( int ncid,
const char * name,
nc_type base_typeid,
nc_type * typeidp )

Define a variable-length type — the nc_def_vlen() dispatch entry.

Define a variable-length type.

A vlen variable stores a different number of elements per datum (nc_vlen_t handles in memory, heap-allocated on disk). The base type may be any supported atomic type except NC_STD_REF, or a visible user-defined type — compounds, enums, opaques and other vlens all nest.

When the base is still uncommitted (a compound whose fields may still grow), the vlen's datatype stays transient and commit is deferred to _enddef, where commit_type_tree() commits the base first and rebuilds the vlen around it; vlens over committed bases commit immediately, like opaques.

The public nc_vlen_t descriptor and HDF5's hvl_t must have the same layout — I/O moves descriptors verbatim.

Parameters
ncidNetCDF file identifier.
nameType name.
base_typeidBase type of the vlen elements.
typeidpDestination for the new type id.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_del_att()

int NXCDF_del_att ( int ncid,
int varid,
const char * name )

Delete an attribute from a group or variable.

Delete an attribute.

Parameters
ncidNetCDF file identifier.
varidVariable id or NC_GLOBAL.
nameAttribute name.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ nxcdf_file_type()

int nxcdf_file_type ( NC_GRP_INFO_T * grp,
nc_type xtype,
hid_t * typep )

Produce an owned HDF5 datatype with the type's file layout.

Produce an owned HDF5 file datatype for an atomic or user type.

Atomic types map through NXCDF_map_hdf_type(); user-defined types copy the record's committed (or still-transient) HDF5 datatype so the dataset or attribute links to the named type. The caller owns the returned handle and must H5Tclose it.

Parameters
grpGroup the type is being used from.
xtypeType id.
typepDestination for an owned HDF5 datatype.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ nxcdf_find_type()

int nxcdf_find_type ( NC_GRP_INFO_T * grp,
nc_type xtype,
NC_TYPE_INFO_T ** typep )

Find the user-defined type record an nc_type id refers to.

Type visibility flows downward in the enhanced model: a type defined in a group is usable in that group and its descendants, never in siblings or ancestors. The search therefore walks the group and its ancestors only; the returned record is borrowed — the caller must not free it or alter its reference count.

Parameters
grpGroup the type is being used from.
xtypeType id (must be NC_FIRSTUSERTYPEID or above).
typepDestination for the borrowed record.
Returns
NC_NOERR on success, NC_EBADTYPE for an atomic id, or NC_EBADTYPID when no visible user type has the id.

◆ nxcdf_find_var_for_write()

int nxcdf_find_var_for_write ( int ncid,
int varid,
NC_FILE_INFO_T ** h5,
NXCDF_FILE_INFO_T ** file,
NC_GRP_INFO_T ** grp,
NC_VAR_INFO_T ** var )

Common prologue for the def-var setter dispatch functions.

Resolve a variable for a def-var setter, enforcing write + define-mode access.

Resolves the variable and file state and checks define-mode write access, so each setter only validates its own arguments.

Parameters
ncidNetCDF file identifier.
varidVariable identifier.
h5Destination for the NetCDF-4 file state.
fileDestination for the nxCDF file state.
grpDestination for the group.
varDestination for the variable.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ nxcdf_flush_pending_atts()

int nxcdf_flush_pending_atts ( NC_GRP_INFO_T * grp)

Materialize attributes deferred while their datatype or dataset was pending — called at _enddef.

Materialize attributes deferred on pending types or datasets at _enddef.

Attributes whose datatype was an uncommitted user type, or that live on a user-typed variable whose dataset did not exist yet, are marked atts_pending on the owning group/variable. Once NXCDF_write_types() and the deferred dataset creations have run, this rewrites the pending objects' attribute lists in index order, preserving definition order on disk.

Parameters
grpGroup to walk (recursively).
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_free_file()

int NXCDF_free_file ( NXCDF_FILE_INFO_T * file)

Close a NXCDF_FILE_INFO_T's HDF5 handles and free it.

Close HDF5 identifiers and free per-file state.

Companion to NXCDF_add_file(): closes the root group and the HDF5 file, then releases the path and the struct. Safe to call with NULL. The H5Fget_obj_count log line is a leak check — anything but 1 (the file itself) after H5Fclose means an object was left open.

Parameters
fileState to release; may be NULL.
Returns
NC_NOERR or NC_EHDFERR if an HDF5 close fails.

◆ nxcdf_free_type_info()

void nxcdf_free_type_info ( NC_TYPE_INFO_T * type)

Release a type's nxCDF-private record and its HDF5 datatype handle, if any.

Release a type's nxCDF-private record and HDF5 datatype handle.

nc4_type_free() knows nothing about format_type_info, so every definition failure path and the file-close walk must dispose of it separately. Safe on a type with no private record.

Parameters
typeIn-memory type record.

◆ NXCDF_get_att()

int NXCDF_get_att ( int ncid,
int varid,
const char * name,
void * value,
nc_type memtype )

Read an attribute's value — the nc_get_att_* dispatch entry.

Get an attribute from the root group or a variable.

Reads from the in-memory record (all attributes were loaded at open), converting through nxcdf_convert_type() when the caller asks for a different type. NC_STRING attributes return strdup'd strings the caller owns.

Parameters
ncidNetCDF file identifier.
varidVariable id or NC_GLOBAL.
nameAttribute name.
valueDestination buffer.
memtypeRequested in-memory type.
Returns
NC_NOERR on success, NC_ERANGE when data was delivered but overflowed, or a NetCDF error code.

◆ nxcdf_get_att_special()

int nxcdf_get_att_special ( NXCDF_FILE_INFO_T * file,
const char * name,
nc_type * xtypep,
nc_type mem_type,
size_t * lenp,
int * attnump,
void * data )

Answer a name lookup for a provenance attribute.

Answer a name lookup for a stored or virtual provenance attribute.

nxCDF's nc4_get_att_special equivalent: _NCProperties is answered from the in-memory copy (built at create or read at open), while _IsNetcdf4 and _SuperblockVersion are synthesized — they exist only as answers to name lookups, never as stored attributes and never in nc_inq_natts/nc_inq_attname results.

Parameters
fileOpen nxCDF state.
nameAttribute name.
xtypepOptional destination for the file type.
mem_typeRequested in-memory type (NC_NAT allowed).
lenpOptional destination for the attribute length.
attnumpNon-NULL asks for the attribute's index, which virtual attributes do not have.
dataOptional destination for the attribute's value.
Returns
NC_NOERR on success, NC_EATTMETA for an attnum inquiry, NC_ENOTATT when the attribute does not exist, NC_ECHAR for a non-character read of _NCProperties, NC_ERANGE for a non-integer memtype of the integer attributes, or a NetCDF error code.

◆ NXCDF_get_file()

int NXCDF_get_file ( int ncid,
NC_FILE_INFO_T ** h5p,
NXCDF_FILE_INFO_T ** filep )

Resolve both the shared and nxCDF-private file state for an ncid.

Resolve registered nxCDF state from a NetCDF identifier.

Almost every dispatch entry begins here: nc4_find_grp_h5 maps the ncid to netcdf-c's NC_FILE_INFO_T, and format_file_info then yields the NXCDF_FILE_INFO_T. A missing private record means the ncid names a non-nxCDF file.

Parameters
ncidNetCDF file identifier.
h5pOptional destination for common NetCDF-4 state.
filepOptional destination for nxCDF state.
Returns
NC_NOERR on success, or NC_EBADID for invalid state.

◆ NXCDF_get_type_size()

int NXCDF_get_type_size ( nc_type xtype,
size_t * sizep )

Return the in-memory size of an atomic type — a thin public wrapper over NXCDF_type_size().

Parameters
xtypeNetCDF atomic type.
sizepDestination for the size.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_get_var_chunk_cache()

int NXCDF_get_var_chunk_cache ( int ncid,
int varid,
size_t * sizep,
size_t * nelemsp,
float * preemptionp )

Inquire effective live chunk-cache settings or pending requests.

Inquire effective live chunk-cache settings or pending requests.

Parameters
ncidFile or group identifier.
varidVariable identifier within the group.
sizepOptional byte-capacity destination.
nelemspOptional hash-slot destination.
preemptionpOptional preemption destination.
Returns
NC_NOERR or an identifier/HDF5 error.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ NXCDF_get_vara()

int NXCDF_get_vara ( int ncid,
int varid,
const size_t * start,
const size_t * count,
void * value,
nc_type memtype )

Read a hyperslab — the nc_get_vara_* dispatch entry.

Fixed-size atomic variable hyperslab I/O callbacks.

Parameters
ncidNetCDF file identifier.
varidVariable id.
startHyperslab start indices.
countHyperslab counts.
valueDestination buffer.
memtypeNetCDF atomic memory type.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_get_varm()

int NXCDF_get_varm ( int ncid,
int varid,
const size_t * s,
const size_t * c,
const ptrdiff_t * st,
const ptrdiff_t * im,
void * v,
nc_type t )

Mapped hyperslab read (nc_get_varm_*); not implemented.

Read a mapped hyperslab of a variable.

varm calls add a memory-layout mapping to the strided selection. The feature is deprecated upstream and deliberately unimplemented here; every call returns NC_ENOTBUILT.

Parameters
ncidNetCDF file identifier.
varidVariable id.
sHyperslab start indices.
cHyperslab counts.
stHyperslab strides.
imMemory mapping offsets.
vDestination buffer.
tNetCDF atomic memory type.
Returns
NC_ENOTBUILT always.

◆ NXCDF_get_vars()

int NXCDF_get_vars ( int ncid,
int varid,
const size_t * start,
const size_t * count,
const ptrdiff_t * stride,
void * value,
nc_type memtype )

Read a strided hyperslab — the nc_get_vars_* dispatch entry.

Read a strided hyperslab of a variable.

Parameters
ncidNetCDF file identifier.
varidVariable id.
startHyperslab start indices.
countHyperslab counts.
strideHyperslab strides.
valueDestination buffer.
memtypeNetCDF atomic memory type.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_get_vlen_element()

int NXCDF_get_vlen_element ( int ncid,
int typeid,
const void * vlen_element,
size_t * lenp,
void * data )

Read a vlen element value — the nc_get_vlen_element() dispatch entry.

Read a vlen element value.

Reports the descriptor's element count and copies the payload into the caller's buffer using the base type's real in-memory size. The copy is shallow: for a vlen whose base is itself dynamic (a nested vlen, or a compound containing vlen members) the copied descriptors still alias the source element's inner payloads. Those aliases must not be reclaimed independently — callers wanting an owned deep copy use nc_copy_data().

Parameters
ncidNetCDF file identifier.
typeidVlen type id.
vlen_elementSource nc_vlen_t descriptor.
lenpDestination for the element count (required).
dataDestination for the element data (required when the descriptor is non-empty).
Returns
NC_NOERR on success, or a NetCDF error code.

◆ nxcdf_hdf_type_match()

int nxcdf_hdf_type_match ( NC_GRP_INFO_T * grp,
hid_t htype,
NC_TYPE_INFO_T ** typep )

Resolve an HDF5 datatype to a registered committed user type by object identity.

Resolve an HDF5 datatype to a registered committed user type by object identity.

Datasets and attributes created from a committed datatype keep a reference to that named object; comparing the HDF5 object token of htype against every committed type visible from grp (the group and its ancestors) recovers the exact NC_TYPE_INFO_T — matching on H5Tequal alone would conflate distinct named types with equal shapes.

Parameters
grpGroup the datatype is being used from.
htypeHDF5 datatype (need not be committed itself).
typepDestination for the borrowed type record.
Returns
NC_NOERR on success, NC_EBADTYPID when no visible committed type is the same object.

◆ NXCDF_inq_att()

int NXCDF_inq_att ( int ncid,
int varid,
const char * name,
nc_type * xtypep,
size_t * lenp )

Inquire about an attribute — the nc_inq_att() dispatch entry.

Inquire about an attribute's type and length.

Stock NC4_inq_att resolves att->nc_typeid through nc4_find_type(), which knows only stock atomic typeids and the file's user-defined types — NEP atomic types (float16, bitfield, NC_STD_REF, ...) all fail there. This version returns the stored typeid directly, so nc_inq_att() and the generic nc_get_att() work for NEP types.

Parameters
ncidNetCDF file identifier.
varidVariable id or NC_GLOBAL.
nameAttribute name.
xtypepDestination for the attribute's type, or NULL.
lenpDestination for the attribute's length, or NULL.
Returns
NC_NOERR on success, NC_ENOTATT when the attribute does not exist, or a NetCDF error code.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ NXCDF_inq_attid()

int NXCDF_inq_attid ( int ncid,
int varid,
const char * name,
int * attnump )

Learn an attribute's index by name — the nc_inq_attid() dispatch entry.

Learn an attribute's index by name.

The shared NC4_inq_attid cannot intercept the provenance names, which live outside the attribute index; this entry answers them with upstream's NC_EATTMETA (virtual attributes have no index) and otherwise returns the attribute's position in the index.

Parameters
ncidNetCDF file identifier.
varidVariable id or NC_GLOBAL.
nameAttribute name.
attnumpDestination for the attribute index.
Returns
NC_NOERR on success, NC_EATTMETA for a provenance name, NC_ENOTATT when the attribute does not exist, or a NetCDF error code.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ NXCDF_inq_compound_field()

int NXCDF_inq_compound_field ( int ncid,
nc_type typeid,
int fieldid,
char * name,
size_t * offsetp,
nc_type * fieldtypep,
int * ndimsp,
int * dim_sizesp )

Inquire a field of a compound type — the nc_inq_compound_field() dispatch entry.

Inquire a field of a compound type.

Parameters
ncidNetCDF file identifier.
typeidCompound type id.
fieldidField index.
nameDestination for the field name.
offsetpDestination for the field offset.
fieldtypepDestination for the field type.
ndimspDestination for the field rank.
dim_sizespDestination for the field dimension sizes.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_compound_fieldindex()

int NXCDF_inq_compound_fieldindex ( int ncid,
nc_type typeid,
const char * name,
int * fieldidxp )

Get a compound field's index by name — the nc_inq_compound_fieldindex() dispatch entry.

Get a compound field's index by name.

Parameters
ncidNetCDF file identifier.
typeidCompound type id.
nameField name.
fieldidxpDestination for the field index.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_dim()

int NXCDF_inq_dim ( int ncid,
int dimid,
char * name,
size_t * lenp )

Inquire about a dimension — the nc_inq_dim() dispatch entry.

Inquire a dimension by id.

Answers from the in-memory tree; for an unlimited dimension lenp is the current length.

Parameters
ncidNetCDF file identifier.
dimidDimension id.
nameDestination for the dimension name.
lenpDestination for the dimension length.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_enum_ident()

int NXCDF_inq_enum_ident ( int ncid,
nc_type typeid,
long long value,
char * identifier )

Get an enum member name by value — the nc_inq_enum_ident() dispatch entry.

Get an enum member name by value.

Parameters
ncidNetCDF file identifier.
typeidEnum type id.
valueMember value.
identifierDestination for the member name.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_enum_member()

int NXCDF_inq_enum_member ( int ncid,
nc_type typeid,
int idx,
char * name,
void * value )

Inquire an enum member by index — the nc_inq_enum_member() dispatch entry.

Inquire an enum member by index.

Parameters
ncidNetCDF file identifier.
typeidEnum type id.
idxMember index.
nameDestination for the member name.
valueDestination for the member value.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_filter_avail()

int NXCDF_inq_filter_avail ( int ncid,
unsigned int id )

Test whether an HDF5 filter is available — the nc_inq_filter_avail() dispatch entry.

Test whether an HDF5 filter is available.

Parameters
ncidNetCDF file identifier (ignored; availability is process-wide).
idHDF5 filter identifier.
Returns
NC_NOERR when available, NC_ENOFILTER when not, or a NetCDF error code.

◆ NXCDF_inq_format()

int NXCDF_inq_format ( int ncid,
int * formatp )
extern

Dispatch-table entry behind nc_inq_format(): reports NC_FORMAT_NETCDF4 — nxCDF files are in the NetCDF-4/HDF5 family.

Dispatch-table entry behind nc_inq_format(): reports NC_FORMAT_NETCDF4 — nxCDF files are in the NetCDF-4/HDF5 family.

nxCDF files report as NC_FORMAT_NETCDF4: they are HDF5 files in the NetCDF-4 family, distinguishable only through nc_inq_format_extended().

Parameters
ncidNetCDF file identifier.
formatpOptional destination for NC_FORMAT_NETCDF4.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_format_extended()

int NXCDF_inq_format_extended ( int ncid,
int * formatp,
int * modep )
extern

Dispatch-table entry behind nc_inq_format_extended(): reports NC_FORMATX_NXCDF and the effective mode flags.

Dispatch-table entry behind nc_inq_format_extended(): reports NC_FORMATX_NXCDF and the effective mode flags.

Returns NC_FORMATX_NXCDF plus the mode the file actually runs with: the create/open flags plus NC_NXCDF and, for files carrying the _NxcdfModel marker, NC_NETCDF4_MODEL.

Parameters
ncidNetCDF file identifier.
formatpOptional destination for NC_FORMATX_NXCDF.
modepOptional destination for the effective open/create mode.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_grp_full_ncid()

int NXCDF_inq_grp_full_ncid ( int ncid,
const char * full_name,
int * grpidp )

Get the ncid of a group given its full path — the nc_inq_grp_full_ncid() dispatch entry.

Get the ncid of a group given its full path.

NXCDF_inq_ncid() already accepts absolute paths, so this is a straight delegation.

Parameters
ncidNetCDF file identifier.
full_nameFull group path.
grpidpDestination for the group ncid.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_grp_parent()

int NXCDF_inq_grp_parent ( int ncid,
int * parentidp )

Get a group's parent ncid — the nc_inq_grp_parent() dispatch entry.

Get a group's parent ncid.

Parameters
ncidNetCDF file identifier.
parentidpDestination for the parent ncid.
Returns
NC_NOERR on success, NC_ENOGRP for the root group, or another NetCDF error code.

◆ NXCDF_inq_grpname()

int NXCDF_inq_grpname ( int ncid,
char * name )

Get a group's (short) name — the nc_inq_grpname() dispatch entry.

Get a group's name.

Parameters
ncidNetCDF file identifier.
nameDestination for the group name.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_grpname_full()

int NXCDF_inq_grpname_full ( int ncid,
size_t * lenp,
char * name )

Get a group's full path name — the nc_inq_grpname_full() dispatch entry.

Get a group's full path name.

Rebuilds "/g1/g2/..." by walking the parent chain up to the root; the root group itself contributes nothing but the leading slash. Nesting is capped at 32 levels.

Parameters
ncidNetCDF file identifier.
lenpDestination for the name length.
nameDestination for the full group name.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_grps()

int NXCDF_inq_grps ( int ncid,
int * numgrps,
int * grpidsp )

Get the ncids of all subgroups — the nc_inq_grps() dispatch entry.

Get the ncids of all subgroups.

Parameters
ncidNetCDF file identifier.
numgrpsDestination for the number of subgroups.
grpidspDestination for the subgroup ncids.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_ncid()

int NXCDF_inq_ncid ( int ncid,
const char * name,
int * grpidp )

Get the ncid of a named subgroup — the nc_inq_ncid() dispatch entry.

Get the ncid of a named subgroup.

name may be a simple name ("g1"), a relative path ("g1/g2"), or an absolute path ("/g1/g2"); "/" alone resolves to the root group. The lookup walks the in-memory group tree component by component — no HDF5 calls are needed because the metadata was fully loaded at open.

Parameters
ncidNetCDF file identifier.
nameSubgroup name or path.
grpidpDestination for the subgroup ncid.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_type_equal()

int NXCDF_inq_type_equal ( int ncid1,
nc_type typeid1,
int ncid2,
nc_type typeid2,
int * equalp )

Compare two types for equality — the nc_inq_type_equal() dispatch entry.

Compare two types for equality.

Two types count as equal when they are the same in-memory record or structurally equal: same class, size and member layout/base/member values, recursively for nested members.

Parameters
ncid1NetCDF file identifier of the first type.
typeid1First type id.
ncid2NetCDF file identifier of the second type.
typeid2Second type id.
equalpDestination for the nonzero-if-equal flag.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_typeid()

int NXCDF_inq_typeid ( int ncid,
const char * name,
nc_type * typeidp )

Get a type's id by name — the nc_inq_typeid() dispatch entry.

Get a type's id by name.

Type names are visible file-wide in netCDF semantics; the lookup recurses through the group tree via netcdf-c's nc4_rec_find_named_type.

Parameters
ncidNetCDF file identifier.
nameType name.
typeidpDestination for the type id.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_typeids()

int NXCDF_inq_typeids ( int ncid,
int * ntypes,
int * typeids )

Get the type ids of the user-defined types in a group — the nc_inq_typeids() dispatch entry.

Get the typeids of user-defined types in a group.

Parameters
ncidNetCDF file identifier.
ntypesDestination for the number of types.
typeidsDestination for the type ids.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_user_type()

int NXCDF_inq_user_type ( int ncid,
nc_type typeid,
char * name,
size_t * sizep,
nc_type * base_typep,
size_t * nfieldsp,
int * classp )

Inquire a user-defined type — the nc_inq_user_type() dispatch entry.

Inquire a user-defined type.

Parameters
ncidNetCDF file identifier.
typeidType id.
nameDestination for the type name.
sizepDestination for the type size.
base_typepDestination for the base type id.
nfieldspDestination for the number of fields/members.
classpDestination for the type class.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_var()

int NXCDF_inq_var ( int ncid,
int varid,
char * name,
nc_type * xtypep,
int * ndimsp,
int * dimidsp,
int * nattsp )

Inquire about a variable's name, type, dimensions, and attributes — the nc_inq_var() dispatch entry.

Inquire a variable by id.

Parameters
ncidNetCDF file identifier.
varidVariable id.
nameDestination for the variable name.
xtypepDestination for the variable type.
ndimspDestination for the rank.
dimidspDestination for the dimension ids.
nattspDestination for the number of attributes.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_var_all()

int NXCDF_inq_var_all ( int ncid,
int varid,
char * name,
nc_type * xtypep,
int * ndimsp,
int * dimidsp,
int * nattsp,
int * shufflep,
int * deflatep,
int * deflate_levelp,
int * fletcher32p,
int * contiguousp,
size_t * chunksizesp,
int * no_fillp,
void * fill_valuep,
int * endiannessp,
unsigned int * idp,
size_t * nparamsp,
unsigned int * params )

Inquire about all supported properties of a variable — the nc_inq_var_all() dispatch entry.

Inquire all metadata and storage properties of a variable.

The kitchen-sink inquiry used internally by netcdf-c; every output pointer is optional. The idp/nparamsp/params filter outputs are never populated — upstream's shared NC4_inq_var_all doesn't populate them either; filter inquiry goes through nc_inq_var_filter_ids()/nc_inq_var_filter_info().

Parameters
ncidNetCDF file identifier.
varidVariable id.
nameDestination for the variable name.
xtypepDestination for the variable type.
ndimspDestination for the rank.
dimidspDestination for the dimension ids.
nattspDestination for the number of attributes.
shufflepDestination for the shuffle flag.
deflatepDestination for the deflate flag.
deflate_levelpDestination for the deflate level.
fletcher32pDestination for the Fletcher32 flag.
contiguouspDestination for the contiguous-storage flag.
chunksizespDestination for the chunk sizes.
no_fillpDestination for the no-fill flag.
fill_valuepDestination for the fill value.
endiannesspDestination for the endianness.
idpDestination for the filter ids.
nparamspDestination for the filter parameter count.
paramsDestination for the filter parameters.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_var_filter_ids()

int NXCDF_inq_var_filter_ids ( int ncid,
int varid,
size_t * nfiltersp,
unsigned int * ids )

Inquire the filter ids applied to a variable — the nc_inq_var_filter_ids() dispatch entry.

Get the filter IDs applied to a variable.

Reports the pipeline in order. NC_NOERR with a count of zero is returned for a filterless variable, matching upstream.

Parameters
ncidNetCDF file identifier.
varidVariable id.
nfilterspDestination for the number of filters.
idsDestination for the filter ids, or NULL for count only.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_inq_var_filter_info()

int NXCDF_inq_var_filter_info ( int ncid,
int varid,
unsigned int id,
size_t * nparamsp,
unsigned int * params )

Inquire the parameters of one variable filter — the nc_inq_var_filter_info() dispatch entry.

Get the parameters of one filter on a variable.

Parameters
ncidNetCDF file identifier.
varidVariable id.
idFilter identifier to inquire about.
nparamspDestination for the number of filter parameters.
paramsDestination for the filter parameter values.
Returns
NC_NOERR on success, NC_ENOFILTER when the filter is not applied, or a NetCDF error code.

◆ NXCDF_insert_array_compound()

int NXCDF_insert_array_compound ( int ncid,
nc_type typeid,
const char * name,
size_t offset,
nc_type xtype,
int ndims,
const int * dim_sizesp )

Insert a scalar or fixed-size array field into a compound type — the nc_insert_array_compound() dispatch entry.

Insert an array field into a compound type.

Members may be supported atomic types (excluding NC_STD_REF) or visible user-defined types, including strings and dynamic nesting. Validation happens entirely before H5Tinsert and the metadata update, so a rejected call changes nothing.

Parameters
ncidNetCDF file identifier.
typeidCompound type id.
nameField name.
offsetField offset in bytes.
xtypeNetCDF type of the field elements.
ndimsNumber of array dimensions; 0 inserts a scalar.
dim_sizespArray dimension sizes (required when ndims>0).
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_insert_compound()

int NXCDF_insert_compound ( int ncid,
nc_type typeid,
const char * name,
size_t offset,
nc_type xtype )

Insert a scalar field into a compound type — the nc_insert_compound() dispatch entry.

Insert a scalar field into a compound type.

Thin wrapper over NXCDF_insert_array_compound() with rank zero, matching upstream's delegation.

Parameters
ncidNetCDF file identifier.
typeidCompound type id.
nameField name.
offsetField offset in bytes.
xtypeNetCDF type of the field.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_insert_enum()

int NXCDF_insert_enum ( int ncid,
nc_type typeid,
const char * name,
const void * value )

Insert a member into an enum type — the nc_insert_enum() dispatch entry.

Insert a member into an enum type.

The member value arrives as raw bytes in the enum's base type; it is widened to long long for H5Tenum_insert and stored byte-for-byte in the in-memory record.

Parameters
ncidNetCDF file identifier.
typeidEnum type id.
nameMember name.
valueMember value.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ nxcdf_load_filters()

int nxcdf_load_filters ( hid_t dcpl,
NC_VAR_INFO_T * var,
NXCDF_VAR_INFO_T * vinfo )

Read a variable's filter pipeline from a dataset creation property list.

Read a variable's filter pipeline from a dataset creation property list into var->filters.

Port of upstream get_filter_info() (libhdf5/hdf5open.c): every filter in the DCPL is recorded on var->filters in order, with its stored parameters — even when the filter plugin is unavailable, so metadata stays readable. An unavailable filter marks the spec and the variable NC_HDF5_VAR_FILTER_MISSING (data reads then fail with NC_ENOFILTER); a mandatory filter on a variable-sized type marks the variable the same way. Deflate's parameters are validated, and szip's HDF5-expanded 4-parameter form is folded back to the 2 netcdf-c reports.

Parameters
dcplDataset creation property list identifier.
varVariable.
vinfonxCDF variable state (flags destination).
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_load_metadata()

int NXCDF_load_metadata ( NXCDF_FILE_INFO_T * file,
NC_FILE_INFO_T * h5 )

Load all metadata for an open nxCDF file — the entry point NXCDF_open() calls after checking the marker attributes.

Load all root-group metadata from an open HDF5 file.

Recursively walks the HDF5 file starting at the root group and rebuilds the complete NC_*_INFO_T tree (groups, dimensions, variables, attributes, committed types) that the dispatch entries then operate on. See nxCDF Architecture.

Parameters
fileOpen nxCDF state.
h5Common NetCDF-4 file metadata.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_map_hdf_type()

int NXCDF_map_hdf_type ( nc_type xtype,
hid_t * typep )

Map an atomic nc_type to its on-disk HDF5 datatype.

Map a fixed-size NetCDF atomic type to its HDF5 datatype.

Every netCDF atomic type is stored as a copy of an HDF5 predefined type — little-endian for numerics so files are architecture-independent. The mapping covers the standard types (NC_BYTE…NC_DOUBLE, NC_CHAR, NC_STRING) plus nxCDF's extended set: NC_FLOAT16, NC_BFLOAT16, the HDF5 2.x small floats (FP8/FP6/FP4), complex, bitfields, and the reference type NC_STD_REF. The caller owns the returned hid_t and must H5Tclose it. The inverse mapping (disk → nc_type) is map_nc_type().

Parameters
xtypeNetCDF atomic type.
typepDestination for an HDF5 datatype identifier.
Returns
NC_NOERR or NC_EBADTYPE.

◆ NXCDF_memory_type()

hid_t NXCDF_memory_type ( nc_type type,
int * closep )

Map a netCDF atomic type to the HDF5 datatype describing the caller's memory buffer.

Map an atomic memory type to HDF5.

H5Dread/H5Dwrite take a "memory datatype" describing the layout of the buffer in RAM — this is what lets HDF5 convert on the fly (for example nc_get_vara_float on an NC_SHORT variable). Most netCDF types map to a predefined H5T_NATIVE_* constant that must not be closed; types with no native constant (NC_CHAR, small floats, strings, references) are produced by H5Tcopy of a base type, and the caller owns the copy — closep says which.

NC_BFLOAT16 copies little-endian bfloat16 and then adopts the machine's uint16 byte order, because HDF5 2.1.1 has no native-order bfloat16 constant. NC_CHAR is a fixed-length 1-byte string; NC_STRING is a variable-length string.

Parameters
typeNetCDF atomic type (the nc_type of the memory buffer).
closepSet nonzero when the returned type must be closed with H5Tclose(); may be NULL.
Returns
HDF5 memory datatype, or negative on error.

◆ nxcdf_memory_type()

int nxcdf_memory_type ( NC_GRP_INFO_T * grp,
nc_type xtype,
hid_t * typep )

Produce an owned HDF5 memory datatype for any supported type.

Produce an owned HDF5 memory datatype for an atomic or user type.

Atomic types delegate to NXCDF_memory_type(); ids at or above NC_FIRSTUSERTYPEID resolve through nxcdf_find_type() and build the memory layout described by user_mem_type(). The caller owns the returned handle and must H5Tclose it.

Parameters
grpGroup the type is being used from.
xtypeType id.
typepDestination for an owned HDF5 datatype.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_open()

int NXCDF_open ( const char * path,
int mode,
int basepe,
size_t * chunksizehintp,
void * parameters,
const NC_Dispatch * dispatch,
int ncid )
extern

Dispatch-table entry behind nc_open() with NC_NXCDF: opens the HDF5 file, validates the marker attributes and loads all metadata.

Dispatch-table entry behind nc_open() with NC_NXCDF: opens the HDF5 file, validates the marker attributes and loads all metadata.

This is the dispatch-table entry netcdf-c calls when a user calls nc_open() with NC_NXCDF in the mode flags. The file must already exist and be a real HDF5 file: nxCDF files are ordinary HDF5 files carrying a small set of hidden bookkeeping attributes, so H5Fis_hdf5() is used as the file-type check.

The function registers the file's in-memory state (NXCDF_FILE_INFO_T), opens the HDF5 file and its root group, verifies the _NxcdfBackend marker attribute, and finally calls NXCDF_load_metadata() to rebuild the netCDF metadata tree (dimensions, variables, attributes, types) by walking the HDF5 contents. See nxCDF Architecture for the big picture.

Parameters
pathFile-system path to open.
modeNetCDF open-mode flags (NC_WRITE selects read/write).
basepeBase processing element; currently ignored.
chunksizehintpChunk-size hint; currently ignored.
parametersNon-NULL when the user called nc_open_par(): points at an NXCDF_MPI_INFO carrying the MPI communicator and info handle. nc_open_par() imposes no extra mode flag beyond NC_NXCDF.
dispatchDispatch table selected by netcdf-c.
ncidNetCDF file identifier allocated by netcdf-c.
Returns
NC_NOERR on success, NC_ENOTNC if path is missing or not HDF5, NC_EINVAL for a bad path, NC_ENOPAR for a parallel request when nxCDF was built without parallel support, NC_EPARINIT when the MPI-IO driver cannot be set, or another NetCDF error code.

◆ NXCDF_put_att()

int NXCDF_put_att ( int ncid,
int varid,
const char * name,
nc_type datatype,
size_t len,
const void * value,
nc_type memtype )

Create or replace an attribute — the nc_put_att_* dispatch entry.

Put an attribute on the root group or a variable.

Converts the value from the caller's memory type to the attribute's storage type through nxcdf_convert_type() (overflow returns NC_ERANGE after the write), replaces any same-named attribute in both the in-memory index and HDF5, and persists immediately — attributes are written to the file in define mode, not deferred to _enddef. Reserved (internal) names are rejected.

Parameters
ncidNetCDF file identifier.
varidVariable id or NC_GLOBAL.
nameAttribute name.
datatypeNetCDF atomic type.
lenNumber of elements.
valueAttribute data.
memtypeIn-memory type for the attribute value.
Returns
NC_NOERR on success, NC_ERANGE when the value was written but overflowed during conversion, or a NetCDF error code.

◆ NXCDF_put_vara()

int NXCDF_put_vara ( int ncid,
int varid,
const size_t * start,
const size_t * count,
const void * value,
nc_type memtype )

Write a hyperslab — the nc_put_vara_* dispatch entry.

Write a hyperslab of a variable.

Parameters
ncidNetCDF file identifier.
varidVariable id.
startHyperslab start indices.
countHyperslab counts.
valueSource buffer.
memtypeNetCDF atomic memory type.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_put_varm()

int NXCDF_put_varm ( int ncid,
int varid,
const size_t * s,
const size_t * c,
const ptrdiff_t * st,
const ptrdiff_t * im,
const void * v,
nc_type t )

Mapped hyperslab write (nc_put_varm_*); not implemented.

Write a mapped hyperslab of a variable.

See NXCDF_get_varm(): always returns NC_ENOTBUILT.

Parameters
ncidNetCDF file identifier.
varidVariable id.
sHyperslab start indices.
cHyperslab counts.
stHyperslab strides.
imMemory mapping offsets.
vSource buffer.
tNetCDF atomic memory type.
Returns
NC_ENOTBUILT always.

◆ NXCDF_put_vars()

int NXCDF_put_vars ( int ncid,
int varid,
const size_t * start,
const size_t * count,
const ptrdiff_t * stride,
const void * value,
nc_type memtype )

Write a strided hyperslab — the nc_put_vars_* dispatch entry.

Write a strided hyperslab of a variable.

Parameters
ncidNetCDF file identifier.
varidVariable id.
startHyperslab start indices.
countHyperslab counts.
strideHyperslab strides.
valueSource buffer.
memtypeNetCDF atomic memory type.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_put_vlen_element()

int NXCDF_put_vlen_element ( int ncid,
int typeid,
void * vlen_element,
size_t len,
const void * data )

Write a vlen element value — the nc_put_vlen_element() dispatch entry.

Write a vlen element value.

Fills the caller's nc_vlen_t descriptor with the element count and a borrowed pointer to data — nothing is copied and no ownership is taken. The payload must stay valid until the write it feeds (typically nc_put_vara) has completed.

Parameters
ncidNetCDF file identifier.
typeidVlen type id.
vlen_elementDestination nc_vlen_t descriptor.
lenNumber of elements.
dataElement data (required when len is nonzero).
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_read_markers()

int NXCDF_read_markers ( NXCDF_FILE_INFO_T * file)

Read and validate the hidden marker attributes at open.

Read and validate nxCDF provenance and compatibility markers.

Sets file->backend_marked when _NxcdfBackend matches "nxCDF/1.0", and restores netcdf4_model/NC_NETCDF4_MODEL when _NxcdfModel is present. A file without the backend marker is treated as a plain HDF5/netCDF-4 file and opened anyway — nxCDF can read upstream netCDF-4 files.

Parameters
fileOpen nxCDF state.
Returns
NC_NOERR on success, or NC_EFILEMETA for invalid markers.

◆ nxcdf_read_ncproperties()

int nxcdf_read_ncproperties ( NXCDF_FILE_INFO_T * file)

Read an existing _NCProperties attribute at open.

Read an existing _NCProperties attribute into file state.

Populates file->ncproperties when the root group carries the attribute. A missing or malformed attribute is tolerated — the field stays NULL, matching upstream's "invalid attribute: ignored" leniency.

Parameters
fileOpen nxCDF state.
Returns
NC_NOERR on success, or NC_ENOMEM.

◆ NXCDF_redef()

int NXCDF_redef ( int ncid)

Return the file to define mode — the nc_redef() dispatch entry.

Return the file to define mode.

Flips define_mode and netcdf-c's NC_INDEF flag; the next _enddef writes any newly defined metadata to HDF5.

Parameters
ncidNetCDF file identifier.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ nxcdf_ref_file()

int nxcdf_ref_file ( int ncid,
NC_FILE_INFO_T ** h5p,
NXCDF_FILE_INFO_T ** filep )

Map a public ncid to the internal file state, rejecting any file not opened through the nxCDF backend.

Map a public ncid to internal file state, rejecting non-nxCDF files with NC_ENOTNC4 (shared by nxcdf_ref.c and nxcdf_remoteref.c).

Every public reference function takes an opaque integer NetCDF file ID. This helper turns it into the two structures the reference code works on:

  • NC_FILE_INFO_T — the generic netCDF-4 in-memory metadata tree (group/variable/type indexes) that obj_ids() walks to map an opened HDF5 object back to a NetCDF group ncid, varid, or typeid.
  • NXCDF_FILE_INFO_T — the backend's per-file state holding the HDF5 handles (hdfid, rootid), open mode, and SWMR flags.

The ncid is rejected with NC_ENOTNC4 when it belongs to another dispatch backend (an upstream NetCDF-4 or NetCDF-3 file, another NEP UDF handler, etc.): the dispatch-table pointer must be NXCDF_dispatch_table and format_file_info must be present, so a foreign file fails cleanly instead of being dereferenced as garbage.

Parameters
ncidNetCDF file ID.
h5pDestination for NC_FILE_INFO_T, or NULL.
filepDestination for NXCDF_FILE_INFO_T, or NULL.
Returns
NC_NOERR on success, NC_ENOTNC4 for a non-nxCDF file, or the underlying lookup error.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ NXCDF_rename_att()

int NXCDF_rename_att ( int ncid,
int varid,
const char * name,
const char * newname )

Rename an attribute — the nc_rename_att() dispatch entry.

Rename an attribute.

HDF5 attributes cannot be renamed in place, so the old attribute is deleted and the value rewritten under the new name via NXCDF_put_att(); the in-memory index is rebuilt by delete-and-re-add for the same reason.

Parameters
ncidNetCDF file identifier.
varidVariable id or NC_GLOBAL.
nameCurrent attribute name.
newnameNew attribute name.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_rename_dim()

int NXCDF_rename_dim ( int ncid,
int dimid,
const char * name )

Rename a dimension and update its HDF5 link.

Rename a dimension.

Parameters
ncidNetCDF file identifier.
dimidDimension id.
nameNew dimension name.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_rename_grp()

int NXCDF_rename_grp ( int grpid,
const char * name )

Rename a non-root enhanced-model group and flush its link.

Rename a non-root enhanced-model group and flush its link.

Parameters
grpidNon-root group identifier.
nameNew short name, normalized according to netCDF naming rules.
Returns
NC_NOERR, a naming/access error, or NC_EHDFERR on link/flush failure.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ NXCDF_rename_var()

int NXCDF_rename_var ( int ncid,
int varid,
const char * name )

Rename a variable and update its HDF5 link.

Rename a variable.

Parameters
ncidNetCDF file identifier.
varidVariable id.
nameNew variable name.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ nxcdf_scrub_extended_atomic_data()

void nxcdf_scrub_extended_atomic_data ( NC_GRP_INFO_T * grp)

Release attribute data and variable fill values that netcdf-c's teardown cannot reclaim.

nc4_file_list_del() reclaims every att->data and var->fill_value through NC_reclaim_data(), which routes any type id above NC_MAX_ATOMIC_TYPE to nc4_find_type(). The NEP extended atomic types (NC_FLOAT16 through the ids below NC_FIRSTUSERTYPEID) are not registered user types, so the lookup fails and the recursive teardown aborts early, leaking the whole group/var/att tree. Their payloads are flat malloc'd blocks — no nested allocations — so they are released here directly and the attribute's type id is rewritten to NC_BYTE so upstream's reclaim pass skips it.

Must run after all attribute/fill metadata has been materialized to HDF5 and immediately before nc4_file_list_del().

Parameters
grpRoot group to scrub; recurses into children.

◆ NXCDF_set_fill()

int NXCDF_set_fill ( int ncid,
int fillmode,
int * old_modep )

Set the session fill default for subsequently defined variables.

Set the session fill default for subsequently defined variables.

Parameters
ncidFile or group identifier.
fillmodeNC_FILL or NC_NOFILL.
old_modepOptional destination for the previous session default.
Returns
NC_NOERR, NC_EBADID, NC_EPERM for read-only files, or NC_EINVAL.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ NXCDF_set_var_chunk_cache()

int NXCDF_set_var_chunk_cache ( int ncid,
int varid,
size_t size,
size_t nelems,
float preemption )

Set session cache parameters and reopen an existing dataset.

Set session cache parameters and reopen an existing dataset.

Parameters
ncidFile or group identifier.
varidVariable identifier within the group.
sizeCache capacity in bytes; zero disables raw chunk caching.
nelemsHash slot count; zero is permitted.
preemptionFinite cache preemption weight in [0,1].
Returns
NC_NOERR or an identifier, validation, memory or HDF5 error.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ nxcdf_storage_memory_type()

int nxcdf_storage_memory_type ( hid_t memory,
hid_t storage,
hid_t * typep )

Preserve storage string character sets in a native memory layout.

Parameters
memoryBorrowed datatype describing the caller's layout.
storageBorrowed stored datatype with matching members.
typepOwned result, closed by the caller.
Returns
NC_NOERR or NC_EHDFERR.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ nxcdf_swmr_activate()

int nxcdf_swmr_activate ( NC_FILE_INFO_T * h5,
NXCDF_FILE_INFO_T * file )

Activate a committed session without recursively entering enddef.

Parameters
h5Shared NetCDF file metadata in data mode.
filenxCDF session state.
Returns
NC_NOERR or a validation/HDF5 error; active stays false on failure.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ nxcdf_swmr_flush()

int nxcdf_swmr_flush ( NC_FILE_INFO_T * h5,
NXCDF_FILE_INFO_T * file )

Publish all variable data before flushing dimension scales and the file.

Parameters
h5Shared NetCDF metadata.
fileActive writable SWMR file.
Returns
NC_NOERR or NC_EHDFERR; publication is not transactional.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ nxcdf_swmr_read_aliases()

int nxcdf_swmr_read_aliases ( NC_GRP_INFO_T * grp)

Collapse coordinate-variable alias handles to a single dataset id.

Two open handles to the same HDF5 object defeat SWMR data visibility in a reader: reads through either handle stay frozen at the open-time snapshot even after H5Drefresh. A coordinate variable holds such a pair — the dimension's scale handle and the variable's own handle — so a reader keeps only the variable's handle and points the dimension record at it. The surviving handle must be closed only once; nxcdf_close_group_hdf() already tolerates an identifier that was closed twice.

Parameters
grpSubtree to walk, in metadata index order.
Returns
NC_NOERR or NC_EHDFERR.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ nxcdf_swmr_refresh()

int nxcdf_swmr_refresh ( NC_FILE_INFO_T * h5,
NXCDF_FILE_INFO_T * file )

Refresh all variable data before reloading dimension-scale extents.

Whole-file reader refresh behind nc_swmr_refresh(). The order matters: a coordinate variable's scale is refreshed through the variable's own dataset handle after the alias collapse, so variables are refreshed first and the scale pass only needs to recover extents. Re-running nxcdf_swmr_read_aliases() first is defensive — a session cache tuning call (nxcdf_reopen_var_cache) closes and reopens the alias pair, which would silently restore the poisonous duplicate handles.

Parameters
h5Shared NetCDF metadata.
fileRead-only SWMR reader file.
Returns
NC_NOERR or NC_EHDFERR.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ nxcdf_swmr_validate()

int nxcdf_swmr_validate ( NC_FILE_INFO_T * h5,
NXCDF_FILE_INFO_T * file )

Preflight native serial SWMR without changing definitions or file bounds.

Parameters
h5Shared NetCDF file metadata.
filenxCDF session state.
Returns
NC_NOERR, NC_EPERM, NC_EINVAL, NC_ENOTBUILT or NC_EHDFERR.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ NXCDF_sync()

int NXCDF_sync ( int ncid)
extern

Dispatch-table entry behind nc_sync(): flushes a writable file to storage.

Dispatch-table entry behind nc_sync(): flushes a writable file to storage.

Read-only files are a no-op.

Parameters
ncidNetCDF file identifier.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_type_name()

const char * NXCDF_type_name ( nc_type xtype)

Return the short name for an atomic nc_type.

Return a display name for a fixed-size NetCDF atomic type.

These names ("float16", "bfloat16", ...) label the in-memory NC_TYPE_INFO_T records set_var_type() builds for atomic-typed variables.

Parameters
xtypeNetCDF atomic type.
Returns
Static name string, or "unknown".

◆ NXCDF_type_size()

int NXCDF_type_size ( nc_type xtype,
size_t * sizep )

Return the in-memory size, in bytes, of an atomic nc_type.

Return the in-memory size of a fixed-size NetCDF atomic type.

This is the size of one element in a user buffer: NC_STRING is sizeof(char *), references are their opaque token sizes (8 and 12 bytes), the sub-byte small floats round up to 1 byte.

Parameters
xtypeNetCDF atomic type.
sizepDestination for the size in bytes.
Returns
NC_NOERR or NC_EBADTYPE.

◆ nxcdf_type_size()

int nxcdf_type_size ( NC_GRP_INFO_T * grp,
nc_type xtype,
size_t * sizep )

Resolve the in-memory element size of any supported type.

Resolve the in-memory size of an atomic or user-defined type.

Atomic ids delegate to NXCDF_type_size(); ids at or above NC_FIRSTUSERTYPEID resolve through nxcdf_find_type() and return the type record's size.

Parameters
grpGroup the type is being used from.
xtypeType id.
sizepDestination for the size in bytes.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_var_par_access()

int NXCDF_var_par_access ( int ncid,
int varid,
int par_access )

Select a variable's session-only parallel transfer mode.

All ranks must select the same mode and follow the same collective call sequence. Filtered variables cannot use independent transfers. This does not change storage or enter define mode, and works on read-only sessions.

Parameters
ncidFile or group identifier.
varidGroup-local variable identifier.
par_accessNC_COLLECTIVE or NC_INDEPENDENT.
Returns
NC_NOERR on success, NC_ENOPAR for a serial session/build, NC_EINVAL for an invalid mode or independent filtered access, or the identifier lookup error.
Author
Edward Hartnett, Intelligent Data Design, Inc.

◆ NXCDF_write_markers()

int NXCDF_write_markers ( NXCDF_FILE_INFO_T * file)

Write the hidden marker attributes identifying the file as nxCDF.

Write nxCDF provenance and compatibility markers.

Every nxCDF file gets _NxcdfBackend = "nxCDF/1.0" on the root group — this is what NXCDF_read_markers checks at open to distinguish nxCDF files from upstream netCDF-4/HDF5 files. Files created with NC_NETCDF4_MODEL additionally get the integer _NxcdfModel marker so the compatibility mode survives reopen. See nxCDF Architecture.

Parameters
fileOpen writable nxCDF state.
Returns
NC_NOERR on success, or NC_EHDFERR.

◆ nxcdf_write_provenance()

int nxcdf_write_provenance ( NXCDF_FILE_INFO_T * file)

Write _NCProperties and _nc3_strict to a file nxCDF created.

Write _NCProperties/_nc3_strict to a file created this session.

Called from NXCDF__enddef, NXCDF_sync and NXCDF_close on writable files — the same deferred points upstream's NC4_write_provenance runs. _NCProperties is stored exactly as upstream does: a scalar fixed-length ASCII string of strlen bytes with H5T_STR_NULLTERM padding. _nc3_strict is a scalar H5T_NATIVE_INT = 1 written only for NC_CLASSIC_MODEL files. Neither attribute is ever overwritten, so an existing stamp survives a write-open update. Files nxCDF did not create are never stamped.

Parameters
fileOpen writable nxCDF state.
Returns
NC_NOERR on success, or a NetCDF error code.

◆ NXCDF_write_types()

int NXCDF_write_types ( NC_FILE_INFO_T * h5)

Commit every pending user-defined type — called by NXCDF__enddef() before the metadata writer runs, so committed datatypes exist when variable datasets are created.

Commit all user-defined types to the file.

Parameters
h5NetCDF-4 file state.
Returns
NC_NOERR on success, or a NetCDF error code.

Variable Documentation

◆ NXCDF_dispatch_table

const NC_Dispatch* NXCDF_dispatch_table
extern

Active nxCDF dispatch table, or NULL before initialization.

Active nxCDF dispatch table, or NULL before initialization.

Set by NC_NXCDF_initialize(); NULL until the backend has been registered.