Commit Graph

757 Commits

Author SHA1 Message Date
Dennis Heimbigner
91f3e75cab Fix missing casts of var->filters 2020-10-09 21:26:29 -06:00
Dennis Heimbigner
aeb3ac2809 Mostly revert the filter code to reduce its complexity of use.
re: https://github.com/Unidata/netcdf-c/issues/1836

Revert the internal filter code to simplify it. From the user's
point of view, the only visible changes should be:

1. The functions that convert text to filter specs have had their signature reverted and have been moved to netcdf_aux.h
2. Some filter API functions now return NC_ENOFILTER when inquiry is made about some filter.

Internally,the dispatch table has been modified to get rid of the filter_actions
entry and associated complex structures. It has been replaced with
inq_var_filter_ids and inq_var_filter_info entries and the dispatch table
version has been bumped to 3. Corresponding NOOP and NOTNC4 functions
were added to libdispatch/dnotnc4.c. Also, the filter_action entries
in dispatch tables were replaced for all dispatch code bases (HDF5, DAP2,
etc). This should only impact UDF users.

In the process, it became clear that the form of the filters
field in NC_VAR_INFO_T was format dependent, so I converted it to
be of type void* and pushed its management into the various dispatch
code bases. Specifically libhdf5 and libnczarr now manage the filters
field in their own way.

The auxilliary functions for parsing textual filter specifications
were moved to netcdf_aux.h and were renamed to the following:
* ncaux_h5filterspec_parse
* ncaux_h5filterspec_parselist
* ncaux_h5filterspec_free
* ncaux_h5filter_fix8

Misc. Other Changes:

1. Document NUG/filters.md updated to reflect the changes above.
2. All the old data types (structs and enums)
   used by filter_actions actions were deleted.
   The exception is the NC_H5_Filterspec because it is needed
   by ncaux_h5filterspec_parselist.
3. Clientside filters were removed -- another enhancement
   for which no-one ever asked.
4. The ability to remove filters was itself removed.
5. Some functionality needed by nczarr was moved from libhdf5
   to libsrc4 e.g. nc4_find_default_chunksizes
6. All the filterx code was removed
7. ncfilter.h and nc4filter.c no longer used

Misc. Unrelated Changes:

1. The nczarr_test makefile clean was leaving some directories; so
   add clean-local to take care of them.
2020-09-27 12:43:46 -06:00
Dennis Heimbigner
f3218a2e2c Use the built-in HDF5 byte-range reader, if available.
re: Issue https://github.com/Unidata/netcdf-c/issues/1848

The existing Virtual File Driver built to support byte-range
read-only file access is quite old. It turns out to be extremely
slow (reason unknown at the moment).

Starting with HDF5 1.10.6, the HDF5 library has its own version
of such a file driver. The HDF5 developers have better knowledge
about building such a driver and what incantations are needed to
get good performance.

This PR modifies the byte-range code in hdf5open.c so
that if the HDF5 file driver is available, then it is used
in preference to the one written by the Netcdf group.

Misc. Other Changes:

1. Moved all of nc4print code to ncdump to keep appveyor quiet.
2020-09-24 14:33:58 -06:00
Tobias Kölling
a80d473ca8 Merge remote-tracking branch 'upstream/master' into virtual_datasets 2020-09-15 09:50:25 +02:00
Tobias Kölling
69fb44ec4b added NC_VIRTUAL storage layout 2020-09-03 17:51:46 +02:00
Tobias Kölling
4c27730ae3 hdf5: added unknown storage specification
In case HDF5 adds more storage specifications, netcdf4 should be able to
cope with them by default. Further specializations could be added
nonetheless.
2020-09-02 16:13:23 +02:00
Ward Fisher
31dee0c4da
Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
Ward Fisher
16c27ca13f
Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries" 2020-08-17 15:51:01 -06:00
Dennis Heimbigner
d85bb6fe20 The big change for this commit is complete the
disengagement of enable-netcdf4 from enable-hdf5.
That is, with the advent of nczarr, it is possible
to turn off hdf5 but still need netcdf-4 enabled
because nczarr uses libsrc4, but not libhdf5.
This change involves a bunch of things:
1. Modify configure.ac and CMakelist to make enable_hdf5
   control if hdf5 support is provided. For back compatibility,
   disable-netcdf4 is treated as disable-hdf5. But internally,
   netcdf4 support is controlled only by the enabling of formats
   that require it.
