MISR Toolkit  1.5.1
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. */
3 
4 /*
5  * In order to use any of the netcdf_XXX.h files, it is necessary
6  * to include netcdf.h followed by any netcdf_XXX.h files.
7  * Various things (like EXTERNL) are defined in netcdf.h
8  * to make them available for use by the netcdf_XXX.h files.
9 */
10 
11 #ifndef NETCDF_FILTER_H
12 #define NETCDF_FILTER_H 1
13 
14 /* API for libdispatch/dfilter.c */
15 
16 /* Must match values in <H5Zpublic.h> */
17 #ifndef H5Z_FILTER_DEFLATE
18 #define H5Z_FILTER_DEFLATE 1
19 #endif
20 #ifndef H5Z_FILTER_SZIP
21 #define H5Z_FILTER_SZIP 4
22 #define H5_SZIP_ALLOW_K13_OPTION_MASK 1
23 #define H5_SZIP_CHIP_OPTION_MASK 2
24 #define H5_SZIP_EC_OPTION_MASK 4
25 #define H5_SZIP_NN_OPTION_MASK 32
26 #define H5_SZIP_MAX_PIXELS_PER_BLOCK 32
27 #endif
28 
29 #define H5_SZIP_ALL_MASKS (H5_SZIP_CHIP_OPTION_MASK|H5_SZIP_EC_OPTION_MASK|H5_SZIP_NN_OPTION_MASK)
30 
32 #define NC_MAX_PIXELS_PER_BLOCK 32
33 
34 #if defined(__cplusplus)
35 extern "C" {
36 #endif
37 
38 /* Define the formats for NC_FILTER classes */
39 #define NC_FILTER_FORMAT_HDF5 (NC_FORMATX_NC_HDF5)
40 
41 /* Define the sort for NC_FILTER classes */
42 //#define NC_FILTER_SORT_SPEC ((int)1) /* Use for NC_Filterspec; Must match nc4internal.h */
43 
44 /* Define a Header Object for all filter-related objects */
45 
46 /* provide a common generic struct field */
47 /*
48  format indicates e.g. HDF5
49  sort indicates the "subclass" of the superclass
50 */
51 typedef struct NC_Filterobject {int format;} NC_Filterobject;
52 
53 /* Generic version of Filterspec */
54 typedef struct NC_Filterspec {
57 
58 /**************************************************/
59 /* HDF5 Specific filter functions */
60 
61 /*Define a filter for a variable */
62 EXTERNL int
63 nc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int* parms);
64 
65 /* Learn about the first defined filter filter on a variable */
66 EXTERNL int
67 nc_inq_var_filter(int ncid, int varid, unsigned int* idp, size_t* nparams, unsigned int* params);
68 
69 /* Support inquiry about all the filters associated with a variable */
70 /* As is usual, it is expected that this will be called twice:
71  once to get the number of filters, and then a second time to read the ids */
72 EXTERNL int nc_inq_var_filterids(int ncid, int varid, size_t* nfilters, unsigned int* filterids);
73 
74 /* Learn about the filter with specified id wrt a variable */
75 EXTERNL int
76 nc_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t* nparams, unsigned int* params);
77 
78 /* Remove filter from variable*/
79 EXTERNL int nc_var_filter_remove(int ncid, int varid, unsigned int id);
80 
81 /* Support direct user defined filters;
82  last arg is void*, but is actually H5Z_class2_t*.
83  It is void* to avoid having to reference hdf.h.
84 */
85 EXTERNL int nc_filter_client_register(unsigned int id, void*/*H5Z_class2_t* */);
86 EXTERNL int nc_filter_client_unregister(unsigned int id);
87 EXTERNL int nc_filter_client_inq(unsigned int id, void*/*H5Z_class2_t* */);
88 
89 /* HDF5 specific filter info */
90 typedef struct NC4_Filterspec {
92  /* HDF5 specific extensions */
93  unsigned int filterid;
94  size_t nparams;
95  unsigned int* params;
97 
98 EXTERNL void NC4_filterfix8(unsigned char* mem, int decode);
99 
100 EXTERNL int NC_parsefilterlist(const char* listspec, int* formatp, size_t* nfilters, NC_Filterspec*** filtersp);
101 EXTERNL int NC_parsefilterspec(const char* txt, int format, NC_Filterspec** specp);
102 
103 /* End HDF5 Specific Declarations */
104 
105 /**************************************************/
106 
107 #if defined(__cplusplus)
108 }
109 #endif
110 
111 #endif /* NETCDF_FILTER_H */
unsigned int filterid
Definition: netcdf_filter.h:93
EXTERNL int nc_var_filter_remove(int ncid, int varid, unsigned int id)
EXTERNL int nc_inq_var_filter(int ncid, int varid, unsigned int *idp, size_t *nparams, unsigned int *params)
#define EXTERNL
Definition: netcdf.h:511
EXTERNL int nc_filter_client_unregister(unsigned int id)
EXTERNL int nc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int *parms)
struct NC_Filterspec NC_Filterspec
EXTERNL int nc_inq_var_filterids(int ncid, int varid, size_t *nfilters, unsigned int *filterids)
EXTERNL int nc_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t *nparams, unsigned int *params)
EXTERNL int NC_parsefilterlist(const char *listspec, int *formatp, size_t *nfilters, NC_Filterspec ***filtersp)
EXTERNL int NC_parsefilterspec(const char *txt, int format, NC_Filterspec **specp)
struct NC4_Filterspec NC4_Filterspec
struct NC_Filterobject NC_Filterobject
EXTERNL int nc_filter_client_register(unsigned int id, void *)
EXTERNL void NC4_filterfix8(unsigned char *mem, int decode)
NC_Filterspec hdr
Definition: netcdf_filter.h:91
EXTERNL int nc_filter_client_inq(unsigned int id, void *)
NC_Filterobject hdr
Definition: netcdf_filter.h:55
unsigned int * params
Definition: netcdf_filter.h:95

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:53