NetCDF 4.9.3
Loading...
Searching...
No Matches
netcdf_filter.h
Go to the documentation of this file.
1/* Copyright 2018, UCAR/Unidata and OPeNDAP, Inc.
2 See the COPYRIGHT file for more information. */
4
5/*
6 * In order to use any of the netcdf_XXX.h files, it is necessary
7 * to include netcdf.h followed by any netcdf_XXX.h files.
8 * Various things (like EXTERNL) are defined in netcdf.h
9 * to make them available for use by the netcdf_XXX.h files.
10*/
11
12#ifndef NETCDF_FILTER_H
13#define NETCDF_FILTER_H 1
14
15/**************************************************/
16/* API for libdispatch/dfilter.c */
17
18/* Must match values in <H5Zpublic.h> */
19#ifndef H5Z_FILTER_DEFLATE
20#define H5Z_FILTER_DEFLATE 1
21#define H5Z_FILTER_SHUFFLE 2
22#define H5Z_FILTER_FLETCHER32 3
23#endif
24
25#ifndef H5Z_FILTER_SZIP
26#define H5Z_FILTER_SZIP 4
27#define H5_SZIP_ALLOW_K13_OPTION_MASK 1
28#define H5_SZIP_CHIP_OPTION_MASK 2
29#define H5_SZIP_EC_OPTION_MASK 4
30#define H5_SZIP_LSB_OPTION_MASK 8
31#define H5_SZIP_MSB_OPTION_MASK 16
32#define H5_SZIP_NN_OPTION_MASK 32
33#define H5_SZIP_MAX_PIXELS_PER_BLOCK 32
34#define H5_SZIP_RAW_OPTION_MASK 128
35
36#define NC_SZIP_EC 4
37#define NC_SZIP_NN 32
38#endif
39
40#define H5_SZIP_ALL_MASKS (H5_SZIP_CHIP_OPTION_MASK|H5_SZIP_EC_OPTION_MASK|H5_SZIP_NN_OPTION_MASK)
41
43#define NC_MAX_PIXELS_PER_BLOCK 32
44
45/* Other Standard Filters */
46#ifndef H5Z_FILTER_ZSTD
47#define H5Z_FILTER_ZSTD 32015
48#endif
49#ifndef H5Z_FILTER_BZIP2
50#define H5Z_FILTER_BZIP2 307
51#endif
52#ifndef H5Z_FILTER_BLOSC
53#define H5Z_FILTER_BLOSC 32001
54#endif
55#ifndef BLOSC_SHUFFLE
56enum BLOSC_SHUFFLE {
57BLOSC_NOSHUFFLE=0, /* no shuffle */
58BLOSC_SHUFFLE=1, /* byte-wise shuffle */
59BLOSC_BITSHUFFLE=2 /* bit-wise shuffle */
60};
61#endif
62
63/*Assumes use of c-blosc library */
64#ifndef BLOSC_BLOSCLZ
65enum BLOSC_SUBCOMPRESSORS {BLOSC_LZ=0, BLOSC_LZ4=1, BLOSC_LZ4HC=2, BLOSC_SNAPPY=3, BLOSC_ZLIB=4, BLOSC_ZSTD=5};
66#endif
67
68#if defined(__cplusplus)
69extern "C" {
70#endif
71
72/**************************************************/
73/* HDF5 Format filter functions */
74
75/*Define a filter for a variable */
76EXTERNL int
77nc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int* parms);
78
79/* Learn about the first defined filter filter on a variable */
80EXTERNL int
81nc_inq_var_filter(int ncid, int varid, unsigned int* idp, size_t* nparams, unsigned int* params);
82
83/* Support inquiry about all the filters associated with a variable */
84/* As is usual, it is expected that this will be called twice:
85 once to get the number of filters, and then a second time to read the ids */
86EXTERNL int nc_inq_var_filter_ids(int ncid, int varid, size_t* nfilters, unsigned int* filterids);
87
88/* Learn about the filter with specified id wrt a variable */
89EXTERNL int nc_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t* nparams, unsigned int* params);
90
91/* End HDF5 Format Declarations */
92
93/**************************************************/
94/* Allow user to interrogate if a filter is available*/
95/* Would prefer to get list of all known filters, but HDF5 does not support that */
96
97/* See if filter is available */
98EXTERNL int nc_inq_filter_avail(int ncid, unsigned id);
99
100/**************************************************/
101/* Functions for accessing standardized filters */
102
103EXTERNL int nc_def_var_bzip2(int ncid, int varid, int level);
104EXTERNL int nc_inq_var_bzip2(int ncid, int varid, int* hasfilterp, int *levelp);
105
106/* Note use of 'zstandard' instead of 'zstd' */
107EXTERNL int nc_def_var_zstandard(int ncid, int varid, int level);
108EXTERNL int nc_inq_var_zstandard(int ncid, int varid, int* hasfilterp, int *levelp);
109
110EXTERNL int nc_def_var_blosc(int ncid, int varid, unsigned subcompressor, unsigned level, unsigned blocksize, unsigned addshuffle);
111EXTERNL int nc_inq_var_blosc(int ncid, int varid, int* hasfilterp, unsigned* subcompressorp, unsigned* levelp, unsigned* blocksizep, unsigned* addshufflep);
112
113/* Filter path query/set */
114EXTERNL int nc_filter_path_query(int id);
115
116#if defined(__cplusplus)
117}
118#endif
119
120/**************************************************/
121/* API for libdispatch/dplugin.c */
122
123/* Combine the vector of directory path plus it's length in a single struct. */
124typedef struct NCPluginList {
125 size_t ndirs; /* |dirs| */
126 char** dirs;
128
129/* Externally visible plugin path functions */
130#if defined(__cplusplus)
131extern "C" {
132#endif
133
142EXTERNL int nc_plugin_path_ndirs(size_t* ndirsp);
143
159
172
173#if defined(__cplusplus)
174}
175#endif
176
177#endif /* NETCDF_FILTER_H */
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:381
EXTERNL int nc_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t *nparams, unsigned int *params)
Find the the param info about filter (if any) associated with a variable and with specified id.
Definition dfilter.c:95
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:167
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:59
#define EXTERNL
Needed for DLL build.
Definition netcdf.h:571
EXTERNL int nc_def_var_zstandard(int ncid, int varid, int level)
Turn on Zstandard compression for a variable.
Definition dfilter.c:304
EXTERNL int nc_plugin_path_get(NCPluginList *dirs)
Return the current sequence of directories in the internal global plugin path list.
EXTERNL int nc_def_var_bzip2(int ncid, int varid, int level)
Turn on bzip2 compression for a variable.
Definition dfilter.c:236
EXTERNL int nc_inq_filter_avail(int ncid, unsigned id)
Test if filter is available.
Definition dfilter.c:209
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.
EXTERNL int nc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int *parms)
Define a new variable filter Assumes HDF5 format using unsigned ints.
Definition dfilter.c:126
EXTERNL int nc_plugin_path_set(NCPluginList *dirs)
Empty the current internal path sequence and replace with the sequence of directories argument.
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:431
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:267
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:340