This function changes the chunk cache settings for a variable. The change in cache size happens immediately. This is a property of the open file - it does not persist the next time you open the file.
For more information, see the documentation for the H5Pset_cache() function in the HDF5 library at the HDF5 website: http://hdfgroup.org/HDF5/.
nc_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, float preemption);
ncid
varid
size
nelems
preemption
NC_NOERR
NC_EINVAL
This example is from libsrc4/tst_vars2.c:
#include <netcdf.h> ... #define CACHE_SIZE 32000000 #define CACHE_NELEMS 1009 #define CACHE_PREEMPTION .75 ... /* Create a netcdf-4 file with one dim and one var. */ if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR; if (nc_def_dim(ncid, DIM5_NAME, DIM5_LEN, &dimids[0])) ERR; if (dimids[0] != 0) ERR; if (nc_def_var(ncid, VAR_NAME5, NC_INT, NDIMS5, dimids, &varid)) ERR; if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, chunksize)) ERR; if (nc_set_var_chunk_cache(ncid, varid, CACHE_SIZE, CACHE_NELEMS, CACHE_PREEMPTION)) ERR;