Commit Graph

108 Commits

Author SHA1 Message Date
Dennis Heimbigner
3ffe7be446 Enhance/Fix filter support
re: Discussion https://github.com/Unidata/netcdf-c/discussions/2214

The primary change is to support so-called "standard filters".
A standard filter is one that is defined by the following
netcdf-c API:
````
int nc_def_var_XXX(int ncid, int varid, size_t nparams, unsigned* params);
int nc_inq_var_XXXX(int ncid, int varid, int* usefilterp, unsigned* params);
````
So for example, zstandard would be a standard filter by defining
the functions *nc_def_var_zstandard* and *nc_inq_var_zstandard*.

In order to define these functions, we need a new dispatch function:
````
int nc_inq_filter_avail(int ncid, unsigned filterid);
````
This function, combined with the existing filter API can be used
to implement arbitrary standard filters using a simple code pattern.
Note that I would have preferred that this function return a list
of all available filters, but HDF5 does not support that functionality.

So this PR implements the dispatch function and implements
the following standard functions:
    + bzip2
    + zstandard
    + blosc
Specific test cases are also provided for HDF5 and NCZarr.
Over time, other specific standard filters will be defined.

## Primary Changes
* Add nc_inq_filter_avail() to netcdf-c API.
* Add standard filter implementations to test use of *nc_inq_filter_avail*.
* Bump the dispatch table version number and add to all the relevant
   dispatch tables (libsrc, libsrcp, etc).
* Create a program to invoke nc_inq_filter_avail so that it is accessible
  to shell scripts.
* Cleanup szip support to properly support szip
  when HDF5 is disabled. This involves detecting
  libsz separately from testing if HDF5 supports szip.
* Integrate shuffle and fletcher32 into the existing
  filter API. This means that, for example, nc_def_var_fletcher32
  is now a wrapper around nc_def_var_filter.
* Extend the Codec defaulting to allow multiple default shared libraries.

## Misc. Changes
* Modify configure.ac/CMakeLists.txt to look for the relevant
  libraries implementing standard filters.
* Modify libnetcdf.settings to list available standard filters
  (including deflate and szip).
* Add CMake test modules to locate libbz2 and libzstd.
* Cleanup the HDF5 memory manager function use in the plugins.
* remove unused file include//ncfilter.h
* remove tests for the HDF5 memory operations e.g. H5allocate_memory.
* Add flag to ncdump to force use of _Filter instead of _Deflate
  or _Shuffle or _Fletcher32. Used for testing.
2022-03-14 12:39:37 -06:00
Dennis Heimbigner
9b7202bf06 Explicitly disallow variable length type compression
re: https://github.com/Unidata/netcdf-c/issues/2189

Compression of a variable whose type is variable length
fails for all current filters. This is because at some point,
the compression buffer will contain pointers to data instead
of the actual data. Compression of pointers of course is meaningless.

The PR changes the behavior of nc_def_var_filter so that it will
fail with error NC_EFILTER if an attempt is made to add a filter
to a variable whose type is variable-length.

A variable is variable-length if it is of type string or VLEN
or transitively (via a compound type) contains a string or VLEN.

Also added a test case for this.

## Misc Changes
1. Turn off a number of debugging statements
2022-02-19 16:47:31 -07:00
Dave Allured
0b15d5a0ab
CI: Update HDF5 testing 1.8.21 --> 1.8.22
Update matrix for latest HDF5 1.8.22.
Released 2021 February 5.
https://portal.hdfgroup.org/display/support/HDF5%201.8.22
2022-01-31 15:14:29 -07:00
Dennis Heimbigner
610d8ebf51 Fix conflicts with main 2022-01-28 13:12:03 -07:00
Ward Fisher
b1b59e1760 Correct trigger event for mingw tests to pull_request from push' 2022-01-24 16:31:34 -07:00
Ward Fisher
a8c5307ed3 Removing cmake-based tests for now. 2022-01-24 16:23:42 -07:00
Ward Fisher
16115303a5 Missing pipe character. 2022-01-24 16:15:57 -07:00
Ward Fisher
05e207f5ca Syntax error. 2022-01-24 16:12:11 -07:00
Ward Fisher
acbbde16a1 Syntax error. 2022-01-24 16:10:51 -07:00
Ward Fisher
db98c57af6 HDF5 configuration diagnostic output 2022-01-24 16:09:39 -07:00
Ward Fisher
472e4c8b36 Oh right, Unix Makefiles 2022-01-24 16:02:45 -07:00
Ward Fisher
3058b760ad Force CMake to use gcc 2022-01-24 15:59:10 -07:00
Ward Fisher
7e1c770dff Adding hdf5 info for cmake-based tests. 2022-01-24 15:55:13 -07:00
Ward Fisher
f12eb2d0f9 Moving on to cmake-based github actions. 2022-01-24 15:47:27 -07:00
Dennis Heimbigner
446348ed18 Add complete bitgroom support to NCZarr
re: PR https://github.com/Unidata/netcdf-c/pull/2088
re: PR https://github.com/Unidata/netcdf-c/pull/2130
replaces: https://github.com/Unidata/netcdf-c/pull/2140

