|
NEP 4.3.0
NetCDF Expansion Pack
|
HDF5 filter pipeline support for the nxCDF backend. More...
#include "config.h"#include <stdlib.h>#include <string.h>#include <hdf5_hl.h>#include "nclist.h"#include "nxcdf_internal.h"#include "netcdf_filter.h"Functions | |
| 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_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_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_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. | |
HDF5 filter pipeline support for the nxCDF backend.
nxCDF stores each variable's filter pipeline in the shared NC_VAR_INFO_T::filters list — an NClist of struct NC_HDF5_Filter — and manipulates it through netcdf-c's exported NC4_hdf5_* helpers, exactly as the built-in HDF5 backend does in libhdf5/hdf5filter.c. The list order is the pipeline order: fletcher32 is always first, shuffle first-or-second, and every other filter appears in definition order.
| int nxcdf_apply_filters | ( | hid_t | dcpl, |
| NC_VAR_INFO_T * | var ) |
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_def_var_deflate | ( | int | ncid, |
| int | varid, | ||
| int | shuffle, | ||
| int | deflate, | ||
| int | deflate_level ) |
Set deflate compression — the nc_def_var_deflate() dispatch entry.
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_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.
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.
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_inq_filter_avail | ( | int | ncid, |
| unsigned int | id ) |
Test whether an HDF5 filter is available — the nc_inq_filter_avail() dispatch entry.
| ncid | NetCDF file identifier (ignored; availability is process-wide). |
| id | HDF5 filter identifier. |
| 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.
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.
| 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_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.
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). |