2010-06-03 21:24:43 +08:00
|
|
|
/*********************************************************************
|
2018-12-07 06:40:43 +08:00
|
|
|
* Copyright 2018, UCAR/Unidata
|
2010-06-03 21:24:43 +08:00
|
|
|
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
|
|
|
*********************************************************************/
|
|
|
|
/* $Id: main.c,v 1.33 2010/05/26 21:43:36 dmh Exp $ */
|
|
|
|
/* $Header: /upc/share/CVS/netcdf-3/ncgen/main.c,v 1.33 2010/05/26 21:43:36 dmh Exp $ */
|
|
|
|
|
|
|
|
#include "includes.h"
|
2017-03-09 08:01:10 +08:00
|
|
|
#include "ncoffsets.h"
|
2020-10-14 09:12:15 +08:00
|
|
|
#include "ncpathmgr.h"
|
2010-06-03 21:24:43 +08:00
|
|
|
#ifdef HAVE_GETOPT_H
|
|
|
|
#include <getopt.h>
|
|
|
|
#endif
|
|
|
|
|
2021-05-20 04:19:28 +08:00
|
|
|
#ifdef _WIN32
|
2012-09-12 03:53:47 +08:00
|
|
|
#include "XGetopt.h"
|
|
|
|
#endif
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
/* Default is netcdf-3 mode 1 */
|
|
|
|
#define DFALTCMODE 0
|
|
|
|
|
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-29 08:02:47 +08:00
|
|
|
/*Mnemonic*/
|
|
|
|
#define DEPRECATED 1
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
/* For error messages */
|
2017-10-31 05:11:23 +08:00
|
|
|
char* progname; /* Global: not reclaimed */
|
|
|
|
char* cdlname; /* Global: not reclaimed */
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
/* option flags */
|
2010-06-03 21:24:43 +08:00
|
|
|
int nofill_flag;
|
|
|
|
char* mainname; /* name to use for main function; defaults to "main"*/
|
2013-09-21 10:31:21 +08:00
|
|
|
Language l_flag;
|
2011-07-28 04:48:58 +08:00
|
|
|
int syntax_only;
|
2012-03-08 07:38:51 +08:00
|
|
|
int header_only;
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
/* flags for tracking what output format to use */
|
|
|
|
int k_flag; /* > 0 => -k was specified on command line*/
|
2014-03-09 11:41:30 +08:00
|
|
|
int format_attribute; /* 1=>format came from format attribute */
|
2015-11-07 08:03:28 +08:00
|
|
|
int enhanced_flag; /* 1 => netcdf-4 */
|
|
|
|
int cdf5_flag; /* 1 => cdf5 | maybe netcdf-4 */
|
2012-02-14 08:25:32 +08:00
|
|
|
int specials_flag; /* 1=> special attributes are present */
|
|
|
|
int usingclassic;
|
|
|
|
int cmode_modifier;
|
2012-03-26 09:34:32 +08:00
|
|
|
int diskless;
|
2016-01-09 03:55:11 +08:00
|
|
|
int ncloglevel;
|
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-29 08:02:47 +08:00
|
|
|
int wholevarsize;
|
2012-03-26 09:34:32 +08:00
|
|
|
|
2016-05-04 11:17:06 +08:00
|
|
|
GlobalSpecialData globalspecials;
|
|
|
|
|
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-29 08:02:47 +08:00
|
|
|
size_t zerosvector[NC_MAX_VAR_DIMS];
|
|
|
|
size_t onesvector[NC_MAX_VAR_DIMS];
|
2013-09-21 10:31:21 +08:00
|
|
|
|
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-29 08:02:47 +08:00
|
|
|
char* binary_ext = ".nc";
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
struct Vlendata* vlendata;
|
|
|
|
|
2018-11-16 01:00:38 +08:00
|
|
|
char *netcdf_name = NULL; /* command line -o file name */
|
|
|
|
char *datasetname = NULL; /* name from the netcdf <name> {} || from -N */
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
extern FILE *ncgin;
|
|
|
|
|
|
|
|
/* Forward */
|
2012-02-14 08:25:32 +08:00
|
|
|
static char* ubasename(char*);
|
|
|
|
void usage( void );
|
2018-04-21 04:40:28 +08:00
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
int main( int argc, char** argv );
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
/* Define tables vs modes for legal -k values*/
|
2017-04-28 03:01:59 +08:00
|
|
|
struct Kvalues legalkinds[] = {
|
2014-12-29 01:44:21 +08:00
|
|
|
/* NetCDF-3 classic format (32-bit offsets) */
|
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-29 08:02:47 +08:00
|
|
|
{"classic", NC_FORMAT_CLASSIC, !DEPRECATED}, /* canonical format name */
|
|
|
|
{"nc3", NC_FORMAT_CLASSIC, !DEPRECATED}, /* short format name */
|
|
|
|
{"1", NC_FORMAT_CLASSIC, !DEPRECATED}, /* deprecated, use "-3" or "-k nc3" instead */
|
2015-04-01 01:19:49 +08:00
|
|
|
|
2014-12-29 01:44:21 +08:00
|
|
|
/* NetCDF-3 64-bit offset format */
|
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-29 08:02:47 +08:00
|
|
|
{"64-bit offset", NC_FORMAT_64BIT_OFFSET, !DEPRECATED}, /* canonical format name */
|
|
|
|
{"nc6", NC_FORMAT_64BIT_OFFSET, !DEPRECATED}, /* short format name */
|
|
|
|
{"2", NC_FORMAT_64BIT_OFFSET, !DEPRECATED}, /* deprecated, use "-6" or "-k nc6" instead */
|
|
|
|
{"64-bit-offset", NC_FORMAT_64BIT_OFFSET, !DEPRECATED}, /* aliases */
|
2015-04-01 01:19:49 +08:00
|
|
|
|
2014-12-29 01:44:21 +08:00
|
|
|
/* NetCDF-4 HDF5-based format */
|
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-29 08:02:47 +08:00
|
|
|
{"netCDF-4", NC_FORMAT_NETCDF4, !DEPRECATED}, /* canonical format name */
|
|
|
|
{"nc4", NC_FORMAT_NETCDF4, !DEPRECATED}, /* short format name */
|
|
|
|
{"3", NC_FORMAT_NETCDF4, !DEPRECATED}, /* deprecated, use "-4" or "-k nc4" instead */
|
|
|
|
{"netCDF4", NC_FORMAT_NETCDF4, !DEPRECATED}, /* aliases */
|
|
|
|
{"hdf5", NC_FORMAT_NETCDF4, !DEPRECATED},
|
|
|
|
{"enhanced", NC_FORMAT_NETCDF4, !DEPRECATED},
|
|
|
|
{"netcdf-4", NC_FORMAT_NETCDF4, !DEPRECATED},
|
|
|
|
{"netcdf4", NC_FORMAT_NETCDF4, !DEPRECATED},
|
2014-12-29 01:44:21 +08:00
|
|
|
|
|
|
|
/* NetCDF-4 HDF5-based format, restricted to classic data model */
|
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-29 08:02:47 +08:00
|
|
|
{"netCDF-4 classic model", NC_FORMAT_NETCDF4_CLASSIC, !DEPRECATED}, /* canonical format name */
|
|
|
|
{"nc7", NC_FORMAT_NETCDF4_CLASSIC, !DEPRECATED}, /* short format name */
|
|
|
|
{"4", NC_FORMAT_NETCDF4_CLASSIC, !DEPRECATED}, /* deprecated, use "-7" or -k nc7" instead */
|
|
|
|
{"netCDF-4-classic", NC_FORMAT_NETCDF4_CLASSIC, !DEPRECATED}, /* aliases */
|
|
|
|
{"netCDF-4_classic", NC_FORMAT_NETCDF4_CLASSIC, !DEPRECATED},
|
|
|
|
{"netCDF4_classic", NC_FORMAT_NETCDF4_CLASSIC, !DEPRECATED},
|
|
|
|
{"hdf5-nc3", NC_FORMAT_NETCDF4_CLASSIC, !DEPRECATED},
|
|
|
|
{"enhanced-nc3", NC_FORMAT_NETCDF4_CLASSIC, !DEPRECATED},
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2015-08-16 06:26:35 +08:00
|
|
|
/* CDF-5 format */
|
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-29 08:02:47 +08:00
|
|
|
{"5", NC_FORMAT_64BIT_DATA, !DEPRECATED},
|
|
|
|
{"64-bit-data", NC_FORMAT_64BIT_DATA, !DEPRECATED},
|
|
|
|
{"64-bit data", NC_FORMAT_64BIT_DATA, !DEPRECATED},
|
|
|
|
{"nc5", NC_FORMAT_64BIT_DATA, !DEPRECATED},
|
|
|
|
{"cdf5", NC_FORMAT_64BIT_DATA, !DEPRECATED},
|
|
|
|
{"cdf-5", NC_FORMAT_64BIT_DATA, !DEPRECATED},
|
2015-08-16 06:26:35 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
/* null terminate*/
|
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-29 08:02:47 +08:00
|
|
|
{NULL,0,0}
|
2010-06-03 21:24:43 +08:00
|
|
|
};
|
|
|
|
|
2013-09-24 02:04:39 +08:00
|
|
|
#ifndef _MSC_VER
|
2010-06-03 21:24:43 +08:00
|
|
|
struct Languages {
|
|
|
|
char* name;
|
2013-09-21 10:31:21 +08:00
|
|
|
Language flag;
|
2010-06-03 21:24:43 +08:00
|
|
|
} legallanguages[] = {
|
2013-09-21 10:31:21 +08:00
|
|
|
{"b", L_BINARY},
|
|
|
|
{"c", L_C},
|
|
|
|
{"C", L_C},
|
|
|
|
{"f77", L_F77},
|
|
|
|
{"fortran77", L_F77},
|
|
|
|
{"Fortran77", L_F77},
|
|
|
|
{"j", L_JAVA},
|
|
|
|
{"java", L_JAVA},
|
2013-09-24 02:04:39 +08:00
|
|
|
{NULL,L_UNDEFINED}
|
2010-06-03 21:24:43 +08:00
|
|
|
};
|
2013-09-24 02:04:39 +08:00
|
|
|
#else
|
|
|
|
typedef struct Languages {
|
|
|
|
char* name;
|
|
|
|
Language flag;
|
|
|
|
} Languages;
|
|
|
|
|
|
|
|
struct Languages legallanguages[] = {
|
|
|
|
{"b", L_BINARY},
|
|
|
|
{"c", L_C},
|
|
|
|
{"C", L_C},
|
|
|
|
{"f77", L_F77},
|
|
|
|
{"fortran77", L_F77},
|
|
|
|
{"Fortran77", L_F77},
|
|
|
|
{"j", L_JAVA},
|
|
|
|
{"java", L_JAVA},
|
|
|
|
{NULL,L_UNDEFINED}
|
|
|
|
};
|
|
|
|
#endif
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
/* strip off leading path */
|
|
|
|
/* result is malloc'd */
|
|
|
|
|
|
|
|
static char *
|
2012-02-14 08:25:32 +08:00
|
|
|
ubasename(char *logident)
|
2010-06-03 21:24:43 +08:00
|
|
|
{
|
|
|
|
char* sep;
|
|
|
|
|
|
|
|
sep = strrchr(logident,'/');
|
|
|
|
#ifdef MSDOS
|
|
|
|
if(sep == NULL) sep = strrchr(logident,'\\');
|
|
|
|
#endif
|
|
|
|
if(sep == NULL) return logident;
|
|
|
|
sep++; /* skip past the separator */
|
|
|
|
return sep;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
usage(void)
|
|
|
|
{
|
2015-08-16 06:26:35 +08:00
|
|
|
derror("Usage: %s"
|
|
|
|
" [-1]"
|
|
|
|
" [-3]"
|
|
|
|
" [-4]"
|
|
|
|
" [-5]"
|
|
|
|
" [-6]"
|
|
|
|
" [-7]"
|
|
|
|
" [-b]"
|
|
|
|
" [-d]"
|
|
|
|
" [-D debuglevel]"
|
|
|
|
" [-h]"
|
|
|
|
" [-k kind ]"
|
|
|
|
" [-l language=b|c|f77|java]"
|
|
|
|
" [-M <name>]"
|
|
|
|
" [-n]"
|
|
|
|
" [-o outfile]"
|
|
|
|
" [-P]"
|
|
|
|
" [-x]"
|
re e-support UBS-599337
re pull request https://github.com/Unidata/netcdf-c/pull/405
re pull request https://github.com/Unidata/netcdf-c/pull/446
Notes:
1. This branch is a cleanup of the magic.dmh branch.
2. magic.dmh was originally merged, but caused problems with parallel IO.
It was re-issued as pull request https://github.com/Unidata/netcdf-c/pull/446.
3. This branch + pull request replace any previous pull requests and magic.dmh branch.
Given an otherwise valid netCDF file that has a corrupted header,
the netcdf library currently crashes. Instead, it should return
NC_ENOTNC.
Additionally, the NC_check_file_type code does not do the
forward search required by hdf5 files. It currently only looks
at file position 0 instead of 512, 1024, 2048,... Also, it turns
out that the HDF4 magic number is assumed to always be at the
beginning of the file (unlike HDF5).
The change is localized to libdispatch/dfile.c See
https://support.hdfgroup.org/release4/doc/DSpec_html/DS.pdf
Also, it turns out that the code in NC_check_file_type is duplicated
(mostly) in the function libsrc4/nc4file.c#nc_check_for_hdf.
This branch does the following.
1. Make NC_check_file_type return NC_ENOTNC instead of crashing.
2. Remove nc_check_for_hdf and centralize all file format checking
NC_check_file_type.
3. Add proper forward search for HDF5 files (but not HDF4 files)
to look for the magic number at offsets of 0, 512, 1024...
4. Add test tst_hdf5_offset.sh. This tests that hdf5 files with
an offset are properly recognized. It does so by prefixing
a legal file with some number of zero bytes: 512, 1024, etc.
5. Off-topic: Added -N flag to ncdump to force a specific output dataset name.
2017-10-25 06:25:09 +08:00
|
|
|
" [-N datasetname]"
|
|
|
|
" [-L loglevel]"
|
2018-08-26 11:44:41 +08:00
|
|
|
" [-H]"
|
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-29 08:02:47 +08:00
|
|
|
" [-W generate whole var upload]"
|
2015-08-16 06:26:35 +08:00
|
|
|
" [file ... ]",
|
2010-06-03 21:24:43 +08:00
|
|
|
progname);
|
|
|
|
derror("netcdf library version %s", nc_inq_libvers());
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(
|
|
|
|
int argc,
|
|
|
|
char *argv[])
|
|
|
|
{
|
2017-11-01 04:03:57 +08:00
|
|
|
int code = 0;
|
2010-06-03 21:24:43 +08:00
|
|
|
int c;
|
|
|
|
FILE *fp;
|
2013-09-24 02:04:39 +08:00
|
|
|
struct Languages* langs;
|
Codify cross-platform file paths
The netcdf-c code has to deal with a variety of platforms:
Windows, OSX, Linux, Cygwin, MSYS, etc. These platforms differ
significantly in the kind of file paths that they accept. So in
order to handle this, I have created a set of replacements for
the most common file system operations such as _open_ or _fopen_
or _access_ to manage the file path differences correctly.
A more limited version of this idea was already implemented via
the ncwinpath.h and dwinpath.c code. So this can be viewed as a
replacement for that code. And in path in many cases, the only
change that was required was to replace '#include <ncwinpath.h>'
with '#include <ncpathmgt.h>' and then replace file operation
calls with the NCxxx equivalent from ncpathmgr.h Note that
recently, the ncwinpath.h was renamed ncpathmgmt.h, so this pull
request should not require dealing with winpath.
The heart of the change is include/ncpathmgmt.h, which provides
alternate operations such as NCfopen or NCaccess and which properly
parse and rebuild path arguments to work for the platform on which
the code is executing. This mostly matters for Windows because of the
way that it uses backslash and drive letters, as compared to *nix*.
One important feature is that the user can do string manipulations
on a file path without having to worry too much about the platform
because the path management code will properly handle most mixed cases.
So one can for example concatenate a path suffix that uses forward
slashes to a Windows path and have it work correctly.
The conversion code is in libdispatch/dpathmgr.c, and the
important function there is NCpathcvt which does the proper
conversions to the local path format.
As a rule, most code should just replace their file operations with
the corresponding NCxxx ones defined in include/ncpathmgmt.h. These
NCxxx functions all call NCpathcvt on their path arguments before
executing the actual file operation.
In some rare cases, the client may need to directly use NCpathcvt,
but this should be avoided as much as possible. If there is a need
for supporting a new file operation not already in ncpathmgmt.h, then
use the code in dpathmgr.c as a template. Also please notify Unidata
so we can include it as a formal part or our supported operations.
Also, if you see an operation in the library that is not using the
NCxxx form, then please submit an issue so we can fix it.
Misc. Changes:
* Clean up the utf8 testing code; it is impossible to get some
tests to work under windows using shell scripts; the args do
not pass as utf8 but as some other encoding.
* Added an extra utf8 test case: test_unicode_path.sh
* Add a true test for HDF5 1.10.6 or later because as noted in
PR https://github.com/Unidata/netcdf-c/pull/1794,
HDF5 changed its Windows file path handling.
2021-03-05 04:41:31 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
init_netcdf();
|
|
|
|
|
|
|
|
opterr = 1; /* print error message if bad option */
|
2017-10-31 05:11:23 +08:00
|
|
|
progname = nulldup(ubasename(argv[0]));
|
|
|
|
cdlname = NULL;
|
2010-06-03 21:24:43 +08:00
|
|
|
netcdf_name = NULL;
|
|
|
|
datasetname = NULL;
|
2013-09-21 10:31:21 +08:00
|
|
|
l_flag = 0;
|
2010-06-03 21:24:43 +08:00
|
|
|
nofill_flag = 0;
|
2011-07-28 04:48:58 +08:00
|
|
|
syntax_only = 0;
|
2012-03-08 07:38:51 +08:00
|
|
|
header_only = 0;
|
2010-06-03 21:24:43 +08:00
|
|
|
mainname = "main";
|
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
k_flag = 0;
|
2014-03-09 11:41:30 +08:00
|
|
|
format_attribute = 0;
|
2012-02-14 08:25:32 +08:00
|
|
|
enhanced_flag = 0;
|
2015-11-07 08:03:28 +08:00
|
|
|
cdf5_flag = 0;
|
2012-02-14 08:25:32 +08:00
|
|
|
specials_flag = 0;
|
2012-03-26 09:34:32 +08:00
|
|
|
diskless = 0;
|
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-29 08:02:47 +08:00
|
|
|
wholevarsize = 1024;
|
2016-01-09 03:55:11 +08:00
|
|
|
#ifdef LOGGING
|
|
|
|
ncloglevel = NC_TURN_OFF_LOGGING;
|
|
|
|
#else
|
|
|
|
ncloglevel = -1;
|
|
|
|
#endif
|
2016-05-04 11:17:06 +08:00
|
|
|
memset(&globalspecials,0,sizeof(GlobalSpecialData));
|
2012-03-26 09:34:32 +08:00
|
|
|
|
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-29 08:02:47 +08:00
|
|
|
while ((c = getopt(argc, argv, "134567bcdD:fhHk:l:M:no:Pv:xL:N:B:W:")) != EOF)
|
2010-06-03 21:24:43 +08:00
|
|
|
switch(c) {
|
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-29 08:02:47 +08:00
|
|
|
case 'b': /* for binary netcdf output, ".nc" extension */
|
|
|
|
if(l_flag != 0) {
|
|
|
|
fprintf(stderr,"Please specify only one language\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
l_flag = L_BINARY;
|
2010-06-03 21:24:43 +08:00
|
|
|
break;
|
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-29 08:02:47 +08:00
|
|
|
case 'B':
|
|
|
|
/* Ignore, but keep for back compatibility */
|
2010-06-03 21:24:43 +08:00
|
|
|
break;
|
|
|
|
case 'c': /* for c output, old version of "-lc" */
|
2013-09-21 10:31:21 +08:00
|
|
|
if(l_flag != 0) {
|
|
|
|
fprintf(stderr,"Please specify only one language\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
l_flag = L_C;
|
2010-06-03 21:24:43 +08:00
|
|
|
fprintf(stderr,"-c is deprecated: please use -lc\n");
|
|
|
|
break;
|
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-29 08:02:47 +08:00
|
|
|
case 'd':
|
|
|
|
debug = 1;
|
|
|
|
break;
|
|
|
|
case 'D':
|
|
|
|
debug = atoi(optarg);
|
|
|
|
break;
|
2010-06-03 21:24:43 +08:00
|
|
|
case 'f': /* for f77 output, old version of "-lf" */
|
2013-09-21 10:31:21 +08:00
|
|
|
if(l_flag != 0) {
|
|
|
|
fprintf(stderr,"Please specify only one language\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
l_flag = L_F77;
|
2010-06-03 21:24:43 +08:00
|
|
|
fprintf(stderr,"-f is deprecated: please use -lf77\n");
|
|
|
|
break;
|
2018-08-26 11:44:41 +08:00
|
|
|
case 'h':
|
2015-11-20 04:44:07 +08:00
|
|
|
usage();
|
2017-11-01 04:03:57 +08:00
|
|
|
goto done;
|
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-29 08:02:47 +08:00
|
|
|
case 'H':
|
|
|
|
header_only = 1;
|
|
|
|
break;
|
|
|
|
case 'v': /* a deprecated alias for "kind" option */
|
|
|
|
/*FALLTHRU*/
|
|
|
|
case 'k': { /* for specifying variant of netCDF format to be generated
|
|
|
|
Possible values are:
|
|
|
|
Format names:
|
|
|
|
"classic" or "nc3"
|
|
|
|
"64-bit offset" or "nc6"
|
|
|
|
"64-bit data" or "nc5" or "cdf-5"
|
|
|
|
"netCDF-4" or "nc4"
|
|
|
|
"netCDF-4 classic model" or "nc7"
|
|
|
|
"netCDF-5" or "nc5" or "cdf5"
|
|
|
|
Format version numbers (deprecated):
|
|
|
|
1 (=> classic)
|
|
|
|
2 (=> 64-bit offset)
|
|
|
|
3 (=> netCDF-4)
|
|
|
|
4 (=> netCDF-4 classic model)
|
|
|
|
5 (=> classic 64 bit data aka CDF-5)
|
|
|
|
*/
|
|
|
|
struct Kvalues* kvalue;
|
|
|
|
if(optarg == NULL) {
|
|
|
|
derror("-k flag has no value");
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
for(kvalue=legalkinds;kvalue->name;kvalue++) {
|
|
|
|
if(strcmp(optarg,kvalue->name) == 0) {
|
|
|
|
k_flag = kvalue->k_flag;
|
|
|
|
if(kvalue->deprecated)
|
|
|
|
fprintf(stderr,"-k%s is deprecated; use corresponding -k<name> or -3|-4|-5|-6|-7\n",optarg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(kvalue->name == NULL) {
|
|
|
|
derror("Invalid format: %s",optarg);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
} break;
|
2015-08-16 06:26:35 +08:00
|
|
|
case 'l': /* specify language, instead of using -c or -f or -b */
|
|
|
|
{
|
2017-10-31 05:11:23 +08:00
|
|
|
char* lang_name = NULL;
|
2015-08-16 06:26:35 +08:00
|
|
|
if(l_flag != 0) {
|
|
|
|
fprintf(stderr,"Please specify only one language\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if(!optarg) {
|
|
|
|
derror("%s: output language is null", progname);
|
|
|
|
return(1);
|
|
|
|
}
|
2018-04-21 04:40:28 +08:00
|
|
|
lang_name = (char*) emalloc(strlen(optarg)+1);
|
|
|
|
(void)strcpy(lang_name, optarg);
|
|
|
|
|
|
|
|
for(langs=legallanguages;langs->name != NULL;langs++) {
|
2015-08-16 06:26:35 +08:00
|
|
|
if(strcmp(lang_name,langs->name)==0) {
|
2018-04-21 04:40:28 +08:00
|
|
|
l_flag = langs->flag;
|
2015-08-16 06:26:35 +08:00
|
|
|
break;
|
|
|
|
}
|
2018-04-21 04:40:28 +08:00
|
|
|
}
|
2015-08-16 06:26:35 +08:00
|
|
|
if(langs->name == NULL) {
|
|
|
|
derror("%s: output language %s not implemented",progname, lang_name);
|
2017-10-31 05:11:23 +08:00
|
|
|
nullfree(lang_name);
|
2015-08-16 06:26:35 +08:00
|
|
|
return(1);
|
|
|
|
}
|
2017-10-31 05:11:23 +08:00
|
|
|
nullfree(lang_name);
|
2015-08-16 06:26:35 +08:00
|
|
|
}; break;
|
2016-01-09 03:55:11 +08:00
|
|
|
case 'L':
|
|
|
|
ncloglevel = atoi(optarg);
|
|
|
|
break;
|
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-29 08:02:47 +08:00
|
|
|
case 'M': /* Determine the name for the main function */
|
|
|
|
mainname = nulldup(optarg);
|
|
|
|
break;
|
2010-06-03 21:24:43 +08:00
|
|
|
case 'n': /* old version of -b, uses ".cdf" extension */
|
2013-09-21 10:31:21 +08:00
|
|
|
if(l_flag != 0) {
|
|
|
|
fprintf(stderr,"Please specify only one language\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
l_flag = L_BINARY;
|
|
|
|
binary_ext = ".cdf";
|
2010-06-03 21:24:43 +08:00
|
|
|
break;
|
re e-support UBS-599337
re pull request https://github.com/Unidata/netcdf-c/pull/405
re pull request https://github.com/Unidata/netcdf-c/pull/446
Notes:
1. This branch is a cleanup of the magic.dmh branch.
2. magic.dmh was originally merged, but caused problems with parallel IO.
It was re-issued as pull request https://github.com/Unidata/netcdf-c/pull/446.
3. This branch + pull request replace any previous pull requests and magic.dmh branch.
Given an otherwise valid netCDF file that has a corrupted header,
the netcdf library currently crashes. Instead, it should return
NC_ENOTNC.
Additionally, the NC_check_file_type code does not do the
forward search required by hdf5 files. It currently only looks
at file position 0 instead of 512, 1024, 2048,... Also, it turns
out that the HDF4 magic number is assumed to always be at the
beginning of the file (unlike HDF5).
The change is localized to libdispatch/dfile.c See
https://support.hdfgroup.org/release4/doc/DSpec_html/DS.pdf
Also, it turns out that the code in NC_check_file_type is duplicated
(mostly) in the function libsrc4/nc4file.c#nc_check_for_hdf.
This branch does the following.
1. Make NC_check_file_type return NC_ENOTNC instead of crashing.
2. Remove nc_check_for_hdf and centralize all file format checking
NC_check_file_type.
3. Add proper forward search for HDF5 files (but not HDF4 files)
to look for the magic number at offsets of 0, 512, 1024...
4. Add test tst_hdf5_offset.sh. This tests that hdf5 files with
an offset are properly recognized. It does so by prefixing
a legal file with some number of zero bytes: 512, 1024, etc.
5. Off-topic: Added -N flag to ncdump to force a specific output dataset name.
2017-10-25 06:25:09 +08:00
|
|
|
case 'N': /* to explicitly specify dataset name */
|
2018-11-16 01:00:38 +08:00
|
|
|
if(datasetname) efree(datasetname);
|
re e-support UBS-599337
re pull request https://github.com/Unidata/netcdf-c/pull/405
re pull request https://github.com/Unidata/netcdf-c/pull/446
Notes:
1. This branch is a cleanup of the magic.dmh branch.
2. magic.dmh was originally merged, but caused problems with parallel IO.
It was re-issued as pull request https://github.com/Unidata/netcdf-c/pull/446.
3. This branch + pull request replace any previous pull requests and magic.dmh branch.
Given an otherwise valid netCDF file that has a corrupted header,
the netcdf library currently crashes. Instead, it should return
NC_ENOTNC.
Additionally, the NC_check_file_type code does not do the
forward search required by hdf5 files. It currently only looks
at file position 0 instead of 512, 1024, 2048,... Also, it turns
out that the HDF4 magic number is assumed to always be at the
beginning of the file (unlike HDF5).
The change is localized to libdispatch/dfile.c See
https://support.hdfgroup.org/release4/doc/DSpec_html/DS.pdf
Also, it turns out that the code in NC_check_file_type is duplicated
(mostly) in the function libsrc4/nc4file.c#nc_check_for_hdf.
This branch does the following.
1. Make NC_check_file_type return NC_ENOTNC instead of crashing.
2. Remove nc_check_for_hdf and centralize all file format checking
NC_check_file_type.
3. Add proper forward search for HDF5 files (but not HDF4 files)
to look for the magic number at offsets of 0, 512, 1024...
4. Add test tst_hdf5_offset.sh. This tests that hdf5 files with
an offset are properly recognized. It does so by prefixing
a legal file with some number of zero bytes: 512, 1024, etc.
5. Off-topic: Added -N flag to ncdump to force a specific output dataset name.
2017-10-25 06:25:09 +08:00
|
|
|
datasetname = nulldup(optarg);
|
|
|
|
break;
|
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-29 08:02:47 +08:00
|
|
|
case 'o': /* to explicitly specify output name */
|
|
|
|
if(netcdf_name) efree(netcdf_name);
|
2021-04-22 04:59:15 +08:00
|
|
|
netcdf_name = NC_shellUnescape(optarg);
|
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-29 08:02:47 +08:00
|
|
|
break;
|
|
|
|
case 'P': /* diskless with persistence */
|
|
|
|
diskless = 1;
|
|
|
|
case 'W':
|
|
|
|
wholevarsize = atoi(optarg);
|
|
|
|
break;
|
2010-06-03 21:24:43 +08:00
|
|
|
case 'x': /* set nofill mode to speed up creation of large files */
|
|
|
|
nofill_flag = 1;
|
|
|
|
break;
|
2014-12-29 01:44:21 +08:00
|
|
|
case '3': /* output format is classic (netCDF-3) */
|
|
|
|
k_flag = NC_FORMAT_CLASSIC;
|
|
|
|
break;
|
|
|
|
case '6': /* output format is 64-bit-offset (netCDF-3 version 2) */
|
2015-08-16 06:26:35 +08:00
|
|
|
k_flag = NC_FORMAT_64BIT_OFFSET;
|
2014-12-29 01:44:21 +08:00
|
|
|
break;
|
|
|
|
case '4': /* output format is netCDF-4 (variant of HDF5) */
|
|
|
|
k_flag = NC_FORMAT_NETCDF4;
|
|
|
|
break;
|
2015-08-16 06:26:35 +08:00
|
|
|
case '5': /* output format is CDF5 */
|
|
|
|
k_flag = NC_FORMAT_CDF5;
|
|
|
|
break;
|
2014-12-29 01:44:21 +08:00
|
|
|
case '7': /* output format is netCDF-4 (restricted to classic model)*/
|
|
|
|
k_flag = NC_FORMAT_NETCDF4_CLASSIC;
|
|
|
|
break;
|
2010-06-03 21:24:43 +08:00
|
|
|
case '?':
|
|
|
|
usage();
|
|
|
|
return(8);
|
|
|
|
}
|
|
|
|
|
2013-09-21 10:31:21 +08:00
|
|
|
if(l_flag == 0) {
|
|
|
|
l_flag = L_BINARY; /* default */
|
2012-03-15 07:26:48 +08:00
|
|
|
/* Treat -k or -o as an implicit -lb assuming no other -l flags */
|
|
|
|
if(k_flag == 0 && netcdf_name == NULL)
|
2011-08-12 02:46:18 +08:00
|
|
|
syntax_only = 1;
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef ENABLE_C
|
2018-11-16 01:00:38 +08:00
|
|
|
if(l_flag == L_C) {
|
2010-06-03 21:24:43 +08:00
|
|
|
fprintf(stderr,"C not currently supported\n");
|
2017-11-01 04:03:57 +08:00
|
|
|
code=1; goto done;
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef ENABLE_BINARY
|
2013-09-21 10:31:21 +08:00
|
|
|
if(l_flag == L_BINARY) {
|
2010-06-03 21:24:43 +08:00
|
|
|
fprintf(stderr,"Binary netcdf not currently supported\n");
|
2017-11-01 04:03:57 +08:00
|
|
|
code=1; goto done;
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef ENABLE_JAVA
|
2013-09-21 10:31:21 +08:00
|
|
|
if(l_flag == L_JAVA) {
|
2010-06-03 21:24:43 +08:00
|
|
|
fprintf(stderr,"Java not currently supported\n");
|
2017-11-01 04:03:57 +08:00
|
|
|
code=1; goto done;
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
#else
|
2016-06-21 05:19:18 +08:00
|
|
|
if(l_flag == L_JAVA && mainname != NULL && strcmp(mainname,"main")==0)
|
|
|
|
mainname = "Main";
|
2010-06-03 21:24:43 +08:00
|
|
|
#endif
|
|
|
|
#ifndef ENABLE_F77
|
2013-09-21 10:31:21 +08:00
|
|
|
if(l_flag == L_F77) {
|
2010-06-03 21:24:43 +08:00
|
|
|
fprintf(stderr,"F77 not currently supported\n");
|
2017-11-01 04:03:57 +08:00
|
|
|
code=1; goto done;
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-09-21 10:31:21 +08:00
|
|
|
if(l_flag != L_BINARY)
|
2012-03-26 09:34:32 +08:00
|
|
|
diskless = 0;
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
argc -= optind;
|
|
|
|
argv += optind;
|
|
|
|
|
|
|
|
if (argc > 1) {
|
|
|
|
derror ("%s: only one input file argument permitted",progname);
|
|
|
|
return(6);
|
|
|
|
}
|
|
|
|
|
|
|
|
fp = stdin;
|
|
|
|
if (argc > 0 && strcmp(argv[0], "-") != 0) {
|
2014-03-08 13:52:40 +08:00
|
|
|
char bom[4];
|
|
|
|
size_t count;
|
2017-04-15 01:05:30 +08:00
|
|
|
if ((fp = NCfopen(argv[0], "r")) == NULL) {
|
2010-06-03 21:24:43 +08:00
|
|
|
derror ("can't open file %s for reading: ", argv[0]);
|
|
|
|
perror("");
|
|
|
|
return(7);
|
|
|
|
}
|
2014-03-08 13:52:40 +08:00
|
|
|
/* Check the leading bytes for an occurrence of a BOM */
|
|
|
|
/* re: http://www.unicode.org/faq/utf_bom.html#BOM */
|
|
|
|
/* Attempt to read the first four bytes */
|
|
|
|
memset(bom,0,sizeof(bom));
|
|
|
|
count = fread(bom,1,2,fp);
|
|
|
|
if(count == 2) {
|
|
|
|
switch (bom[0]) {
|
|
|
|
case '\x00':
|
|
|
|
case '\xFF':
|
|
|
|
case '\xFE':
|
|
|
|
/* Only UTF-* is allowed; complain and exit */
|
|
|
|
fprintf(stderr,"Input file contains a BOM indicating a non-UTF8 encoding\n");
|
|
|
|
return 1;
|
|
|
|
case '\xEF':
|
|
|
|
/* skip the BOM */
|
2016-01-09 03:55:11 +08:00
|
|
|
(void)fread(bom,1,1,fp);
|
2014-03-08 13:52:40 +08:00
|
|
|
break;
|
|
|
|
default: /* legal printable char, presumably; rewind */
|
|
|
|
rewind(fp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-10-31 05:11:23 +08:00
|
|
|
}
|
2014-03-08 13:52:40 +08:00
|
|
|
|
2021-04-22 04:59:15 +08:00
|
|
|
cdlname = NC_shellUnescape(argv[0]);
|
2017-10-31 05:11:23 +08:00
|
|
|
if(cdlname != NULL) {
|
|
|
|
if(strlen(cdlname) > NC_MAX_NAME)
|
|
|
|
cdlname[NC_MAX_NAME] = '\0';
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
parse_init();
|
|
|
|
ncgin = fp;
|
|
|
|
if(debug >= 2) {ncgdebug=1;}
|
2012-03-15 07:26:48 +08:00
|
|
|
if(ncgparse() != 0)
|
|
|
|
return 1;
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
/* Compute the k_flag (1st pass) using rules in the man page (ncgen.1).*/
|
|
|
|
|
2018-06-30 10:17:07 +08:00
|
|
|
#ifndef ENABLE_CDF5
|
2017-09-19 03:31:15 +08:00
|
|
|
if(k_flag == NC_FORMAT_CDF5) {
|
|
|
|
derror("Output format CDF5 requested, but netcdf was built without cdf5 support.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
#ifndef USE_NETCDF4
|
|
|
|
if(enhanced_flag) {
|
|
|
|
derror("CDL input is enhanced mode, but --disable-netcdf4 was specified during build");
|
|
|
|
return 0;
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
2012-02-14 08:25:32 +08:00
|
|
|
#endif
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2013-09-21 10:31:21 +08:00
|
|
|
if(l_flag == L_JAVA || l_flag == L_F77) {
|
2017-09-16 11:03:05 +08:00
|
|
|
k_flag = NC_FORMAT_CLASSIC;
|
2012-02-14 08:25:32 +08:00
|
|
|
if(enhanced_flag) {
|
|
|
|
derror("Java or Fortran requires classic model CDL input");
|
|
|
|
return 0;
|
|
|
|
}
|
2011-05-13 01:51:32 +08:00
|
|
|
}
|
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
if(k_flag == 0)
|
2016-05-04 11:17:06 +08:00
|
|
|
k_flag = globalspecials._Format;
|
2011-05-13 01:51:32 +08:00
|
|
|
|
2015-11-07 08:03:28 +08:00
|
|
|
if(cdf5_flag && !enhanced_flag && k_flag == 0)
|
2017-09-16 11:03:05 +08:00
|
|
|
k_flag = NC_FORMAT_64BIT_DATA;
|
2012-02-14 08:25:32 +08:00
|
|
|
if(enhanced_flag && k_flag == 0)
|
2017-09-16 11:03:05 +08:00
|
|
|
k_flag = NC_FORMAT_NETCDF4;
|
2012-02-14 08:25:32 +08:00
|
|
|
|
2017-09-16 11:03:05 +08:00
|
|
|
if(enhanced_flag && k_flag != NC_FORMAT_NETCDF4) {
|
|
|
|
if(enhanced_flag && k_flag != NC_FORMAT_NETCDF4 && k_flag != NC_FORMAT_64BIT_DATA) {
|
2015-11-03 07:11:29 +08:00
|
|
|
derror("-k or _Format conflicts with enhanced CDL input");
|
|
|
|
return 0;
|
|
|
|
}
|
2012-02-14 08:25:32 +08:00
|
|
|
}
|
|
|
|
|
2012-03-15 07:26:48 +08:00
|
|
|
if(specials_flag > 0 && k_flag == 0)
|
2012-02-14 08:25:32 +08:00
|
|
|
#ifdef USE_NETCDF4
|
2017-09-16 11:03:05 +08:00
|
|
|
k_flag = NC_FORMAT_NETCDF4;
|
2012-02-14 08:25:32 +08:00
|
|
|
#else
|
2017-09-16 11:03:05 +08:00
|
|
|
k_flag = NC_FORMAT_CLASSIC;
|
2010-06-03 21:24:43 +08:00
|
|
|
#endif
|
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
if(k_flag == 0)
|
2017-09-16 11:03:05 +08:00
|
|
|
k_flag = NC_FORMAT_CLASSIC;
|
2012-02-14 08:25:32 +08:00
|
|
|
|
2015-11-20 04:44:07 +08:00
|
|
|
/* Figure out usingclassic */
|
|
|
|
switch (k_flag) {
|
|
|
|
case NC_FORMAT_64BIT_DATA:
|
|
|
|
case NC_FORMAT_CLASSIC:
|
|
|
|
case NC_FORMAT_64BIT_OFFSET:
|
|
|
|
case NC_FORMAT_NETCDF4_CLASSIC:
|
|
|
|
usingclassic = 1;
|
|
|
|
break;
|
|
|
|
case NC_FORMAT_NETCDF4:
|
|
|
|
default:
|
|
|
|
usingclassic = 0;
|
|
|
|
break;
|
|
|
|
}
|
2012-02-14 08:25:32 +08:00
|
|
|
|
|
|
|
/* compute cmode_modifier */
|
|
|
|
switch (k_flag) {
|
2015-11-20 04:44:07 +08:00
|
|
|
case NC_FORMAT_CLASSIC:
|
|
|
|
cmode_modifier = 0; break;
|
|
|
|
case NC_FORMAT_64BIT_OFFSET:
|
|
|
|
cmode_modifier = NC_64BIT_OFFSET; break;
|
|
|
|
case NC_FORMAT_NETCDF4:
|
|
|
|
cmode_modifier = NC_NETCDF4; break;
|
|
|
|
case NC_FORMAT_NETCDF4_CLASSIC:
|
|
|
|
cmode_modifier = NC_NETCDF4 | NC_CLASSIC_MODEL; break;
|
|
|
|
case NC_FORMAT_64BIT_DATA:
|
|
|
|
cmode_modifier = NC_CDF5; break;
|
2012-02-14 08:25:32 +08:00
|
|
|
default: ASSERT(0); /* cannot happen */
|
|
|
|
}
|
|
|
|
|
2012-03-26 09:34:32 +08:00
|
|
|
if(diskless)
|
|
|
|
cmode_modifier |= (NC_DISKLESS|NC_NOCLOBBER);
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
processsemantics();
|
2014-10-01 01:42:44 +08:00
|
|
|
if(!syntax_only && error_count == 0)
|
2011-07-28 04:48:58 +08:00
|
|
|
define_netcdf();
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2017-11-01 04:03:57 +08:00
|
|
|
done:
|
2018-11-16 01:00:38 +08:00
|
|
|
nullfree(netcdf_name);
|
|
|
|
nullfree(datasetname);
|
2017-11-01 04:03:57 +08:00
|
|
|
finalize_netcdf(code);
|
|
|
|
return code;
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
init_netcdf(void) /* initialize global counts, flags */
|
|
|
|
{
|
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-29 08:02:47 +08:00
|
|
|
int i;
|
2013-07-17 04:22:48 +08:00
|
|
|
memset((void*)&nullconstant,0,sizeof(NCConstant));
|
2010-06-03 21:24:43 +08:00
|
|
|
fillconstant = nullconstant;
|
|
|
|
fillconstant.nctype = NC_FILLVALUE;
|
2010-07-30 04:37:05 +08:00
|
|
|
|
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-29 08:02:47 +08:00
|
|
|
filldatalist = builddatalist(1);
|
|
|
|
dlappend(filldatalist,&fillconstant);
|
|
|
|
filldatalist->readonly = 1;
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
codebuffer = bbNew();
|
|
|
|
stmt = bbNew();
|
2012-03-15 07:26:48 +08:00
|
|
|
error_count = 0; /* Track # of errors */
|
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-29 08:02:47 +08:00
|
|
|
|
|
|
|
for(i=0;i<NC_MAX_VAR_DIMS;i++) onesvector[i] = 1;
|
|
|
|
memset(zerosvector,0,sizeof(zerosvector));
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
2017-11-01 04:03:57 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
finalize_netcdf(int retcode)
|
|
|
|
{
|
|
|
|
nc_finalize();
|
|
|
|
exit(retcode);
|
|
|
|
}
|