NEP 4.3.0
NetCDF Expansion Pack
Loading...
Searching...
No Matches
nxcdf_open.c File Reference

Empty-file open and validation for the nxCDF backend. More...

#include "nxcdf/nxcdf.h"
#include "config.h"
#include <unistd.h>
#include "nxcdf_internal.h"

Functions

int NXCDF_open (const char *path, int mode, int basepe, size_t *chunksizehintp, void *parameters, const NC_Dispatch *dispatch, int ncid)
 Open an existing nxCDF file.

Detailed Description

Empty-file open and validation for the nxCDF backend.

Author
Edward Hartnett
Date
2026-08-28

Function Documentation

◆ NXCDF_open()

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

Open an existing nxCDF file.

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.