more szip tests
@@ -463,6 +463,50 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
+ printf("**** testing simple szip function use...");
+ {
+ int ncid;
+ int dimid;
+ int varid;
+ unsigned int params[NUM_PARAMS_IN];
+ int options_mask, bits_per_pixel;
+ size_t nparams;
+ unsigned int filterid;
+ unsigned int params_out[NUM_PARAMS_OUT];
+ unsigned int tmp;
+
+ /* Create a netcdf-4 file with one dimensions. */
+ if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+ if (nc_def_dim(ncid, DIM_NAME_1, DIM_LEN_1, &dimid)) ERR;
+
+ /* Add a var. Turn on szip filter. */
+ if (nc_def_var(ncid, V_SMALL, NC_INT64, NDIMS1, &dimid, &varid)) ERR;
+ params[0] = NC_SZIP_NN_OPTION_MASK; /* options_mask */
+ params[1] = NC_SZIP_EC_BPP_IN; /* bits_per_pixel */
+ if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, NULL)) ERR;
+ if (nc_def_var_filter(ncid, varid, H5_FILTER_SZIP, NUM_PARAMS_IN, params)) ERR;
+ if (nc_close(ncid)) ERR;
+
+ /* Open the file and check. */
+ if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
+ /* The following code should work, but doesn't. See issue 972 in github. */
+ if (nc_inq_var_szip(ncid, varid, &options_mask, &bits_per_pixel)) ERR;
+ /* H5Zszip code will sometimes bump the bits_per_pixel from 32 to 64
+ and may add other flags to the options_mask */
+ tmp = options_mask & NC_SZIP_NN_OPTION_MASK;
+ if (tmp != NC_SZIP_NN_OPTION_MASK) ERR;
+ if (bits_per_pixel != NC_SZIP_EC_BPP_IN && bits_per_pixel != NC_SZIP_EC_BPP_OUT)
+ ERR;
+
+ /* Also check using nc_inq_var_filter */
+ if (nc_inq_var_filter(ncid, varid, &filterid, &nparams, params_out)) ERR;
+ if (filterid != H5_FILTER_SZIP || nparams != 4) ERR;
+ /* According to H5Zszip, the mapping should be as follows */
+ if(params_out[0] != options_mask) ERR;
+ if(params[1] != bits_per_pixel) ERR;
+ if (nc_close(ncid)) ERR;
+ }
+ SUMMARIZE_ERR;
printf("**** testing more complex use of szip...");
{
#define D_SMALL "small_dim"
