|
NEP 4.3.0
NetCDF Expansion Pack
|
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. | |
Private state and shared helpers for the nxCDF backend.
| #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.
| #define NXCDF_BACKEND_VALUE "nxCDF/1.0" |
Backend version string stored in NXCDF_BACKEND_ATT.
| #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_DIMCLASS "DIMENSION_SCALE" |
HDF5 dimension scale class marker written on every dimension's scale dataset.
| #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_DIMNAME_ATT "NAME" |
Optional dimension scale name attribute.
| #define NXCDF_MODEL_ATT "_NxcdfModel" |
Hidden root attribute marking NC_NETCDF4_MODEL compatibility mode, so the mode survives reopen.
| #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).
| #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_VARID_ATT "_NxcdfVarid" |
Hidden attribute on a variable dataset storing its stable NetCDF varid.
| 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_FILE_INFO 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.
| 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_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).
| 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.
| 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.
| ncid | NetCDF file identifier. |
| h_minfree | Ignored (reserved for future alignment control). |
| v_align | Ignored (reserved for future alignment control). |
| v_minfree | Ignored (reserved for future alignment control). |
| r_align | Ignored (reserved for future alignment control). |
|
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.
| ncid | NetCDF file identifier. |
| 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.
| ncid | NetCDF file identifier. |
| path | File-system path. |
| mode | Effective NetCDF mode. |
| filep | Destination for the allocated state. |
| 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).
| dcpl | Dataset creation property list identifier. |
| var | Variable. |
| 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.
| out | Destination for a malloc'd string the caller frees. |
| 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.
| file | nxCDF file state. |
| xtype | Candidate NetCDF type. |
| 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.
| mode | NetCDF create/open flags, including the UDF selector. |
| 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.
| h5 | NetCDF-4 file state (may be NULL). |
| file | nxCDF file state. |
|
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.
| ncid | NetCDF file identifier. |
| parameters | Optional close parameters; currently ignored. |
| 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.
| grp | Group. |
| 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.
| src | Source buffer (may be NULL for a validation-only probe). |
| dest | Destination buffer (may be NULL for a probe). |
| src_type | Resolved source type. |
| dest_type | Resolved destination type. |
| len | Element count. |
| range_error | Required output range flag. |
| fill_value | Optional destination fill. |
| strict_nc3 | Classic byte-range convention. |
| quantize_mode | Quantization mode. |
| nsd | Quantization precision. |
| fill_on_overflow | Nonzero 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). |
range_error, not the return value. | 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.
| nc | File controller owning user-type metadata. |
| xtype | Atomic or user-defined type. |
| src | Borrowed source element buffer. |
| count | Number of elements. |
| dst | Uninitialized destination element buffer. |
|
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).
| path | File-system path to create. |
| cmode | NetCDF create-mode flags. |
| initialsz | Requested initial file size; currently ignored. |
| basepe | Base processing element; currently ignored. |
| chunksizehintp | Chunk-size hint; currently ignored. |
| parameters | Non-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. |
| dispatch | Dispatch table selected by netcdf-c. |
| ncid | NetCDF file identifier allocated by netcdf-c. |
| 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().
| var | Variable. |
| h5 | NetCDF-4 file state. |
| file | nxCDF file state. |
| grp | Group. |
| 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.
| ncid | NetCDF file identifier. |
| size | Size of the compound type in bytes. |
| name | Type name. |
| typeidp | Destination for the new type id. |
| 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.
| ncid | NetCDF file identifier. |
| name | Dimension name. |
| len | Dimension length, or 0 for unlimited. |
| idp | Destination for the assigned dimension id. |
| 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.
| ncid | NetCDF file identifier. |
| base_typeid | Integer base type id. |
| name | Type name. |
| typeidp | Destination for the new type id. |
| 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.
| ncid | NetCDF file identifier of the parent group. |
| name | Subgroup name. |
| grpidp | Destination for the new subgroup ncid. |
| 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.
| ncid | NetCDF file identifier. |
| size | Size of the opaque data in bytes. |
| name | Type name. |
| typeidp | Destination for the new type id. |
| 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).
| ncid | NetCDF file identifier. |
| name | Variable name. |
| xtype | NetCDF atomic type. |
| ndims | Number of dimensions. |
| dimidsp | Array of dimension ids. |
| varidp | Destination for the assigned variable id. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable identifier. |
| storage | Storage class (NC_CHUNKED or NC_CONTIGUOUS; NC_COMPACT is rejected). |
| chunksizesp | Chunk size for each dimension, or NULL. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| shuffle | Nonzero to enable the shuffle filter. |
| deflate | Nonzero to enable deflate compression. |
| deflate_level | Deflate level (0-9). |
| 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().
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| endianness | NC_ENDIAN_NATIVE, NC_ENDIAN_LITTLE or NC_ENDIAN_BIG. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| no_fill | Nonzero to suppress fill values. |
| fill_value | Fill value, or NULL for the type default. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| id | HDF5 filter identifier. |
| nparams | Number of filter parameters. |
| params | Filter parameter values. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| fletcher32 | NC_FLETCHER32 to enable, NC_NOCHECKSUM ignored. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| quantize_mode | NC_NOQUANTIZE, NC_QUANTIZE_BITGROOM, NC_QUANTIZE_GRANULARBR or NC_QUANTIZE_BITROUND. |
| nsd | Number of significant digits. |
| 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.
| ncid | NetCDF file identifier. |
| name | Type name. |
| base_typeid | Base type of the vlen elements. |
| typeidp | Destination for the new type id. |
| int NXCDF_del_att | ( | int | ncid, |
| int | varid, | ||
| const char * | name ) |
Delete an attribute from a group or variable.
Delete an attribute.
| ncid | NetCDF file identifier. |
| varid | Variable id or NC_GLOBAL. |
| name | Attribute name. |
| 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.
| grp | Group the type is being used from. |
| xtype | Type id. |
| typep | Destination for an owned HDF5 datatype. |
| 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.
| grp | Group the type is being used from. |
| xtype | Type id (must be NC_FIRSTUSERTYPEID or above). |
| typep | Destination for the borrowed record. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable identifier. |
| h5 | Destination for the NetCDF-4 file state. |
| file | Destination for the nxCDF file state. |
| grp | Destination for the group. |
| var | Destination for the variable. |
| 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.
| grp | Group to walk (recursively). |
| 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.
| file | State to release; may be NULL. |
| 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.
| type | In-memory type record. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id or NC_GLOBAL. |
| name | Attribute name. |
| value | Destination buffer. |
| memtype | Requested in-memory type. |
| 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.
| file | Open nxCDF state. |
| name | Attribute name. |
| xtypep | Optional destination for the file type. |
| mem_type | Requested in-memory type (NC_NAT allowed). |
| lenp | Optional destination for the attribute length. |
| attnump | Non-NULL asks for the attribute's index, which virtual attributes do not have. |
| data | Optional destination for the attribute's value. |
| 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.
| ncid | NetCDF file identifier. |
| h5p | Optional destination for common NetCDF-4 state. |
| filep | Optional destination for nxCDF state. |
| 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().
| xtype | NetCDF atomic type. |
| sizep | Destination for the size. |
| 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.
| ncid | File or group identifier. |
| varid | Variable identifier within the group. |
| sizep | Optional byte-capacity destination. |
| nelemsp | Optional hash-slot destination. |
| preemptionp | Optional preemption destination. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| start | Hyperslab start indices. |
| count | Hyperslab counts. |
| value | Destination buffer. |
| memtype | NetCDF atomic memory type. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| s | Hyperslab start indices. |
| c | Hyperslab counts. |
| st | Hyperslab strides. |
| im | Memory mapping offsets. |
| v | Destination buffer. |
| t | NetCDF atomic memory type. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| start | Hyperslab start indices. |
| count | Hyperslab counts. |
| stride | Hyperslab strides. |
| value | Destination buffer. |
| memtype | NetCDF atomic memory type. |
| 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().
| ncid | NetCDF file identifier. |
| typeid | Vlen type id. |
| vlen_element | Source nc_vlen_t descriptor. |
| lenp | Destination for the element count (required). |
| data | Destination for the element data (required when the descriptor is non-empty). |
| 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.
| grp | Group the datatype is being used from. |
| htype | HDF5 datatype (need not be committed itself). |
| typep | Destination for the borrowed type record. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id or NC_GLOBAL. |
| name | Attribute name. |
| xtypep | Destination for the attribute's type, or NULL. |
| lenp | Destination for the attribute's length, or NULL. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id or NC_GLOBAL. |
| name | Attribute name. |
| attnump | Destination for the attribute index. |
| 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.
| ncid | NetCDF file identifier. |
| typeid | Compound type id. |
| fieldid | Field index. |
| name | Destination for the field name. |
| offsetp | Destination for the field offset. |
| fieldtypep | Destination for the field type. |
| ndimsp | Destination for the field rank. |
| dim_sizesp | Destination for the field dimension sizes. |
| 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.
| ncid | NetCDF file identifier. |
| typeid | Compound type id. |
| name | Field name. |
| fieldidxp | Destination for the field index. |
| 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.
| ncid | NetCDF file identifier. |
| dimid | Dimension id. |
| name | Destination for the dimension name. |
| lenp | Destination for the dimension length. |
| 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.
| ncid | NetCDF file identifier. |
| typeid | Enum type id. |
| value | Member value. |
| identifier | Destination for the member name. |
| 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.
| ncid | NetCDF file identifier. |
| typeid | Enum type id. |
| idx | Member index. |
| name | Destination for the member name. |
| value | Destination for the member value. |
| 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.
| ncid | NetCDF file identifier (ignored; availability is process-wide). |
| id | HDF5 filter identifier. |
|
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().
| ncid | NetCDF file identifier. |
| formatp | Optional destination for NC_FORMAT_NETCDF4. |
|
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.
| ncid | NetCDF file identifier. |
| formatp | Optional destination for NC_FORMATX_NXCDF. |
| modep | Optional destination for the effective open/create mode. |
| 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.
| ncid | NetCDF file identifier. |
| full_name | Full group path. |
| grpidp | Destination for the group ncid. |
| 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.
| ncid | NetCDF file identifier. |
| parentidp | Destination for the parent ncid. |
| 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.
| ncid | NetCDF file identifier. |
| name | Destination for the group name. |
| 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.
| ncid | NetCDF file identifier. |
| lenp | Destination for the name length. |
| name | Destination for the full group name. |
| 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.
| ncid | NetCDF file identifier. |
| numgrps | Destination for the number of subgroups. |
| grpidsp | Destination for the subgroup ncids. |
| 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.
| ncid | NetCDF file identifier. |
| name | Subgroup name or path. |
| grpidp | Destination for the subgroup ncid. |
| 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.
| ncid1 | NetCDF file identifier of the first type. |
| typeid1 | First type id. |
| ncid2 | NetCDF file identifier of the second type. |
| typeid2 | Second type id. |
| equalp | Destination for the nonzero-if-equal flag. |
| 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.
| ncid | NetCDF file identifier. |
| name | Type name. |
| typeidp | Destination for the type id. |
| 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.
| ncid | NetCDF file identifier. |
| ntypes | Destination for the number of types. |
| typeids | Destination for the type ids. |
| 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.
| ncid | NetCDF file identifier. |
| typeid | Type id. |
| name | Destination for the type name. |
| sizep | Destination for the type size. |
| base_typep | Destination for the base type id. |
| nfieldsp | Destination for the number of fields/members. |
| classp | Destination for the type class. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| name | Destination for the variable name. |
| xtypep | Destination for the variable type. |
| ndimsp | Destination for the rank. |
| dimidsp | Destination for the dimension ids. |
| nattsp | Destination for the number of attributes. |
| 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().
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| name | Destination for the variable name. |
| xtypep | Destination for the variable type. |
| ndimsp | Destination for the rank. |
| dimidsp | Destination for the dimension ids. |
| nattsp | Destination for the number of attributes. |
| shufflep | Destination for the shuffle flag. |
| deflatep | Destination for the deflate flag. |
| deflate_levelp | Destination for the deflate level. |
| fletcher32p | Destination for the Fletcher32 flag. |
| contiguousp | Destination for the contiguous-storage flag. |
| chunksizesp | Destination for the chunk sizes. |
| no_fillp | Destination for the no-fill flag. |
| fill_valuep | Destination for the fill value. |
| endiannessp | Destination for the endianness. |
| idp | Destination for the filter ids. |
| nparamsp | Destination for the filter parameter count. |
| params | Destination for the filter parameters. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| nfiltersp | Destination for the number of filters. |
| ids | Destination for the filter ids, or NULL for count only. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| id | Filter identifier to inquire about. |
| nparamsp | Destination for the number of filter parameters. |
| params | Destination for the filter parameter values. |
| 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.
| ncid | NetCDF file identifier. |
| typeid | Compound type id. |
| name | Field name. |
| offset | Field offset in bytes. |
| xtype | NetCDF type of the field elements. |
| ndims | Number of array dimensions; 0 inserts a scalar. |
| dim_sizesp | Array dimension sizes (required when ndims>0). |
| 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.
| ncid | NetCDF file identifier. |
| typeid | Compound type id. |
| name | Field name. |
| offset | Field offset in bytes. |
| xtype | NetCDF type of the field. |
| 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.
| ncid | NetCDF file identifier. |
| typeid | Enum type id. |
| name | Member name. |
| value | Member value. |
| 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.
| dcpl | Dataset creation property list identifier. |
| var | Variable. |
| vinfo | nxCDF variable state (flags destination). |
| 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.
| file | Open nxCDF state. |
| h5 | Common NetCDF-4 file metadata. |
| 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().
| xtype | NetCDF atomic type. |
| typep | Destination for an HDF5 datatype identifier. |
| 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.
| type | NetCDF atomic type (the nc_type of the memory buffer). |
| closep | Set nonzero when the returned type must be closed with H5Tclose(); may be NULL. |
| 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.
| grp | Group the type is being used from. |
| xtype | Type id. |
| typep | Destination for an owned HDF5 datatype. |
|
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.
| path | File-system path to open. |
| mode | NetCDF open-mode flags (NC_WRITE selects read/write). |
| basepe | Base processing element; currently ignored. |
| chunksizehintp | Chunk-size hint; currently ignored. |
| parameters | Non-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. |
| dispatch | Dispatch table selected by netcdf-c. |
| ncid | NetCDF file identifier allocated by netcdf-c. |
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. | 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.
| ncid | NetCDF file identifier. |
| varid | Variable id or NC_GLOBAL. |
| name | Attribute name. |
| datatype | NetCDF atomic type. |
| len | Number of elements. |
| value | Attribute data. |
| memtype | In-memory type for the attribute value. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| start | Hyperslab start indices. |
| count | Hyperslab counts. |
| value | Source buffer. |
| memtype | NetCDF atomic memory type. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| s | Hyperslab start indices. |
| c | Hyperslab counts. |
| st | Hyperslab strides. |
| im | Memory mapping offsets. |
| v | Source buffer. |
| t | NetCDF atomic memory type. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| start | Hyperslab start indices. |
| count | Hyperslab counts. |
| stride | Hyperslab strides. |
| value | Source buffer. |
| memtype | NetCDF atomic memory type. |
| 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.
| ncid | NetCDF file identifier. |
| typeid | Vlen type id. |
| vlen_element | Destination nc_vlen_t descriptor. |
| len | Number of elements. |
| data | Element data (required when len is nonzero). |
| 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.
| file | Open nxCDF state. |
| 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.
| file | Open nxCDF state. |
| 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.
| ncid | NetCDF file identifier. |
| 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:
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.
| ncid | NetCDF file ID. |
| h5p | Destination for NC_FILE_INFO_T, or NULL. |
| filep | Destination for NXCDF_FILE_INFO_T, or NULL. |
| 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.
| ncid | NetCDF file identifier. |
| varid | Variable id or NC_GLOBAL. |
| name | Current attribute name. |
| newname | New attribute name. |
| int NXCDF_rename_dim | ( | int | ncid, |
| int | dimid, | ||
| const char * | name ) |
Rename a dimension and update its HDF5 link.
Rename a dimension.
| ncid | NetCDF file identifier. |
| dimid | Dimension id. |
| name | New dimension name. |
| 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.
| grpid | Non-root group identifier. |
| name | New short name, normalized according to netCDF naming rules. |
| int NXCDF_rename_var | ( | int | ncid, |
| int | varid, | ||
| const char * | name ) |
Rename a variable and update its HDF5 link.
Rename a variable.
| ncid | NetCDF file identifier. |
| varid | Variable id. |
| name | New variable name. |
| 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().
| grp | Root group to scrub; recurses into children. |
| 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.
| ncid | File or group identifier. |
| fillmode | NC_FILL or NC_NOFILL. |
| old_modep | Optional destination for the previous session default. |
| 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.
| ncid | File or group identifier. |
| varid | Variable identifier within the group. |
| size | Cache capacity in bytes; zero disables raw chunk caching. |
| nelems | Hash slot count; zero is permitted. |
| preemption | Finite cache preemption weight in [0,1]. |
| int nxcdf_storage_memory_type | ( | hid_t | memory, |
| hid_t | storage, | ||
| hid_t * | typep ) |
Preserve storage string character sets in a native memory layout.
| memory | Borrowed datatype describing the caller's layout. |
| storage | Borrowed stored datatype with matching members. |
| typep | Owned result, closed by the caller. |
| int nxcdf_swmr_activate | ( | NC_FILE_INFO_T * | h5, |
| NXCDF_FILE_INFO_T * | file ) |
Activate a committed session without recursively entering enddef.
| h5 | Shared NetCDF file metadata in data mode. |
| file | nxCDF session state. |
| 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.
| h5 | Shared NetCDF metadata. |
| file | Active writable SWMR file. |
| 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.
| grp | Subtree to walk, in metadata index order. |
| 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.
| h5 | Shared NetCDF metadata. |
| file | Read-only SWMR reader file. |
| int nxcdf_swmr_validate | ( | NC_FILE_INFO_T * | h5, |
| NXCDF_FILE_INFO_T * | file ) |
Preflight native serial SWMR without changing definitions or file bounds.
| h5 | Shared NetCDF file metadata. |
| file | nxCDF session state. |
|
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.
| ncid | NetCDF file identifier. |
| 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.
| xtype | NetCDF atomic type. |
| 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.
| xtype | NetCDF atomic type. |
| sizep | Destination for the size in bytes. |
| 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.
| grp | Group the type is being used from. |
| xtype | Type id. |
| sizep | Destination for the size in bytes. |
| 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.
| ncid | File or group identifier. |
| varid | Group-local variable identifier. |
| par_access | NC_COLLECTIVE or NC_INDEPENDENT. |
| 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.
| file | Open writable nxCDF state. |
| 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.
| file | Open writable nxCDF state. |
| 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.
| h5 | NetCDF-4 file state. |
|
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.