Loading...
Searching...
No Matches
netcdf_filter.h
Go to the documentation of this file.
/* Copyright 2018, UCAR/Unidata and OPeNDAP, Inc.
See the COPYRIGHT file for more information. */
/*
* In order to use any of the netcdf_XXX.h files, it is necessary
* to include netcdf.h followed by any netcdf_XXX.h files.
* Various things (like EXTERNL) are defined in netcdf.h
* to make them available for use by the netcdf_XXX.h files.
*/
#ifndef NETCDF_FILTER_H
#define NETCDF_FILTER_H 1
/**************************************************/
/* API for libdispatch/dfilter.c */
/* Must match values in <H5Zpublic.h> */
#ifndef H5Z_FILTER_DEFLATE
#define H5Z_FILTER_DEFLATE 1
#define H5Z_FILTER_SHUFFLE 2
#define H5Z_FILTER_FLETCHER32 3
#endif
#ifndef H5Z_FILTER_SZIP
#define H5Z_FILTER_SZIP 4
#define H5_SZIP_ALLOW_K13_OPTION_MASK 1
#define H5_SZIP_CHIP_OPTION_MASK 2
#define H5_SZIP_EC_OPTION_MASK 4
#define H5_SZIP_LSB_OPTION_MASK 8
#define H5_SZIP_MSB_OPTION_MASK 16
#define H5_SZIP_NN_OPTION_MASK 32
#define H5_SZIP_MAX_PIXELS_PER_BLOCK 32
#define H5_SZIP_RAW_OPTION_MASK 128
#define NC_SZIP_EC 4
#define NC_SZIP_NN 32
#endif
#define H5_SZIP_ALL_MASKS (H5_SZIP_CHIP_OPTION_MASK|H5_SZIP_EC_OPTION_MASK|H5_SZIP_NN_OPTION_MASK)
#define NC_MAX_PIXELS_PER_BLOCK 32
/* Other Standard Filters */
#ifndef H5Z_FILTER_ZSTD
#define H5Z_FILTER_ZSTD 32015
#endif
#ifndef H5Z_FILTER_BZIP2
#define H5Z_FILTER_BZIP2 307
#endif
#ifndef H5Z_FILTER_BLOSC
#define H5Z_FILTER_BLOSC 32001
#endif
#ifndef BLOSC_SHUFFLE
enum BLOSC_SHUFFLE {
BLOSC_NOSHUFFLE=0, /* no shuffle */
BLOSC_SHUFFLE=1, /* byte-wise shuffle */
BLOSC_BITSHUFFLE=2 /* bit-wise shuffle */
};
#endif
/*Assumes use of c-blosc library */
#ifndef BLOSC_BLOSCLZ
enum BLOSC_SUBCOMPRESSORS {BLOSC_LZ=0, BLOSC_LZ4=1, BLOSC_LZ4HC=2, BLOSC_SNAPPY=3, BLOSC_ZLIB=4, BLOSC_ZSTD=5};
#endif
#if defined(__cplusplus)
extern "C" {
#endif
/**************************************************/
/* HDF5 Format filter functions */
/*Define a filter for a variable */
EXTERNL int
nc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int* params);
/* Learn about the first defined filter filter on a variable */
EXTERNL int
nc_inq_var_filter(int ncid, int varid, unsigned int* idp, size_t* nparams, unsigned int* params);
/* Support inquiry about all the filters associated with a variable */
/* As is usual, it is expected that this will be called twice:
once to get the number of filters, and then a second time to read the ids */
EXTERNL int nc_inq_var_filter_ids(int ncid, int varid, size_t* nfilters, unsigned int* filterids);
/* Learn about the filter with specified id wrt a variable */
EXTERNL int nc_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t* nparams, unsigned int* params);
/* End HDF5 Format Declarations */
/**************************************************/
/* Allow user to interrogate if a filter is available*/
/* Would prefer to get list of all known filters, but HDF5 does not support that */
/* See if filter is available */
EXTERNL int nc_inq_filter_avail(int ncid, unsigned id);
/**************************************************/
/* Functions for accessing standardized filters */
EXTERNL int nc_def_var_bzip2(int ncid, int varid, int level);
EXTERNL int nc_inq_var_bzip2(int ncid, int varid, int* hasfilterp, int *levelp);
/* Note use of 'zstandard' instead of 'zstd' */
EXTERNL int nc_def_var_zstandard(int ncid, int varid, int level);
EXTERNL int nc_inq_var_zstandard(int ncid, int varid, int* hasfilterp, int *levelp);
EXTERNL int nc_def_var_blosc(int ncid, int varid, unsigned subcompressor, unsigned level, unsigned blocksize, unsigned addshuffle);
EXTERNL int nc_inq_var_blosc(int ncid, int varid, int* hasfilterp, unsigned* subcompressorp, unsigned* levelp, unsigned* blocksizep, unsigned* addshufflep);
/* Filter path query/set */
EXTERNL int nc_filter_path_query(int id);
#if defined(__cplusplus)
}
#endif
/**************************************************/
/* API for libdispatch/dplugin.c */
/* Combine the vector of directory path plus it's length in a single struct. */
typedef struct NCPluginList {
size_t ndirs; /* |dirs| */
char** dirs;
} NCPluginList;
/* Externally visible plugin path functions */
#if defined(__cplusplus)
extern "C" {
#endif
EXTERNL int nc_plugin_path_ndirs(size_t* ndirsp);
EXTERNL int nc_plugin_path_get(NCPluginList* dirs);
EXTERNL int nc_plugin_path_set(NCPluginList* dirs);
#if defined(__cplusplus)
}
#endif
#endif /* NETCDF_FILTER_H */
nc_inq_var_blosc
EXTERNL int nc_inq_var_blosc(int ncid, int varid, int *hasfilterp, unsigned *subcompressorp, unsigned *levelp, unsigned *blocksizep, unsigned *addshufflep)
Learn whether Blosc compression is on for a variable, and, if so, the settings.
Definition dfilter.c:445
nc_def_var_zstandard
EXTERNL int nc_def_var_zstandard(int ncid, int varid, int level)
Turn on Zstandard compression for a variable.
Definition dfilter.c:313
nc_def_var_blosc
EXTERNL int nc_def_var_blosc(int ncid, int varid, unsigned subcompressor, unsigned level, unsigned blocksize, unsigned addshuffle)
Turn on blosc for a variable.
Definition dfilter.c:393
nc_inq_var_bzip2
EXTERNL int nc_inq_var_bzip2(int ncid, int varid, int *hasfilterp, int *levelp)
Learn whether bzip2 compression is on for a variable, and, if so, the level setting.
Definition dfilter.c:274
nc_inq_var_filter_info
EXTERNL int nc_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t *nparams, unsigned int *params)
Find the param info about filter (if any) associated with a variable and with specified id.
Definition dfilter.c:98
nc_def_var_bzip2
EXTERNL int nc_def_var_bzip2(int ncid, int varid, int level)
Turn on bzip2 compression for a variable.
Definition dfilter.c:241
nc_inq_var_filter
EXTERNL int nc_inq_var_filter(int ncid, int varid, unsigned int *idp, size_t *nparams, unsigned int *params)
Find the first filter (if any) associated with a variable.
Definition dfilter.c:170
nc_inq_var_zstandard
EXTERNL int nc_inq_var_zstandard(int ncid, int varid, int *hasfilterp, int *levelp)
Learn whether Zstandard compression is on for a variable, and, if so, the level setting.
Definition dfilter.c:351
nc_inq_var_filter_ids
EXTERNL int nc_inq_var_filter_ids(int ncid, int varid, size_t *nfilters, unsigned int *filterids)
Find the set of filters (if any) associated with a variable.
Definition dfilter.c:62
EXTERNL
#define EXTERNL
Needed for DLL build.
Definition netcdf.h:612
nc_plugin_path_get
EXTERNL int nc_plugin_path_get(NCPluginList *dirs)
Return the current sequence of directories in the internal global plugin path list.
nc_inq_filter_avail
EXTERNL int nc_inq_filter_avail(int ncid, unsigned id)
Test if filter is available.
Definition dfilter.c:212
nc_plugin_path_ndirs
EXTERNL int nc_plugin_path_ndirs(size_t *ndirsp)
Return the length of the current sequence of directories in the internal global plugin path list.
nc_plugin_path_set
EXTERNL int nc_plugin_path_set(NCPluginList *dirs)
Empty the current internal path sequence and replace with the sequence of directories argument.
nc_def_var_filter
EXTERNL int nc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int *params)
Define a new variable filter Assumes HDF5 format using unsigned ints.
Definition dfilter.c:129
NCPluginList
Definition netcdf_filter.h:124