Changes:
* Add NCZarr-specific quantize functions to the dispatch table.
* Copy (modified) quantize code from libhdf5 to NCZarr
* Add quantize invocation to zvar.c
* Add support for _QuantizeBitgroomNumberOfSignificantDigits
and _QuantizeGranularBitgroomNumberOfSignificantDigits to ncgen.
* Modify nc_test4/tst_quantize.c to allow it to be used both for hdf5
  and for nczarr.
* Make dap4 properly handle quantize functions in dispatch table.
* Add quantize attribute support to ncgen.

Other changes:
* Caught and fixed some S3 problems
* Fixed some nczarr fillvalue problems.
* Fixed some nczarr cache problems.
* Cleanup some flaws in libdispatch/dinfermodel.c
* Allow byterange requests to S3 be readable by dinfermodel.c/check_file_type
* Remove the libnczarr ztracedispatch code (big change).
2022-01-24 15:22:24 -07:00
Ward Fisher
27db0f2354 More tweaks. 2022-01-24 15:21:29 -07:00
Ward Fisher
3c017da5e3 Collapse build and run test steps into a single step, no need to build all the tests before seeing if any fail. 2022-01-24 15:11:58 -07:00
Ward Fisher
3898d4f80a Remove stray text. 2022-01-24 13:18:05 -07:00
Ward Fisher
84070ad177 Next iteration of compilation test. 2022-01-24 13:08:55 -07:00
Ward Fisher
08598a761f Additional compilation work. 2022-01-24 12:20:04 -07:00
Ward Fisher
e8e3141cb1 Really simplify things. 2022-01-24 11:45:46 -07:00
Ward Fisher
0333da7be5 Clean up some Unix-related cruft. 2022-01-24 11:38:21 -07:00
Ward Fisher
ddd675a6d7 Temporarily disable cache 2022-01-24 11:30:14 -07:00
Ward Fisher
d0ad57fb3e Further developments unfolding. 2022-01-24 11:24:45 -07:00
Ward Fisher
d76fbe3fc2 Remove stray text. 2022-01-24 11:06:21 -07:00
Ward Fisher
3a12cee940 Working on MinGW/MSYS2 support. Attempting workflow with system-installed libhdf5 2022-01-24 11:05:33 -07:00
Ward Fisher
a6e7ad17a2 Added cmake to the mingw-based test. 2022-01-24 10:54:00 -07:00
Ward Fisher
4ad9f00493 Add skeleton mingw/msys2 Github CI tests. 2022-01-24 10:51:19 -07:00
Ward Fisher
5f3de855e5
Merge pull request #2194 from WardF/update-hdf5-github-actions.wif
Collapse and update the HDF5 versions being tested on Github Actions.
2022-01-21 10:34:06 -07:00
Ward Fisher
6d5305afd6 Collapse and update the HDF5 versions being tested on Github Actions. 2022-01-21 09:10:45 -07:00
Ward Fisher
2570ac1849 Avoid name collision in macOS tests. 2022-01-21 09:01:40 -07:00
Ward Fisher
c7dc1c25a1 Removed OSX tests from run-on-push, modify so that they run on pull request. 2022-01-20 17:11:22 -07:00
Ward Fisher
286abab31f Refactor triggers on GA runs. 2022-01-20 16:55:18 -07:00
Ward Fisher
2d39cc297e Add a missing space. 2022-01-20 16:53:06 -07:00
Ward Fisher
bbf1433c30 Remove HDF4 2022-01-20 16:38:29 -07:00
Ward Fisher
7a6accad44 More work on the OSX github actions. 2022-01-20 16:25:52 -07:00
Ward Fisher
c01f4adf8e Additional expansion of naming. 2022-01-20 16:13:38 -07:00
Ward Fisher
9a03ef6f20 Cache automake install. 2022-01-20 16:11:32 -07:00
Ward Fisher
0fb73f8545 Move autoconf installation stanza 2022-01-20 16:01:07 -07:00
Ward Fisher
4fdb855a20 More scripting. 2022-01-20 15:57:32 -07:00
Ward Fisher
36edd4ce96 Installing autoconf tools 2022-01-20 15:53:29 -07:00
Ward Fisher
532156f188 Remove more calls to apt. 2022-01-20 15:49:34 -07:00
Ward Fisher
e5c68d087e Removed call to autoreconf 2022-01-20 15:15:49 -07:00
Ward Fisher
7059f28719 Syntax error discovered (I hope) 2022-01-20 15:14:28 -07:00
Ward Fisher
3020729638 Remove ubuntu-specific thing. 2022-01-20 15:05:14 -07:00
Ward Fisher
815483b5b8 Sorting out the reported syntax error. 2022-01-20 15:04:01 -07:00
Ward Fisher
c0f0c7a6a4 More testing. 2022-01-20 15:01:51 -07:00
Ward Fisher
10cc5038d3 Temporarily disable ubuntu tests on PR. 2022-01-20 14:58:38 -07:00
Ward Fisher
65e5fd857c Temporarily disable ubuntu tests on PR. 2022-01-20 14:57:02 -07:00
Ward Fisher
d951322351 Renaming jobs to differentiate between Ubuntu and Linux jobs. 2022-01-20 14:49:50 -07:00