Commit Graph

1036 Commits

Author SHA1 Message Date
Dennis Heimbigner
8cab468169 Suppress filters on variables with non-fixed-size types.
re: Discussion https://github.com/Unidata/netcdf-c/discussions/2554
re: PR https://github.com/Unidata/netcdf-c/pull/2231
re: Issue https://github.com/Unidata/netcdf-c/issues/2189

After some discussion, the issue of applying filters on variables
whose type is not fixed size, was resolved as follows:
1. A call to nc_def_var_filter will ignore such filters, but will issue a log warning.
2. Loading (from an existing file) a variable whose type is not fixed-size and which has filters, will cause the variable to be suppressed.

This PR enforces those rules.

### Misc. Other changes
* Add a test case to test the vlen change.
* Make some minor clean-ups in various cmake and automake files.
* Remove unused test
2023-06-21 14:46:22 -06:00
Dennis Heimbigner
12ec5711d7 Fix some problems with Earthdata authorization.
re: Issue https://github.com/Unidata/netcdf-c/issues/2704

The issue reported problems accessing e.g. opendap.earthdata.nasa.gov,
which uses the authentication mechanisms of urs.earthdata.nasa.gov.
The file *docs/auth.md* describes how to setup the proper authorization
mechanisms for earthdata, but there turned out to be some bugs
in the code that prevented this from working.

## Primary Changes
* Add some clarification text to *auth.md*.
* Fix the process for loading and merging *.ncrc* and *.dodsrc* file to conform to documentation.
* Fix *NC_s3urlrebuild* so that non-S3 urls are passed through unchanged.
* Fix a bug in the .rc test *test_rcmerge.sh*.
2023-06-10 18:51:13 -06:00
Ward Fisher
7cb42a6739
Merge pull request #2689 from mathstuf/awsinclude-noexec
awsincludes: remove executable permissions
2023-06-09 15:17:06 -06:00
Ward Fisher
258ad3fabe
Merge branch 'main' into vlenperf.dmh 2023-06-06 15:59:04 -06:00
Ward Fisher
a14bfde418
Merge branch 'main' into verifyhost.dmh 2023-05-25 11:54:49 -06:00
Dennis Heimbigner
fb40a72b45 Improve performance of the nc_reclaim_data and nc_copy_data functions.
re: Issue https://github.com/Unidata/netcdf-c/issues/2685
re: PR https://github.com/Unidata/netcdf-c/pull/2179

As noted in PR https://github.com/Unidata/netcdf-c/pull/2179,
the old code did not allow for reclaiming instances of types,
nor for properly copying them. That PR provided new functions
capable of reclaiming/copying instances of arbitrary types.

However, as noted by Issue https://github.com/Unidata/netcdf-c/issues/2685, using these
most general functions resulted in a significant performance
degradation, even for common cases.

This PR attempts to mitigate the cost of using the general
reclaim/copy functions in two ways.

First, the previous functions operating at the top level by
using ncid and typeid arguments. These functions were augmented
with equivalent versions that used the netcdf-c library internal
data structures to allow direct access to needed information.
These new functions are used internally to the library.

The second mitigation involves optimizing the internal functions
by providing early tests for common cases. This avoids
unnecessary recursive function calls.

The overall result is a significant improvement in speed by a
factor of roughly twenty -- your mileage may vary. These
optimized functions are still not as fast as the original (more
limited) functions, but they are getting close. Additional optimizations are
possible. But the cost is a significant "uglification" of the
code that I deemed a step too far, at least for now.

## Misc. Changes
1. Added a test case to check the proper reclamation/copy of complex types.
2. Found and fixed some places where nc_reclaim/copy should have been used.
3. Replaced, in the netcdf-c library, (almost all) occurrences of nc_reclaim_copy with calls to NC_reclaim/copy. This plus the optimizations is the primary speed-up mechanism.
4. In DAP4, the metadata is held in a substrate in-memory file; this required some changes so that the reclaim/copy code accessed that substrate dispatcher rather than the DAP4 dispatcher.
5. Re-factored and isolated the code that computes if a type is (transitively) variable-sized or not.
6. Clean up the reclamation code in ncgen; adding the use of nc_reclaim exposed some memory problems.
2023-05-20 17:11:25 -06:00
Dennis Heimbigner
98477b9f25 ## Addendum [5/9/23]
It turns out that attempting to test S3 using a github action secret is a very complex process. So, this was disabled for github actions. However, a new *run_tests_s3.yml* action file was added that will eventually encapsulate S3 testing.
2023-05-09 21:13:49 -06:00
Dennis Heimbigner
b1b1a3e9c0 Added comment about curl code 2023-05-01 16:34:57 -06:00
Dennis Heimbigner
681abc3fb1 s3-off 2023-04-30 18:41:31 -06:00
Dennis Heimbigner
75e3012ff3 debug5 2023-04-29 19:45:51 -06:00
Dennis Heimbigner
cccbc2ebea gdb3 2023-04-29 18:32:46 -06:00
Dennis Heimbigner
a443ba8215 gdb2 2023-04-29 18:07:32 -06:00
Dennis Heimbigner
d89a63a1d3 gdb1 2023-04-29 18:00:42 -06:00
Dennis Heimbigner
fc796b31c1 Fix handling of CURLOPT_CAINFO and CURLOPT_CAPATH
re: Issue https://github.com/Unidata/netcdf4-python/issues/1246

