Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nc_inq_var_szip() fails before enddef for szip filter #1622

Closed
edwardhartnett opened this issue Feb 4, 2020 · 0 comments · Fixed by #1629
Closed

nc_inq_var_szip() fails before enddef for szip filter #1622

edwardhartnett opened this issue Feb 4, 2020 · 0 comments · Fixed by #1629

Comments

@edwardhartnett
Copy link
Contributor

This is a pretty minor issue, but it stands in the way of several other szip issues.

When setting the szip filter (with nc_def_var_filter() or nc_def_var_szip()), subsequent calls to nc_inq_var_szip() before enddef will fail to find that szip is set. From test_szip.c:

    szip_params[0] = H5_SZIP_NN_OPTION_MASK;
    szip_params[1] = H5_SZIP_MAX_PIXELS_PER_BLOCK_IN;
    { int stat = nc_def_var_filter(ncid, varid, HDF5_FILTER_SZIP, 2, szip_params);
       if(stat) {
         fprintf(stderr,"XXX: %d %s\b",stat,nc_strerror(stat));
         ERR;
       }
    }
    if(nc_inq_var_szip(ncid, varid, &options_mask_in, &pixels_per_block_in)) ERR;
    if(!(options_mask_in & H5_SZIP_NN_OPTION_MASK)) ERR;

I added the last two lines of code, and the second fails, because of this code in nc_inq_var_szip() (in dvarinq.c):

    if(id != H5Z_FILTER_SZIP || nparams != 4) 
         return NC_EFILTER; /* not szip or bad # params */ 

The problem is that szip has only 2 parameters until it is set by HDF5, then the number becomes 4. ;-)

Once enddef happens, the filter info is written to the dataset on disk, and from then on, nc_inq_var_szip() works correctly.

I will have a fix up shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment