Commit Graph

156 Commits

Author SHA1 Message Date
Dennis Heimbigner
a03bb5e601 Fix infinite loop in file inferencing
re: Issue https://github.com/Unidata/netcdf-c/issues/2573

The file type inferencer in libdispatch/dinference.c has a simple
forward inference mechanism so that the occurrence of certain mode
values in a URL fragment implies inclusion of additional mode values.
This kind of inference is notorious for leading to cycles if not
careful. Unfortunately, this occurred in the one in dinference.c.

This was fixed by providing a more complicated, but more reliable inference
mechanism.

## Misc. Other Changes
* Found and fixed a couple of memory leaks.
* There is a recent problem in building HDF4 support on github actions. Fixed by using the internal HDF4 xdr capability.
* Some filter-related code was not being properly ifdef'd with ENABLE_NCZARRA_FILTERS.
2022-12-18 13:18:00 -07:00
DWesl
a0aa2b3e11 CI: Revert Windows CI run on push.
I requested this when working on a branch,
rather than a pull request.
This is a PR now, so I should go back to how
things were before.
2022-10-13 19:31:42 -04:00
DWesl
18b76baed0 CI: Disable CMake tests on Cygwin and MinGW.
Cygwin tests don't pass for no reason I can discern; MinGW tests don't
build, again for no reason I can discern.
2022-10-12 13:36:52 -04:00
DWesl
b85c929a97 CI: Prep Cygwin CI run for adding CMake build. 2022-10-12 12:58:04 -04:00
DWesl
d33e3155d8 CI: Try to skip failing NCZarr Plugin tests on MinGW 2022-10-12 12:58:01 -04:00
DWesl
1ef000cae1 CI, DBG: Upload MinGW test logs on failure. 2022-10-12 12:55:37 -04:00
DWesl
f000e15cb5 BLD: Try fixing the export-symbols problem on MinGW
It's not exporting symbols at the moment, and I'd prefer to avoid -Wl,--export-all-symbols.
2022-10-12 12:55:35 -04:00
DWesl
086eed0e39 CI, TST: Check that test plugins don't get installed with DESTDIR
This caused problems for packagers (unidata/netcdf-c#2431)
2022-10-12 10:54:40 -04:00
DWesl
a69308e5b7 CI: Add Cygwin CI run. 2022-10-12 10:54:38 -04:00
Ward Fisher
9b9fcfb6ba Update hdf5 version in github actions. 2022-09-09 16:15:42 -06:00
Dennis Heimbigner
6abaab967b Fix some problems with PR https://github.com/Unidata/netcdf-c/pull/2492
re: PR https://github.com/Unidata/netcdf-c/pull/2492
re: Issue https://github.com/Unidata/netcdf-c/issues/2494

This PR fixes some problems with the pull request https://github.com/Unidata/netcdf-c/pull/2492 in response to Issue https://github.com/Unidata/netcdf-c/issues/2494.

* Found and fixed more scalar handling problems and add a test case for scalars.
* Cleanup nczarr_test/run_string.sh test
* Document *_nczarr_default_maxstrlen* and *_nczarr_maxstrlen*.

* Support both "Nan" and *Nan* as being floating point constants
  for attributes. It is unclear from the Zarr V2 spec if
  unquoted *Nan* is legal or not, but support for reading.
  Write the quoted versions when writing an attribute.  Similar
  for Infinity constants.
  So NCZarr supports the following constants for use in Attributes
    * *Nan*, "Nan", *-Nan*, "-Nan"
    * *Nanf*, "Nanf", *-Nanf*, "-Nanf"
    * *Infinity*, "Infinity", *-Infinity*, "-Infinity"
    * *Infinityf*, "Infinityf", *-Infinityf*, "-Infinityf"
2022-09-03 14:21:48 -06:00
Dennis Heimbigner
231ae96c4b Add support for Zarr string type to NCZarr
* re: https://github.com/Unidata/netcdf-c/pull/2278
* re: https://github.com/Unidata/netcdf-c/issues/2485
* re: https://github.com/Unidata/netcdf-c/issues/2474

This PR subsumes PR https://github.com/Unidata/netcdf-c/pull/2278.
Actually is a bit an omnibus covering several issues.

## PR https://github.com/Unidata/netcdf-c/pull/2278
Add support for the Zarr string type.
Zarr strings are restricted currently to be of fixed size.
The primary issue to be addressed is to provide a way for user to
specify the size of the fixed length strings. This is handled by providing
the following new attributes special:
1. **_nczarr_default_maxstrlen** —
This is an attribute of the root group. It specifies the default
maximum string length for string types. If not specified, then
it has the value of 64 characters.
2. **_nczarr_maxstrlen** —
This is a per-variable attribute. It specifies the maximum
string length for the string type associated with the variable.
If not specified, then it is assigned the value of
**_nczarr_default_maxstrlen**.

This PR also requires some hacking to handle the existing netcdf-c NC_CHAR
type, which does not exist in zarr. The goal was to choose numpy types for
both the netcdf-c NC_STRING type and the netcdf-c NC_CHAR type such that
if a pure zarr implementation read them, it would still work and an
NC_CHAR type would be handled by zarr as a string of length 1.

For writing variables and NCZarr attributes, the type mapping is as follows:
* "|S1" for NC_CHAR.
* ">S1" for NC_STRING && MAXSTRLEN==1
* ">Sn" for NC_STRING && MAXSTRLEN==n

Note that it is a bit of a hack to use endianness, but it should be ok since for
string/char, the endianness has no meaning.

For reading attributes with pure zarr (i.e. with no nczarr
atribute types defined), they will always be interpreted as of
type NC_CHAR.

## Issue: https://github.com/Unidata/netcdf-c/issues/2474
This PR partly fixes this issue because it provided more
comprehensive support for Zarr attributes that are JSON valued expressions.
This PR still does not address the problem in that issue where the
_ARRAY_DIMENSION attribute is incorrectly set. Than can only be
fixed by the creator of the datasets.

## Issue: https://github.com/Unidata/netcdf-c/issues/2485
This PR also fixes the scalar failure shown in this issue.
It generally cleans up scalar handling.
It also adds a note to the documentation describing that
NCZarr supports scalars while Zarr does not and also how
scalar interoperability is achieved.

## Misc. Other Changes
1. Convert the nczarr special attributes and keys to be all lower case. So "_NCZARR_ATTR" now used "_nczarr_attr. Support back compatibility for the upper case names.
2. Cleanup my too-clever-by-half handling of scalars in libnczarr.
2022-08-27 20:21:13 -06:00
Ward Fisher
7d6d4b9b40 Fix a typo. 2022-06-28 16:31:15 -06:00
Ward Fisher
73a0d92f9d Fix a typo. 2022-06-28 16:30:26 -06:00
Ward Fisher
e34f8d5dc0 Run one-off tests first. 2022-06-28 16:29:35 -06:00
Ward Fisher
ff34b66182 Fix cache check. 2022-06-28 16:27:23 -06:00
Ward Fisher
bfca030037 Fixing cmake-based run_pnetcdf_tests.sh 2022-06-28 15:04:58 -06:00
Ward Fisher
545ce88476
Merge pull request #2377 from edwardhartnett/ejh_update_doxyfile
Updating Doxyfile.in with doxygen-1.8.17, turned on WARN_AS_ERROR, added doxygen build to CI run
2022-06-22 13:31:25 -06:00
Ward Fisher
d6dee0c8ca Add libxml2 install to mingw GitHub actions. 2022-06-21 17:05:47 -06:00
Ward Fisher
5f1e18b83d Add manual GitHub actions triggers for the tests. 2022-06-13 16:56:22 -06:00
Ward Fisher
c3ed070fe5 Testing manual workflow_dispatch for github actions. 2022-06-09 15:04:10 -06:00
Edward Hartnett
ce767aec23 change to trigger CI 2022-06-08 07:08:21 +03:00
Edward Hartnett
1e8b98bd06 installing doxygen in CI when needed 2022-06-07 18:04:15 +03:00
Edward Hartnett
e3ccb4a22c installing doxygen in CI when needed 2022-06-07 16:01:07 +03:00
Edward Hartnett
981f452952 installing doxygen in CI when needed 2022-06-07 15:55:18 +03:00
Edward Hartnett
aa7e07007c installing doxygen in CI when needed 2022-06-07 15:40:24 +03:00
Edward Hartnett
c051209f8b turned on WARN_AS_ERROR and added documentation build to CI 2022-06-07 15:24:21 +03:00
Edward Hartnett
581b1c1c4d updated Doxyfile.in 2022-06-07 15:10:20 +03:00
Edward Hartnett
a76a6795e7 checking doxygen version 2022-06-07 14:57:23 +03:00
Dennis Heimbigner
d34a222141 Turn off debug 2022-04-30 21:43:08 -06:00
Dennis Heimbigner
f897b458ea Fix szip handling 2022-04-30 19:06:01 -06:00
Dennis Heimbigner
a8aa6e3db3 Remove debug 2022-04-29 14:38:18 -06:00
Dennis Heimbigner
126b3f9423 Support installation of filters into user-specified location
re: https://github.com/Unidata/netcdf-c/issues/2294

Ed Hartnett suggested that the netcdf library installation process
be extended to install the standard filters into a user specified
location. The user can then set HDF5_PLUGIN_PATH to that location.

This PR provides that capability using:
````
configure option: --with-plugin-dir=<absolute directory path>
cmake option: -DPLUGIN_INSTALL_DIR=<absolute directory path>
````

Currently, the following plugins are always installed, if
available: bzip2, zstd, blosc.
If NCZarr is enabled, then additional plugins are installed:
fletcher32, shuffle, deflate, szip.

Additionally, the necessary codec support is installed
for each of the above filters that is installed.

## Changes:
1. Cleanup handling of built-in bzip2.
2. Add documentation to docs/filters.md
3. Re-factor the NCZarr codec libraries
4. Add a test, although it can only be exercised after
   the library is installed, so it cannot be used during
   normal testing.
5. Cleanup use of HDF5_PLUGIN_PATH in the filter test cases.
2022-04-29 14:31:55 -06:00
Ward Fisher
516c73b5d9 Made the parallel build action label mention pnetcdf. 2022-04-21 14:34:18 -06:00
Ward Fisher
ad9650604f Remove on-push trigger for OSX-based workflows. 2022-04-21 14:23:53 -06:00
Edward Hartnett
0cfc4370da untabified 2022-04-09 11:41:40 -06:00
Edward Hartnett
a7e1734568 adding pnetcdf 2022-04-09 11:32:43 -06:00
Ward Fisher
e6853c24f0
Merge pull request #2273 from edwardhartnett/ejh_par
turning on parallel I/O tests in CI
2022-04-06 14:44:02 -06:00
Ward Fisher
3446aa0c13 Merge branch 'winutf8.dmh' of https://github.com/DennisHeimbigner/netcdf-c into gh2222.wif 2022-04-05 10:46:22 -06:00
Edward Hartnett
5f9a676363 turning on parallel tests 2022-04-05 09:38:02 -06:00
Edward Hartnett
bce16a73e1 turning off parallel tests? 2022-04-05 09:14:26 -06:00
Edward Hartnett
99ce0e8cbc turning on parallel I/O tests in CI 2022-04-05 05:20:17 -06:00
Ward Fisher
40412e6db5 Correct compiler issue with parallel one-off test. 2022-03-28 13:55:02 -06:00
Ward Fisher
2f3b7fc922 Correct dependency chain for Github Actions. 2022-03-28 13:45:10 -06:00
Ward Fisher
7d76990596 Added first pass at a parallel github actions one-off 2022-03-28 13:43:07 -06:00
Ward Fisher
418c7c86c5 Reconfiguring the Ubuntu Github Actions test. 2022-03-28 13:32:04 -06:00
Dennis Heimbigner
bbdfec2dcf retry 2022-03-14 14:14:08 -06:00
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
Dennis Heimbigner
36102e3c32 Improve UTF8 Support On Windows
re: Issue https://github.com/Unidata/netcdf-c/issues/2190

The primary purpose of this PR is to improve the utf8 support
for windows. This is persuant to a change in Windows that
supports utf8 natively (almost). The almost means that it is
still utf16 internally and the set of characters representable
by utf8 is larger than those representable by utf16.

This leaves open the question in the Issue about handling
the Windows 1252 character set.

This required the following changes:

1. Test the Windows build and major version in order to see if
   native utf8 is supported.
2. If native utf8 is supported, Modify dpathmgr.c to call the 8-bit
   version of the windows fopen() and open() functions.
3. In support of this, programs that use XGetOpt (Windows versions)
   need to get the command line as utf8 and then parse to
   arc+argv as utf8. This requires using a homegrown command line parser
   named XCommandLineToArgvA.
4. Add a utility program called "acpget" that prints out the
   current Windows code page and locale.

Additionally, some technical debt was cleaned up as follows:

1. Unify all the places which attempt to read all or a part
   of a file into the dutil.c#NC_readfile code.
2. Similary unify all the code that creates temp files into
   dutil.c#NC_mktmp code.
3. Convert almost all remaining calls to fopen() and open()
   to NCfopen() and NCopen3(). This is to ensure that path management
   is used consistently. This touches a number of files.
4. extern->EXTERNL as needed to get it to work under Windows.
2022-02-08 20:53:30 -07:00