This provides a **partial** solution to the above PR.
The underlying problem is with libcurl, but at least a
workaround should be possible by creating a "~/.ncrc" file
containing the line "HTTP.SSL_CAINFO=\<path to the cert (.crt) file\>".
This was not working for obscure reasons. This PR should fix it.

## Misc. Other Changes

* Update/fix configure.ac to properly test for libcurl version >= 7.66.0
* Update include/netcdf_json.h
* Remove use of strlcat from plugins.
* Fix applicability of .rc file entries
2023-04-29 15:02:59 -06:00
Dennis Heimbigner
88bf095f26 intern2 2023-04-28 15:28:32 -06:00
Dennis Heimbigner
2eb131f516 intern1 2023-04-28 15:26:21 -06:00
Dennis Heimbigner
c2f3b6ee84 debug20 2023-04-28 15:11:42 -06:00
Dennis Heimbigner
2f693cf960 debug10 2023-04-28 14:52:20 -06:00
Dennis Heimbigner
613fd120d7 debug2 2023-04-28 14:40:46 -06:00
Dennis Heimbigner
20065682bb debug1 2023-04-28 14:30:48 -06:00
Dennis Heimbigner
aa82e1b4cb Merge branch 's3update.dmh' of https://github.com/DennisHeimbigner/netcdf-c into s3update.dmh 2023-04-28 14:05:14 -06:00
Dennis Heimbigner
62f8d31415 profile1 2023-04-28 14:05:06 -06:00
Ben Boeckel
888fc62421 awsincludes: remove executable permissions 2023-04-27 21:47:20 -04:00
Dennis Heimbigner
7121588ac0 try10 2023-04-27 19:25:36 -06:00
Dennis Heimbigner
d0ef22360d try5 2023-04-27 19:15:07 -06:00
Dennis Heimbigner
b3fc253b58 try2 2023-04-27 19:04:06 -06:00
Dennis Heimbigner
3aaf5df99f try1 2023-04-27 18:58:35 -06:00
Dennis Heimbigner
579230d1a9 null1 2023-04-27 18:10:40 -06:00
Dennis Heimbigner
cd5199f51d ch1 2023-04-27 17:37:07 -06:00
Dennis Heimbigner
4bc1f1f3a3 ch0 2023-04-27 17:27:11 -06:00
Dennis Heimbigner
1cf6e3743b at1 2023-04-27 17:14:57 -06:00
Dennis Heimbigner
db2b59500f tag1 2023-04-27 17:02:36 -06:00
Dennis Heimbigner
c980b45617 region1 2023-04-27 16:49:43 -06:00
Dennis Heimbigner
b1899c05cb dump1 2023-04-27 16:40:09 -06:00
Dennis Heimbigner
174a50191a track3 2023-04-27 16:15:55 -06:00
Dennis Heimbigner
c548930e7d track2 2023-04-27 16:02:54 -06:00
Dennis Heimbigner
1c3b05a252 track1 2023-04-27 15:37:55 -06:00
Dennis Heimbigner
5d5ff73847 segv2 2023-04-27 15:26:34 -06:00
Dennis Heimbigner
59c6d29394 segv1 2023-04-27 15:12:26 -06:00
Dennis Heimbigner
49737888ca Improve S3 Documentation and Support
## Improvements to S3 Documentation
* Create a new document *quickstart_paths.md* that give a summary of the legal path formats used by netcdf-c. This includes both file paths and URL paths.
* Modify *nczarr.md* to remove most of the S3 related text.
* Move the S3 text from *nczarr.md* to a new document *cloud.md*.
* Add some S3-related text to the *byterange.md* document.

Hopefully, this will make it easier for users to find the information they want.

## Rebuild NCZarr Testing
In order to avoid problems with running make check in parallel, two changes were made:
1. The *nczarr_test* test system was rebuilt. Now, for each test.
any generated files are kept in a test-specific directory, isolated
from all other test executions.
2. Similarly, since the S3 test bucket is shared, any generated S3 objects
are isolated using a test-specific key path.