2. In support of #1, modify .travis.yml to use enable/disable-hdf5
   instead of enable/disable-netcdf4.
3. test_common.in is modified to track selected features,
   including enable-hdf5 and enable-s3-tests. This is used in
   selected tests that mix netcdf-3 and netcdf4 tests.
4. The conflation of USE_HDF5 and USE_NETCDF4 is common in
   code, tests, and build files, so all of those had to be weeded out.
5. It turns out that some of the NC4_dim functions really are HDF5 specific,
   but are not treated as such. So they are moved from nc4dim.c to
   hdf5dim.c or hdf5dispatch.c
6. Some generic functions in libhdf5 can be (and were) moved to libsrc4.
2020-08-12 15:42:50 -06:00
Dennis Heimbigner
59e04ae071 This PR adds EXPERIMENTAL support for accessing data in the
cloud using a variant of the Zarr protocol and storage
format. This enhancement is generically referred to as "NCZarr".

The data model supported by NCZarr is netcdf-4 minus the user-defined
types and the String type. In this sense it is similar to the CDF-5
data model.

More detailed information about enabling and using NCZarr is
described in the document NUG/nczarr.md and in a
[Unidata Developer's blog entry](https://www.unidata.ucar.edu/blogs/developer/en/entry/overview-of-zarr-support-in).

WARNING: this code has had limited testing, so do use this version
for production work. Also, performance improvements are ongoing.
Note especially the following platform matrix of successful tests:

Platform | Build System | S3 support
------------------------------------
Linux+gcc      | Automake     | yes
Linux+gcc      | CMake        | yes
Visual Studio  | CMake        | no

Additionally, and as a consequence of the addition of NCZarr,
major changes have been made to the Filter API. NOTE: NCZarr
does not yet support filters, but these changes are enablers for
that support in the future.  Note that it is possible
(probable?) that there will be some accidental reversions if the
changes here did not correctly mimic the existing filter testing.

In any case, previously filter ids and parameters were of type
unsigned int. In order to support the more general zarr filter
model, this was all converted to char*.  The old HDF5-specific,
unsigned int operations are still supported but they are
wrappers around the new, char* based nc_filterx_XXX functions.
This entailed at least the following changes:
1. Added the files libdispatch/dfilterx.c and include/ncfilter.h
2. Some filterx utilities have been moved to libdispatch/daux.c
3. A new entry, "filter_actions" was added to the NCDispatch table
   and the version bumped.
4. An overly complex set of structs was created to support funnelling
   all of the filterx operations thru a single dispatch
   "filter_actions" entry.
5. Move common code to from libhdf5 to libsrc4 so that it is accessible
   to nczarr.

Changes directly related to Zarr:
1. Modified CMakeList.txt and configure.ac to support both C and C++
   -- this is in support of S3 support via the awd-sdk libraries.
2. Define a size64_t type to support nczarr.
3. More reworking of libdispatch/dinfermodel.c to
   support zarr and to regularize the structure of the fragments
   section of a URL.

Changes not directly related to Zarr:
1. Make client-side filter registration be conditional, with default off.
2. Hack include/nc4internal.h to make some flags added by Ed be unique:
   e.g. NC_CREAT, NC_INDEF, etc.
3. cleanup include/nchttp.h and libdispatch/dhttp.c.
4. Misc. changes to support compiling under Visual Studio including:
   * Better testing under windows for dirent.h and opendir and closedir.
5. Misc. changes to the oc2 code to support various libcurl CURLOPT flags
   and to centralize error reporting.
6. By default, suppress the vlen tests that have unfixed memory leaks; add option to enable them.
7. Make part of the nc_test/test_byterange.sh test be contingent on remotetest.unidata.ucar.edu being accessible.

Changes Left TO-DO:
1. fix provenance code, it is too HDF5 specific.
2020-06-28 18:02:47 -06:00
Greg Sjaardema
605b9ccd66
Remove duplicate references to error4.c
The `error4.c` file is already listed in `libsrc4_SOURCES`, so does not need to be added again later.  The file's contents are only compiled if `LOGGING` is defined, so is ok to always compile.
2020-05-11 13:21:10 -06:00
Dennis Heimbigner
b0e0d81aa9 Fix reclamation of the ->format_XXX_info fields
nc4internal.c contains code to free the format_XXX_info
fields. Since these are format specific, this code
was moved to the dispatch code (libhdf5 and libhdf4
in the current case).

Additionally, there are some fields in nc4internal.h (e.g.
dimscale fields) that are specific to HDF5 and have been moved
to the corresponding HDF5 data structures and code.

Misc. other changes:
1. NC_VAR_INFO_T->hdf5_name renamed to alt_name to avoid
   implying it is necessarily HDF5 specific.
2. prefix NC_FILE_INFO_T with an instance of NC_OBJ for consistency.
   this also requires wrapping move_in_NCList() to keep
   hdr.id consistent.
2020-03-29 12:48:59 -06:00
Edward Hartnett
e7b9b1b587 fixed documentation of cache int functions 2020-03-24 15:02:42 -06:00
Edward Hartnett
fcceec60a4 now using storage everywhere 2020-03-08 07:13:07 -06:00
Edward Hartnett
b98a37e0b3 using storage field in nc4var.c 2020-03-08 06:38:44 -06:00
Dennis Heimbigner
7d1ca9ac85 fix references to var->deflate' 2020-03-02 11:12:30 -07:00
Dennis Heimbigner
b488c272d5 Fix conflicts with master 2020-02-27 14:06:45 -07:00
Dennis Heimbigner
44d0dcaad2 Add support for multiple filters per variable.
re: https://github.com/Unidata/netcdf-c/issues/1584

Support has been added for multiple filters per variable.  This
affects a number of components in netcdf. The new APIs are
documented in NUG/filters.md.

The primary changes are:
* A set of new functions are provided (see __include/netcdf_filter.h__).
    - Obtain a list of the filters associated with a variable
    - Obtain the parameters for a specific filter.
* The existing __nc_inq_var_filter__ function now returns info
  about the first defined filter.
* The utilities (ncgen, ncdump, and nccopy) now support
  an extended format for specifying a sequence of filters.
  The general form is __<filter>|<filter>..._.
* The ncdump **_Filter** attribute now dumps a list of all the
  filters associated with a variable using the above new format.
* Filter specifications can now use a filter name instead of number
  for filters known to the netcdf library, which in turn is taken
  from the HDF5 filter registration page.
* New errors are defined: NC_EFILTER and NC_ENOFILTER. The latter
  is returned if an attempt is made to access an unknown filter.
* Internally, the dispatch table has been extended to add a function
  to handle all of the filter functions.
* New, filter-related, tests were added to nc_test4.
* A new plugin was added to the plugins directory to help with testing.

Notes:
1. The shuffle and fletcher32 filters are not part of the multifilter system.

Misc. changes:
1. A debug module was added to libhdf5 to help catch error locations.
2020-02-16 12:59:33 -07:00
Edward Hartnett
995cfdad96 merged master 2019-12-20 11:16:11 -07:00
Edward Hartnett
8f8dfac9f6 now prevent attempt to change to independent access when deflate, shuffle, or fletcher32 filters are in use 2019-12-20 07:16:26 -07:00
Edward Hartnett
06896f432d got compact storage test working 2019-12-04 08:49:37 -07:00
Ward Fisher
4596e1bc8b Cleaned up a couple unlikely, but technically possible, memory leaks detected by static analysis. 2019-10-24 12:55:43 -06:00
Ward Fisher
e7cc899264 Merge branch 'ejh_try2' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into gh1487.wif 2019-09-20 14:04:56 -06:00
Greg Sjaardema
56c0d5cf8a Spelling fixes 2019-09-18 08:03:01 -06:00
edwardhartnett
2cd228bcd4 porting changes from other PR 2019-09-16 11:28:18 -06:00
edwardhartnett
100e000d43 more unit tests for nc4internal.c 2019-08-21 13:34:43 -06:00
edwardhartnett
96344631a8 run tst_nc4internal for netcdf4 builds only 2019-08-21 09:48:50 -06:00
edwardhartnett
e4ef7b1a65 more unit tests, this time for nc4internal.c 2019-08-21 04:46:00 -06:00
edwardhartnett
94f1a89a40 final removal 2019-08-15 07:05:10 -06:00
Ward Fisher
90fb2e1223
Merge pull request #1415 from ZedThree/non-signalling-fp-comparison
Use quiet comparison when converting from double to float
2019-08-06 11:35:31 -06:00
edwardhartnett
83c6cd58a7 more changes in support of user-defined formats 2019-08-03 17:19:13 -06:00
edwardhartnett
7ce322a6f1 now have libhdf5 use nc4_file_list_add() 2019-08-02 09:29:18 -06:00
edwardhartnett
181f260a20 adding, and starting to use nc4_file_list_add() 2019-08-02 09:14:35 -06:00
Ed Hartnett
76d6b55eff moved call to nc4_rec_grp_del() to inside nc4_nc4f_list_del() 2019-07-16 16:29:06 -06:00
Ed Hartnett
b8e50c9254 moved freeing of allvars, alldims, alltypes lists to nc4_nc4f_list_del 2019-07-16 16:16:11 -06:00
Ed Hartnett
e9666f7333 moved free(h5) intonc4_nc4f_list_del 2019-07-16 16:07:21 -06:00
Ed Hartnett
d840c1864c removed unused prototype 2019-07-16 16:02:08 -06:00
Peter Hill
7b7069980b
Use quiet comparison when converting from double to float 2019-06-05 10:47:56 +01:00
Ed Hartnett
150662dd0b changes to support build of libsrc4 without libhdf5 2019-05-22 07:50:12 -06:00
Dennis Heimbigner
6934aa2e8b Thread safety: step 1: cleanup
re: https://github.com/Unidata/netcdf-c/issues/1373 (partial)

* Mark some global constants be const to indicate to make them easier to track.
* Hide direct access to the ncrc_globalstate behind a function call.
* Convert dispatch tables to constants (except the user defined ones)
  This has some consequences in terms of function arguments needing to be marked
  as const also.
* Remove some no longer needed global fields
* Aggregate all the globals in nclog.c
* Uniformly replace nc_sizevector{0,1} with NC_coord_{zero,one}
* Uniformly replace nc_ptrdffvector1 with NC_stride_one
* Remove some obsolete code
2019-03-30 14:06:20 -06:00
Ed Hartnett
298e8dc737 cleanup of whitespace in libsrc4 directory 2019-02-19 05:56:40 -07:00
Ed Hartnett
7c8f3a7ee6 cleanup of whitespace in libsrc4 directory 2019-02-19 05:56:30 -07:00
Ed Hartnett
ae313334b5 cleanup of whitespace in libsrc4 directory 2019-02-19 05:56:22 -07:00
Ed Hartnett
cb107c2b60 cleanup of whitespace in libsrc4 directory 2019-02-19 05:56:04 -07:00
Ed Hartnett
be6a58772e cleanup of whitespace in libsrc4 directory 2019-02-19 05:55:36 -07:00
Ed Hartnett
af91209981 cleanup of whitespace in HDF5 directory 2019-02-19 05:55:22 -07:00
Ward Fisher
9ca942b201
Merge branch 'master' into fix-warnings 2019-01-31 12:39:06 -07:00
Ward Fisher
688c06d50c
Merge branch 'master' into fix-warnings 2019-01-23 15:12:20 -07:00
Ed Hartnett
2024f0b823 removed unneeded var 2019-01-20 09:56:10 -07:00
Ed Hartnett
c6a9948a8e removed unneeded var, fixed broken log statements that cause segfaults 2019-01-20 09:37:13 -07:00
Ben Boeckel
a747216c33 warnings: mark conditionally used parameters 2019-01-16 15:53:25 -05:00
Ed Hartnett
029aa5f626 now using hidden coordinates att to speed file opens 2018-12-20 05:59:31 -07:00
Ed Hartnett
aa16d29e98 fixed comment 2018-12-17 08:43:19 -07:00
Ed Hartnett
e9bd94821d split out some var meta reading, fixed setting of var->container 2018-12-17 08:41:43 -07:00
Ed Hartnett
8ca5a1ac17
Merge branch 'master' into ejh_fast_var_prep 2018-12-12 07:05:45 -07:00
Ward Fisher
30ea33435c Merge remote-tracking branch 'origin/license_update.wif' into pr-aggregation.wif 2018-12-11 17:08:21 -05:00
Ed Hartnett
7d168f712f cleaned up nc4internal.c 2018-12-11 06:25:33 -07:00
Ward Fisher
763750fab5 More copyright stanza updates. 2018-12-06 14:56:42 -07:00
Ed Hartnett
f6443bce8f rest of separation of libhdf5 and libsrc4 2018-11-30 14:05:11 -07:00
Ed Hartnett
b5ed407e9f better handling of normalizing names in HDF5 atts 2018-11-30 13:28:18 -07:00
Ed Hartnett
433499771b moved special att reading function to libhdf5 2018-11-30 07:50:15 -07:00
Ed Hartnett
e55b9d697e separation of libhdf5 from libsrc4 2018-11-29 07:02:31 -07:00
Ed Hartnett
104b4b50fe clean up 2018-11-29 06:25:34 -07:00
Ed Hartnett
d51b221c62 move setting of var chunk cache to libhdf5 2018-11-29 06:10:39 -07:00
Ed Hartnett
1d7a9caad8 removed HDF5 finalize from libsrc4 code 2018-11-28 15:51:25 -07:00
Ed Hartnett
c824ad9ec9 further removal of libhdf5 code from libsrc4 2018-11-28 15:48:08 -07:00
Ed Hartnett
f9d3fff2c3 rest of removal of lazy att code from libsrc4 2018-11-26 11:11:56 -07:00
Ed Hartnett
016f675fad more separation of lazy att reads from libsrc4 2018-11-26 10:44:48 -07:00
Ed Hartnett
38a59a32f8 separation of lazy atts from libsrc4 2018-11-26 10:28:48 -07:00
Ed Hartnett
ba3bc50015 separation of lazy atts from libsrc4 2018-11-26 10:24:37 -07:00
Ed Hartnett
cc18944fa7 moved lazy atts handling for nc_inq_attid() 2018-11-26 09:58:31 -07:00
Ed Hartnett
8e7fc913cb moving lazy atts code to libhdf5 2018-11-26 08:24:18 -07:00
Ed Hartnett
1df4bb1762 moving lazy atts code to libhdf5 2018-11-26 08:21:32 -07:00
Ed Hartnett
6f969b0117 separate HDF5 initialization 2018-11-26 05:35:44 -07:00
Ed Hartnett
64b45b5e75 changes in support of separating HDF5 and libsrc4 2018-11-26 04:40:33 -07:00
Ed Hartnett
f6c3093fb3 moved convert function to libsrc4 2018-11-21 14:49:52 -07:00
Ed Hartnett
6bebb703a6 trying types again 2018-11-20 06:37:53 -07:00
Ed Hartnett
b5be30175d cleanup 2018-11-19 09:35:29 -07:00
Ed Hartnett
8fe3ee0dc4 clean up 2018-11-16 10:11:41 -07:00
Ed Hartnett
4c1b3a225b clean up 2018-11-16 10:07:54 -07:00
Ed Hartnett
8ae5ebf6bc remove unneeded params from function 2018-11-16 08:26:09 -07:00
Ed Hartnett
60a33b9e8b removed hdf5 stuff from NC_FIELD_INFO_T 2018-11-15 16:46:22 -07:00
Ed Hartnett
6a66ecd3d0 moving rest of var stuff 2018-11-13 17:03:11 -07:00
Ed Hartnett
4045588516 removing hid_t from NC_VAR_INFO_T 2018-11-13 16:10:34 -07:00
Ed Hartnett
f6def4a089 moving some fill value handling to libhdf5 2018-11-13 15:37:49 -07:00
Ed Hartnett
ce43b7d772 free hdf5-specific var info and cleanup 2018-11-13 05:58:54 -07:00
Ed Hartnett
578ddb2a28 cleaning up nc4internal.h 2018-11-13 05:27:46 -07:00
Ed Hartnett
6b75bb483b allocating HDF5-specific group info struct for root group 2018-11-12 09:02:46 -07:00
Ed Hartnett
9364157a9b allocating and freeing memory for HDF5-specific group info 2018-11-12 08:11:06 -07:00
Ed Hartnett
8aabd2020c moving HDF5 dim fields to hdf5internal.h from nc4internal.h 2018-11-08 07:09:11 -07:00
Ed Hartnett
7e4138a11c comment 2018-11-07 14:26:08 -07:00
Ed Hartnett
11d725facc allocating and freeing memory for hdf5-specific attribute info 2018-11-07 13:45:51 -07:00
Ed Hartnett
5f36a3b425 merged master 2018-11-02 10:00:53 -06:00
Dennis Heimbigner
245961de00 re: github issues
https://github.com/Unidata/netcdf-c/issues/1168
    https://github.com/Unidata/netcdf-c/issues/1163
    https://github.com/Unidata/netcdf-c/issues/1162

This PR partially fixes memory leaks in the netcdf-c library,
in the ncdump utility, and in some test cases.

The netcdf-c library now runs memory clean with the assumption
that the --disable-utilities option is used. The primary remaining
problem is ncgen. Once that is fixed, I believe the netcdf-c library
will run memory clean with no limitations.

Notes
-----------
1. Memory checking was performed using gcc -fsanitize=address.
   Valgrind-based testing has yet to be performed.
2. The pnetcdf, hdf4, and examples code has not been tested.

Misc. Non-leak changes
1. Make tst_diskless2 only run when netcdf4 is enabled (issue 1162)
2. Fix CmakeLists.txt to turn off logging if ENABLE_NETCDF_4 is OFF
3. Isolated all my debug scripts into a single top-level directory
   called debug
4. Fix some USE_NETCDF4 dependencies in nc_test and nc_test4 Makefile.am
2018-10-30 20:48:12 -06:00
Ed Hartnett
1d952cb43a clean up 2018-10-23 07:52:11 -06:00
Ed Hartnett
be4fe7a921 clean up 2018-10-23 07:41:16 -06:00
Ed Hartnett
c2cb3379f4 doing HDF5 closing in libhdf5 2018-10-23 06:59:22 -06:00
Ed Hartnett
35cfaefc0c closing HDF5 objects separately 2018-10-23 05:39:00 -06:00
Ed Hartnett
6589867154 clean up var_free 2018-10-23 05:07:52 -06:00
Ed Hartnett
452f75fadd commented out some tests 2018-10-22 15:04:44 -06:00