## Other S3 Related Changes
* Add code to ensure that files created on S3 are reclaimed at end of testing.
* Used the bash "trap" command to ensure S3 cleanup even if the test fails.
* Cleanup the S3 related configure.ac flag set since S3 is used in several places. So now one should use the option *--enable-s3* instead of *--enable-nczarr-s3*, although the latter is still kept as a deprecated alias for the former.
* Get some of the github actions yml to work with S3; required fixing various test scripts adding a secret to access the Unidata S3 bucket.
* Cleanup S3 portion of libnetcdf.settings.in and netcdf_meta.h.in and test_common.in.
* Merge partial S3 support into dhttp.c.
* Create an experimental s3 access library especially for use with Windows. It is enabled by using the options *--enable-s3-internal* (automake) or *-DENABLE_S3_INTERNAL=ON* (CMake). Also add a unit-test for it.
* Move some definitions from ncrc.h to ncs3sdk.h

## Other Changes
* Provide a default implementation of strlcpy and move this and similar defaults into *dmissing.c*.
2023-04-25 17:15:06 -06:00
Ward Fisher
c8b3b37b1a Merge branch 'dap4tests2.dmh' of https://github.com/DennisHeimbigner/netcdf-c 2023-04-11 16:42:32 -06:00
Ward Fisher
9459f92f1f
Merge branch 'main' into dap4tests1.dmh 2023-04-11 16:23:48 -06:00
Dennis Heimbigner
3765d86e46 "Simplify" XGetopt usage
When "getopt()" is not available, various of the netcdf-c utilities
use XGetopt instead. This occurs primarily when building under Window,
so the build changes are restricted to CMake.

This PR tries to isolate XGetopt.c to the libdispatch directory
and then builds the various utilities using this cliche:
````
IF(USE_X_GETOPT)
  SET(XGETOPTSRC "${CMAKE_CURRENT_SOURCE_DIR}/../libdispatch/XGetopt.c")
ENDIF()
````

This avoids the need to copy XGetopt.c to all the directories that
use it.
2023-04-09 13:10:41 -06:00
Dennis Heimbigner
d7d216a3f5 Merge branch 'master' into dap4tests2.dmh 2023-03-16 14:03:29 -06:00
Dennis Heimbigner
2971d9731d Merge branch 'master' into dap4tests1.dmh 2023-03-16 14:02:49 -06:00
Ward Fisher
8d51666d04
Merge branch 'main' into encode.dmh 2023-03-07 14:18:38 -07:00
Dennis Heimbigner
cf6fcb3b9c Merge branch 'master' into dap4tests2.dmh 2023-03-02 20:00:05 -07:00
Dennis Heimbigner
bec55cb95e Merge branch 'master' into dap4tests1.dmh 2023-03-02 19:59:32 -07:00
Dennis Heimbigner
69e84fe9f1 Fix byterange handling of some URLS
re: Issue

The byterange handling of the following URLS fails.

### Problem 1: "https://crudata.uea.ac.uk/cru/data/temperature/HadCRUT.4.6.0.0.median.nc#mode=bytes"
It turns out that byterange in hdf5 has two possible targets: S3 and not-S3 (e.g. a thredds server or the crudata URL above). Each uses a different HDF5 Virtual File Driver (VFD).
I incorrectly set up the byterange code in libhdf5 so that it would choose one or the other of the two VFD's for any netcdf-c library build. The fix is to allow it to choose either one at run-time.

### Problem 2: "https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2022/001/18/OR_ABI-L1b-RadF-M6C01_G16_s20220011800205_e20220011809513_c20220011809562.nc#mode=bytes,s3"
When given what appears to be an S3-related URL, the netcdf-c library code converts it into a canonical, so-called "path" format. In casing out the possible input URL formats, I missed the case where the host contains the bucket ("noaa-goes16"), but not the region. So the fix was to check for this case.

## Misc. Related Changes
1. Since S3 is used in more than just NCZarr, I changed the automake/cmake options to replace "--enable-nczarr-s3" with "--enable-s3", but keeping the former option as a synonym for the latter. This also entailed cleaning up libnetcdf.settings WRT S3 support
2. Added the above URLS as additional test cases

## Misc. Un-Related Changes
1. CURLOPT_PUT is deprecated in favor to CURLOPT_UPLOAD
2. Fix some minor warnings

## Open Problems
* Under Ubuntu, either libcrypto or aws-sdk-cpp has a memory leak.
2023-03-02 19:51:02 -07:00
Dennis Heimbigner
e31ce10842 Enable ACCEPT_ENCODING on DAP requests
re: PR https://github.com/Unidata/netcdf-c/issues/2622

H/T Nathan Potter for finding this.

Apparently the existing library DAP code for supporting
compressed http responses was disabled.

So:
1. enable CURLOPT_ACCEPT_ENCODING by default
2. Add a new HTTP.ENCODE for .dodsrc to allow it to be disabled.
2023-02-16 20:21:22 -07:00