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.
|
|
|
|
* $Header: /upc/share/CVS/netcdf-3/ncgen/genc.c,v 1.6 2010/05/17 23:26:44 dmh Exp $
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#include "includes.h"
|
|
|
|
#include <ctype.h> /* for isprint() */
|
2023-12-01 01:29:43 +08:00
|
|
|
#include <stddef.h>
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
#ifdef ENABLE_C
|
|
|
|
|
|
|
|
#undef TRACE
|
|
|
|
|
|
|
|
/* Forward */
|
|
|
|
static const char* groupncid(Symbol*);
|
|
|
|
static const char* typencid(Symbol*);
|
|
|
|
static const char* varncid(Symbol*);
|
|
|
|
static const char* dimncid(Symbol*);
|
|
|
|
|
|
|
|
#ifdef USE_NETCDF4
|
|
|
|
static void definectype(Symbol*);
|
|
|
|
static void genc_deftype(Symbol*);
|
|
|
|
static void genc_definespecialattributes(Symbol* vsym);
|
2014-03-09 11:41:30 +08:00
|
|
|
static void genc_defineglobalspecials(void);
|
2010-06-03 21:24:43 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static void genc_defineattr(Symbol* asym);
|
|
|
|
static void genc_definevardata(Symbol*);
|
2012-02-14 08:25:32 +08:00
|
|
|
static void genc_write(Generator*,Symbol* sym, Bytebuffer* code,
|
|
|
|
int rank, size_t* start, size_t* count);
|
|
|
|
static void genc_writevar(Generator*,Symbol*,Bytebuffer*,int,size_t*,size_t*);
|
|
|
|
static void genc_writeattr(Generator*,Symbol*,Bytebuffer*,int,size_t*,size_t*);
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Generate C code for creating netCDF from in-memory structure.
|
|
|
|
*/
|
|
|
|
void
|
2018-11-16 01:00:38 +08:00
|
|
|
genc_netcdf(void)
|
2010-06-03 21:24:43 +08:00
|
|
|
{
|
2023-12-01 01:29:43 +08:00
|
|
|
size_t idim, ivar, iatt;
|
|
|
|
int maxdims;
|
2012-01-30 02:56:29 +08:00
|
|
|
int ndims, nvars, natts, ngatts;
|
2010-06-03 21:24:43 +08:00
|
|
|
char* cmode_string;
|
2018-11-16 01:00:38 +08:00
|
|
|
const char *filename = rootgroup->file.filename;
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
#ifdef USE_NETCDF4
|
2023-12-01 01:29:43 +08:00
|
|
|
size_t igrp, ityp;
|
|
|
|
int ngrps, ntyps;
|
2010-06-03 21:24:43 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
ndims = listlength(dimdefs);
|
|
|
|
nvars = listlength(vardefs);
|
|
|
|
natts = listlength(attdefs);
|
|
|
|
ngatts = listlength(gattdefs);
|
2012-01-30 02:56:29 +08:00
|
|
|
#ifdef USE_NETCDF4
|
2010-06-03 21:24:43 +08:00
|
|
|
ngrps = listlength(grpdefs);
|
|
|
|
ntyps = listlength(typdefs);
|
2012-01-30 02:56:29 +08:00
|
|
|
#endif /*USE_NETCDF4*/
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
/* wrap in main program */
|
|
|
|
codeline("#include <stdio.h>");
|
|
|
|
codeline("#include <stdlib.h>");
|
|
|
|
codeline("#include <netcdf.h>");
|
|
|
|
codeline("");
|
|
|
|
codeflush();
|
|
|
|
|
2010-11-10 06:53:03 +08:00
|
|
|
if(specialconstants) {
|
|
|
|
/* If the input referenced e.g. nan, inf, etc;
|
|
|
|
then provide definitions for them */
|
|
|
|
codeline("");
|
|
|
|
codeline("#define nanf (0.0f/0.0f)");
|
|
|
|
codeline("#define nan (0.0/0.0)");
|
|
|
|
codeline("#define inff (1.0f/0.0f)");
|
|
|
|
codeline("#define inf (1.0/0.0)");
|
|
|
|
codeline("#define infinityf inff");
|
|
|
|
codeline("#define infinity inf");
|
|
|
|
codeline("");
|
|
|
|
codeflush();
|
|
|
|
}
|
|
|
|
codeline("");
|
|
|
|
codeflush();
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
#ifdef USE_NETCDF4
|
|
|
|
|
|
|
|
/* Construct C type definitions*/
|
|
|
|
if (ntyps > 0) {
|
|
|
|
for(ityp = 0; ityp < ntyps; ityp++) {
|
|
|
|
Symbol* tsym = (Symbol*)listget(typdefs,ityp);
|
|
|
|
definectype(tsym);
|
|
|
|
}
|
|
|
|
codeline("");
|
|
|
|
}
|
|
|
|
codeflush();
|
|
|
|
|
|
|
|
/* Construct the chunking constants*/
|
|
|
|
if(!usingclassic) {
|
|
|
|
for(ivar=0;ivar<nvars;ivar++) {
|
|
|
|
Bytebuffer* tmp = bbNew();
|
|
|
|
Symbol* var = (Symbol*)listget(vardefs,ivar);
|
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
|
|
|
Specialdata* special = &var->var.special;
|
2010-06-03 21:24:43 +08:00
|
|
|
if(special->flags & _CHUNKSIZES_FLAG) {
|
|
|
|
int i;
|
|
|
|
size_t* chunks = special->_ChunkSizes;
|
2022-05-05 21:13:23 +08:00
|
|
|
if(special->nchunks == 0 || chunks == NULL) {
|
|
|
|
bbFree(tmp);
|
|
|
|
continue;
|
|
|
|
}
|
2010-06-03 21:24:43 +08:00
|
|
|
bbClear(tmp);
|
|
|
|
for(i=0;i<special->nchunks;i++) {
|
|
|
|
bbprintf(tmp,"%s%ld",
|
|
|
|
(i == 0?"":", "),special->_ChunkSizes[i]);
|
|
|
|
}
|
|
|
|
bbprintf0(stmt,"static size_t %s_chunksizes[%d] = {",
|
|
|
|
cname(var),special->nchunks);
|
|
|
|
codedump(stmt);
|
|
|
|
codedump(tmp);
|
|
|
|
codeline("} ;");
|
|
|
|
}
|
2017-05-15 08:10:02 +08:00
|
|
|
if(special->flags & _FILTER_FLAG) {
|
2020-02-17 03:59:33 +08:00
|
|
|
int k;
|
|
|
|
for(k=0;k<special->nfilters;k++) {
|
|
|
|
int i;
|
|
|
|
size_t nparams;
|
2020-09-28 02:43:46 +08:00
|
|
|
unsigned int* params = NULL;
|
|
|
|
NC_H5_Filterspec* nfs = special->_Filters[k];
|
2020-02-17 03:59:33 +08:00
|
|
|
if(nfs->nparams == 0 || nfs->params == NULL) continue;
|
|
|
|
bbClear(tmp);
|
|
|
|
nparams = nfs->nparams;
|
|
|
|
params = nfs->params;
|
|
|
|
for(i=0;i<nparams;i++) {
|
2020-09-28 02:43:46 +08:00
|
|
|
bbprintf(tmp,"%s%uU",
|
2017-04-28 03:01:59 +08:00
|
|
|
(i == 0?"":", "),params[i]);
|
2020-02-17 03:59:33 +08:00
|
|
|
}
|
|
|
|
bbprintf0(stmt,"static unsigned int %s_%d_filterparams[%d] = {",
|
|
|
|
cname(var),k,nparams);
|
|
|
|
codedump(stmt);
|
|
|
|
codedump(tmp);
|
|
|
|
codeline("} ;");
|
2017-04-28 03:01:59 +08:00
|
|
|
}
|
2020-02-17 03:59:33 +08:00
|
|
|
}
|
|
|
|
bbFree(tmp);
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
codeline("");
|
|
|
|
}
|
|
|
|
#endif /*USE_NETCDF4*/
|
|
|
|
|
|
|
|
/* Now construct the main procedures*/
|
|
|
|
codeline("void");
|
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
|
|
|
codeline("check_err(const int stat, int line, const char* file, const char* func) {");
|
2010-06-03 21:24:43 +08:00
|
|
|
codelined(1,"if (stat != NC_NOERR) {");
|
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
|
|
|
codelined(2,"(void)fprintf(stderr,\"line %d of %s.%s: %s\\n\", line, file, func, nc_strerror(stat));");
|
2010-06-03 21:24:43 +08:00
|
|
|
codelined(2,"fflush(stderr);");
|
|
|
|
codelined(2,"exit(1);");
|
|
|
|
codelined(1,"}");
|
|
|
|
codeline("}");
|
|
|
|
codeline("");
|
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
|
|
|
codeline("#define CHECK_ERR(err) check_err(err, __LINE__, __FILE__, __func__)");
|
|
|
|
codeline("");
|
2010-06-03 21:24:43 +08:00
|
|
|
codeline("int");
|
|
|
|
bbprintf0(stmt,"%s() {/* create %s */\n", mainname, filename);
|
|
|
|
codedump(stmt);
|
|
|
|
/* create necessary declarations */
|
2015-11-12 06:36:02 +08:00
|
|
|
codeline("");
|
2010-06-03 21:24:43 +08:00
|
|
|
codelined(1,"int stat; /* return status */");
|
|
|
|
codelined(1,"int ncid; /* netCDF id */");
|
|
|
|
codeflush();
|
|
|
|
|
|
|
|
#ifdef USE_NETCDF4
|
|
|
|
/* Define variables to hold group ids*/
|
|
|
|
if(!usingclassic) {
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* group ids */");
|
|
|
|
}
|
2015-11-12 06:36:02 +08:00
|
|
|
if(!usingclassic && ngrps > 0) {
|
2010-06-03 21:24:43 +08:00
|
|
|
for(igrp = 0; igrp < ngrps; igrp++) {
|
|
|
|
Symbol* gsym = (Symbol*)listget(grpdefs,igrp);
|
|
|
|
bbprintf0(stmt,"%sint %s;\n",indented(1),groupncid(gsym));
|
|
|
|
codedump(stmt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* define variables to hold type ids*/
|
|
|
|
if(!usingclassic && ntyps > 0) {
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* type ids */");
|
|
|
|
for(ityp = 0; ityp < ntyps; ityp++) {
|
|
|
|
Symbol* tsym = (Symbol*)listget(typdefs,ityp);
|
|
|
|
bbprintf0(stmt,"%sint %s;\n",indented(1), typencid(tsym));
|
|
|
|
codedump(stmt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
codeflush();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (ndims > 0) {
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* dimension ids */");
|
|
|
|
for(idim = 0; idim < ndims; idim++) {
|
|
|
|
Symbol* dsym = (Symbol*)listget(dimdefs,idim);
|
|
|
|
bbprintf0(stmt,"%sint %s;\n", indented(1), dimncid(dsym));
|
|
|
|
codedump(stmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* dimension lengths */");
|
|
|
|
for(idim = 0; idim < ndims; idim++) {
|
|
|
|
Symbol* dsym = (Symbol*)listget(dimdefs,idim);
|
2012-02-14 08:25:32 +08:00
|
|
|
if(dsym->dim.isunlimited) {
|
2010-06-03 21:24:43 +08:00
|
|
|
bbprintf0(stmt,"%ssize_t %s_len = NC_UNLIMITED;\n",
|
|
|
|
indented(1),cname(dsym));
|
|
|
|
} else {
|
|
|
|
bbprintf0(stmt,"%ssize_t %s_len = %lu;\n",
|
|
|
|
indented(1),
|
|
|
|
cname(dsym),
|
|
|
|
(unsigned long) dsym->dim.declsize);
|
|
|
|
}
|
|
|
|
codedump(stmt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
codeflush();
|
|
|
|
|
|
|
|
maxdims = 0; /* most dimensions of any variable */
|
|
|
|
for(ivar = 0; ivar < nvars; ivar++) {
|
|
|
|
Symbol* vsym = (Symbol*)listget(vardefs,ivar);
|
|
|
|
if(vsym->typ.dimset.ndims > maxdims)
|
|
|
|
maxdims = vsym->typ.dimset.ndims;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nvars > 0) {
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* variable ids */");
|
|
|
|
for(ivar = 0; ivar < nvars; ivar++) {
|
|
|
|
Symbol* vsym = (Symbol*)listget(vardefs,ivar);
|
|
|
|
bbprintf0(stmt," int %s;\n", varncid(vsym));
|
|
|
|
codedump(stmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* rank (number of dimensions) for each variable */");
|
|
|
|
for(ivar = 0; ivar < nvars; ivar++) {
|
|
|
|
Symbol* vsym = (Symbol*)listget(vardefs,ivar);
|
|
|
|
bbprintf0(stmt,"# define RANK_%s %d\n", cname(vsym),
|
|
|
|
vsym->typ.dimset.ndims);
|
|
|
|
codedump(stmt);
|
|
|
|
}
|
|
|
|
if (maxdims > 0) { /* we have dimensioned variables */
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* variable shapes */");
|
|
|
|
for(ivar = 0; ivar < nvars; ivar++) {
|
|
|
|
Symbol* vsym = (Symbol*)listget(vardefs,ivar);
|
|
|
|
if (vsym->typ.dimset.ndims > 0) {
|
|
|
|
bbprintf0(stmt," int %s_dims[RANK_%s];\n",
|
|
|
|
cname(vsym), cname(vsym));
|
|
|
|
codedump(stmt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
codeflush();
|
|
|
|
|
2016-09-02 12:06:07 +08:00
|
|
|
/* Set log level */
|
|
|
|
if(ncloglevel >= 0) {
|
|
|
|
codeline("");
|
|
|
|
bbprintf0(stmt," nc_set_log_level(%d); /* set log level */",ncloglevel);
|
|
|
|
codedump(stmt);
|
|
|
|
codeline("");
|
|
|
|
}
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
/* create netCDF file, uses NC_CLOBBER mode */
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* enter define mode */");
|
|
|
|
|
|
|
|
if (!cmode_modifier) {
|
|
|
|
cmode_string = "NC_CLOBBER";
|
|
|
|
} else if (cmode_modifier & NC_64BIT_OFFSET) {
|
|
|
|
cmode_string = "NC_CLOBBER|NC_64BIT_OFFSET";
|
|
|
|
#ifdef USE_NETCDF4
|
|
|
|
} else if (cmode_modifier & NC_CLASSIC_MODEL) {
|
|
|
|
cmode_string = "NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL";
|
|
|
|
} else if (cmode_modifier & NC_NETCDF4) {
|
2015-11-12 06:36:02 +08:00
|
|
|
cmode_string = "NC_CLOBBER|NC_NETCDF4";
|
2010-06-03 21:24:43 +08:00
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
derror("unknown cmode modifier");
|
|
|
|
cmode_string = "NC_CLOBBER";
|
|
|
|
}
|
|
|
|
bbprintf0(stmt," stat = nc_create(\"%s\", %s, &ncid);\n",
|
|
|
|
filename,cmode_string);
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
codeflush();
|
2015-11-12 06:36:02 +08:00
|
|
|
|
2014-03-09 11:41:30 +08:00
|
|
|
#ifdef USE_NETCDF4
|
|
|
|
genc_defineglobalspecials();
|
|
|
|
#endif /*USE_NETCDF4*/
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
#ifdef USE_NETCDF4
|
|
|
|
/* Define the group structure */
|
|
|
|
/* ncid created above is also root group*/
|
|
|
|
if(!usingclassic) {
|
|
|
|
bbprintf0(stmt," %s = ncid;\n",groupncid(rootgroup));
|
|
|
|
codedump(stmt);
|
|
|
|
/* walking grpdefs list will do a preorder walk of all defined groups*/
|
|
|
|
for(igrp=0;igrp<listlength(grpdefs);igrp++) {
|
|
|
|
Symbol* gsym = (Symbol*)listget(grpdefs,igrp);
|
|
|
|
if(gsym == rootgroup) continue; /* ignore root*/
|
|
|
|
if(gsym->container == NULL)
|
|
|
|
PANIC("null container");
|
|
|
|
bbprintf0(stmt,
|
|
|
|
" stat = nc_def_grp(%s, \"%s\", &%s);\n",
|
|
|
|
groupncid(gsym->container),
|
|
|
|
gsym->name, groupncid(gsym));
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
codeflush();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_NETCDF4
|
|
|
|
/* Construct code to define types*/
|
|
|
|
if(ntyps > 0) {
|
|
|
|
codeline("");
|
|
|
|
for(ityp = 0; ityp < ntyps; ityp++) {
|
|
|
|
Symbol* tsym = (Symbol*)listget(typdefs,ityp);
|
|
|
|
if(tsym->subclass == NC_PRIM
|
|
|
|
|| tsym->subclass == NC_ARRAY) continue; /* no need to do these*/
|
|
|
|
genc_deftype(tsym);
|
|
|
|
codeline("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
codeflush();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* define dimensions from info in dims array */
|
|
|
|
if (ndims > 0) {
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* define dimensions */");
|
|
|
|
for(idim = 0; idim < ndims; idim++) {
|
|
|
|
Symbol* dsym = (Symbol*)listget(dimdefs,idim);
|
2012-02-14 08:25:32 +08:00
|
|
|
{
|
|
|
|
bbprintf0(stmt,
|
|
|
|
" stat = nc_def_dim(%s, \"%s\", %s_len, &%s);\n",
|
|
|
|
groupncid(dsym->container),
|
|
|
|
escapifyname(dsym->name),
|
|
|
|
cname(dsym),
|
|
|
|
dimncid(dsym));
|
|
|
|
}
|
2010-06-03 21:24:43 +08:00
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
codeflush();
|
|
|
|
|
|
|
|
/* define variables from info in vars array */
|
|
|
|
if (nvars > 0) {
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* define variables */");
|
|
|
|
for(ivar = 0; ivar < nvars; ivar++) {
|
|
|
|
Symbol* vsym = (Symbol*)listget(vardefs,ivar);
|
|
|
|
Symbol* basetype = vsym->typ.basetype;
|
|
|
|
Dimset* dimset = &vsym->typ.dimset;
|
|
|
|
codeline("");
|
|
|
|
if(dimset->ndims > 0) {
|
|
|
|
for(idim = 0; idim < dimset->ndims; idim++) {
|
|
|
|
Symbol* dsym = dimset->dimsyms[idim];
|
|
|
|
bbprintf0(stmt,
|
|
|
|
" %s_dims[%d] = %s;\n",
|
|
|
|
cname(vsym),
|
|
|
|
idim,
|
|
|
|
dimncid(dsym));
|
|
|
|
codedump(stmt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bbprintf0(stmt,
|
|
|
|
" stat = nc_def_var(%s, \"%s\", %s, RANK_%s, %s, &%s);\n",
|
|
|
|
groupncid(vsym->container),
|
|
|
|
escapifyname(vsym->name),
|
|
|
|
typencid(basetype),
|
|
|
|
cname(vsym),
|
|
|
|
(dimset->ndims == 0?"0":poolcat(cname(vsym),"_dims")),
|
|
|
|
varncid(vsym));
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
#ifdef USE_NETCDF4
|
|
|
|
genc_definespecialattributes(vsym);
|
|
|
|
#endif /*USE_NETCDF4*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
codeflush();
|
2015-11-12 06:36:02 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
/* Define the global attributes*/
|
|
|
|
if(ngatts > 0) {
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* assign global attributes */");
|
|
|
|
for(iatt = 0; iatt < ngatts; iatt++) {
|
|
|
|
Symbol* gasym = (Symbol*)listget(gattdefs,iatt);
|
2015-11-12 06:36:02 +08:00
|
|
|
genc_defineattr(gasym);
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
codeline("");
|
|
|
|
}
|
|
|
|
codeflush();
|
2015-11-12 06:36:02 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
/* Define the variable specific attributes*/
|
|
|
|
if(natts > 0) {
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* assign per-variable attributes */");
|
|
|
|
for(iatt = 0; iatt < natts; iatt++) {
|
|
|
|
Symbol* asym = (Symbol*)listget(attdefs,iatt);
|
|
|
|
genc_defineattr(asym);
|
|
|
|
}
|
|
|
|
codeline("");
|
|
|
|
}
|
|
|
|
codeflush();
|
|
|
|
|
|
|
|
if (nofill_flag) {
|
|
|
|
codelined(1,"/* don't initialize variables with fill values */");
|
|
|
|
bbindent(stmt,1);
|
|
|
|
bbprintf0(stmt,"stat = nc_set_fill(%s, NC_NOFILL, 0);",groupncid(rootgroup));
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* leave define mode */");
|
|
|
|
bbprintf0(stmt," stat = nc_enddef (%s);\n",groupncid(rootgroup));
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
codeflush();
|
|
|
|
|
2012-03-08 07:38:51 +08:00
|
|
|
if(!header_only) {
|
|
|
|
/* Load values into those variables with defined data */
|
|
|
|
if(nvars > 0) {
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"/* assign variable data */");
|
|
|
|
for(ivar = 0; ivar < nvars; ivar++) {
|
|
|
|
Symbol* vsym = (Symbol*)listget(vardefs,ivar);
|
|
|
|
if(vsym->data != NULL) genc_definevardata(vsym);
|
|
|
|
}
|
|
|
|
codeline("");
|
|
|
|
}
|
|
|
|
codeflush();
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef USE_NETCDF4
|
2014-03-09 11:41:30 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
genc_defineglobalspecials(void)
|
|
|
|
{
|
|
|
|
if(usingclassic) return;
|
|
|
|
if(!/*Main.*/format_attribute) return;
|
2019-10-31 02:53:54 +08:00
|
|
|
/* There are currently no global specials that
|
|
|
|
can be defined using nc_put_att.*/
|
2014-03-09 11:41:30 +08:00
|
|
|
}
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
static void
|
|
|
|
genc_definespecialattributes(Symbol* vsym)
|
|
|
|
{
|
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
|
|
|
Specialdata* special = &vsym->var.special;
|
2010-06-03 21:24:43 +08:00
|
|
|
if(usingclassic) return;
|
|
|
|
if(special->flags & _STORAGE_FLAG) {
|
2020-03-01 03:06:21 +08:00
|
|
|
const char* storage = NULL;
|
2010-06-03 21:24:43 +08:00
|
|
|
size_t* chunks = special->_ChunkSizes;
|
2020-03-01 03:06:21 +08:00
|
|
|
switch (special->_Storage) {
|
|
|
|
case NC_CONTIGUOUS: storage = "NC_CONTIGUOUS"; break;
|
|
|
|
case NC_COMPACT: storage = "NC_COMPACT"; break;
|
|
|
|
case NC_CHUNKED: storage = "NC_CHUNKED"; break;
|
|
|
|
}
|
2010-06-03 21:24:43 +08:00
|
|
|
bbprintf0(stmt,
|
|
|
|
" stat = nc_def_var_chunking(%s, %s, %s, ",
|
|
|
|
groupncid(vsym->container),
|
|
|
|
varncid(vsym),
|
2020-03-01 03:06:21 +08:00
|
|
|
storage);
|
2010-06-03 21:24:43 +08:00
|
|
|
codedump(stmt);
|
|
|
|
if(special->nchunks == 0 || chunks == NULL)
|
|
|
|
codepartial("NULL");
|
|
|
|
else {
|
|
|
|
bbprintf0(stmt,"%s_chunksizes",cname(vsym));
|
2015-11-12 06:36:02 +08:00
|
|
|
codedump(stmt);
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
codeline(");");
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2015-11-12 06:36:02 +08:00
|
|
|
}
|
2010-06-03 21:24:43 +08:00
|
|
|
if(special->flags & _FLETCHER32_FLAG) {
|
|
|
|
bbprintf0(stmt,
|
|
|
|
" stat = nc_def_var_fletcher32(%s, %s, %d);\n",
|
|
|
|
groupncid(vsym->container),
|
|
|
|
varncid(vsym),
|
|
|
|
special->_Fletcher32);
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
if(special->flags & (_DEFLATE_FLAG | _SHUFFLE_FLAG)) {
|
|
|
|
bbprintf0(stmt,
|
|
|
|
" stat = nc_def_var_deflate(%s, %s, %s, %d, %d);\n",
|
|
|
|
groupncid(vsym->container),
|
|
|
|
varncid(vsym),
|
|
|
|
(special->_Shuffle == 1?"NC_SHUFFLE":"NC_NOSHUFFLE"),
|
|
|
|
(special->_DeflateLevel >= 0?1:0),
|
|
|
|
(special->_DeflateLevel >= 0?special->_DeflateLevel:0));
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2015-11-12 06:36:02 +08:00
|
|
|
}
|
2010-06-03 21:24:43 +08:00
|
|
|
if(special->flags & _ENDIAN_FLAG) {
|
|
|
|
bbprintf0(stmt,
|
|
|
|
" stat = nc_def_var_endian(%s, %s, %s);\n",
|
|
|
|
groupncid(vsym->container),
|
|
|
|
varncid(vsym),
|
|
|
|
(special->_Endianness == NC_ENDIAN_LITTLE?"NC_ENDIAN_LITTLE"
|
|
|
|
:"NC_ENDIAN_BIG")
|
|
|
|
);
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2015-11-12 06:36:02 +08:00
|
|
|
}
|
2010-06-03 21:24:43 +08:00
|
|
|
if(special->flags & _NOFILL_FLAG) {
|
|
|
|
bbprintf0(stmt,
|
|
|
|
" stat = nc_def_var_fill(%s, %s, %s, NULL);\n",
|
|
|
|
groupncid(vsym->container),
|
|
|
|
varncid(vsym),
|
|
|
|
(special->_Fill?"NC_FILL":"NC_NOFILL")
|
|
|
|
);
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2015-11-12 06:36:02 +08:00
|
|
|
}
|
2017-05-15 08:10:02 +08:00
|
|
|
if(special->flags & _FILTER_FLAG) {
|
2020-02-17 03:59:33 +08:00
|
|
|
int k;
|
|
|
|
for(k=0;k<special->nfilters;k++) {
|
2020-09-28 02:43:46 +08:00
|
|
|
NC_H5_Filterspec* nfs = special->_Filters[k];
|
2020-02-17 03:59:33 +08:00
|
|
|
bbprintf0(stmt,
|
2020-09-28 02:43:46 +08:00
|
|
|
" stat = nc_def_var_filter(%s, %s, %u, %lu, ",
|
2017-04-28 03:01:59 +08:00
|
|
|
groupncid(vsym->container),
|
|
|
|
varncid(vsym),
|
2020-02-17 03:59:33 +08:00
|
|
|
nfs->filterid,
|
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
|
|
|
(unsigned long)nfs->nparams
|
2017-04-28 03:01:59 +08:00
|
|
|
);
|
2020-02-17 03:59:33 +08:00
|
|
|
codedump(stmt);
|
|
|
|
if(nfs->nparams == 0 || nfs->params == NULL)
|
|
|
|
codepartial("NULL");
|
|
|
|
else {
|
|
|
|
bbprintf0(stmt,"%s_%d_filterparams",cname(vsym),k);
|
2017-04-28 03:01:59 +08:00
|
|
|
codedump(stmt);
|
2020-02-17 03:59:33 +08:00
|
|
|
}
|
|
|
|
codeline(");");
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2017-04-28 03:01:59 +08:00
|
|
|
}
|
|
|
|
}
|
2022-02-20 07:55:36 +08:00
|
|
|
if(special->flags & (_QUANTIZEBG_FLAG | _QUANTIZEGBR_FLAG)) {
|
2022-01-29 04:04:16 +08:00
|
|
|
const char* alg = NULL;
|
2022-01-25 06:22:24 +08:00
|
|
|
switch(special->_Quantizer) {
|
|
|
|
case NC_QUANTIZE_BITGROOM: alg = "NC_QUANTIZE_BITGROOM";
|
2022-01-29 04:04:16 +08:00
|
|
|
case NC_QUANTIZE_GRANULARBR: alg = "NC_QUANTIZE_GRANULARBR";
|
2022-01-25 06:22:24 +08:00
|
|
|
default: alg = "NC_NOQUANTIZE";
|
|
|
|
}
|
|
|
|
bbprintf0(stmt,
|
|
|
|
" stat = nc_def_var_quantize(%s, %s, %s, %d);\n",
|
|
|
|
groupncid(vsym->container),
|
|
|
|
varncid(vsym),
|
|
|
|
alg, special->_NSD
|
|
|
|
);
|
|
|
|
codedump(stmt);
|
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
|
|
|
}
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
#endif /*USE_NETCDF4*/
|
|
|
|
|
|
|
|
void
|
2018-11-16 01:00:38 +08:00
|
|
|
genc_close(void)
|
2010-06-03 21:24:43 +08:00
|
|
|
{
|
|
|
|
bbprintf0(stmt,"%sstat = nc_close(%s);\n",indented(1),groupncid(rootgroup));
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
#ifndef vms
|
|
|
|
codelined(1,"return 0;");
|
|
|
|
#else
|
|
|
|
codelined(1,"return 1;");
|
|
|
|
#endif
|
|
|
|
codeline("}");
|
|
|
|
codeflush();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Output a C statement
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* return C name for netCDF type, given type code */
|
|
|
|
const char *
|
|
|
|
nctype(nc_type type)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case NC_CHAR: return "NC_CHAR";
|
|
|
|
case NC_BYTE: return "NC_BYTE";
|
|
|
|
case NC_SHORT: return "NC_SHORT";
|
|
|
|
case NC_INT: return "NC_INT";
|
|
|
|
case NC_FLOAT: return "NC_FLOAT";
|
|
|
|
case NC_DOUBLE: return "NC_DOUBLE";
|
|
|
|
case NC_UBYTE: return "NC_UBYTE";
|
|
|
|
case NC_USHORT: return "NC_USHORT";
|
|
|
|
case NC_UINT: return "NC_UINT";
|
|
|
|
case NC_INT64: return "NC_INT64";
|
|
|
|
case NC_UINT64: return "NC_UINT64";
|
|
|
|
case NC_STRING: return "NC_STRING";
|
|
|
|
default: PANIC("nctype: bad type code");
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return C type name for netCDF type, given type code.
|
|
|
|
*/
|
2015-11-12 06:36:02 +08:00
|
|
|
const char*
|
2010-06-03 21:24:43 +08:00
|
|
|
ncctype(nc_type type)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case NC_CHAR:
|
|
|
|
return "char";
|
|
|
|
case NC_BYTE:
|
|
|
|
return "signed char";
|
|
|
|
case NC_SHORT:
|
|
|
|
return "short";
|
|
|
|
case NC_INT:
|
|
|
|
return "int";
|
|
|
|
case NC_FLOAT:
|
|
|
|
return "float";
|
|
|
|
case NC_DOUBLE:
|
|
|
|
return "double";
|
|
|
|
case NC_UBYTE:
|
|
|
|
return "unsigned char";
|
|
|
|
case NC_USHORT:
|
|
|
|
return "unsigned short";
|
|
|
|
case NC_UINT:
|
|
|
|
return "unsigned int";
|
|
|
|
case NC_INT64:
|
|
|
|
return "signed long long";
|
|
|
|
case NC_UINT64:
|
|
|
|
return "unsigned long long";
|
|
|
|
case NC_STRING:
|
|
|
|
return "char*";
|
|
|
|
default:
|
|
|
|
PANIC1("ncctype: bad type code:%d",type);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return C type name for netCDF type suffix, given type code.
|
|
|
|
*/
|
2015-11-12 06:36:02 +08:00
|
|
|
const char*
|
2010-06-03 21:24:43 +08:00
|
|
|
ncstype(nc_type nctype)
|
|
|
|
{
|
|
|
|
switch (nctype) {
|
|
|
|
case NC_CHAR:
|
|
|
|
return "text";
|
|
|
|
case NC_BYTE:
|
|
|
|
return "schar";
|
|
|
|
case NC_SHORT:
|
|
|
|
return "short";
|
|
|
|
case NC_INT:
|
|
|
|
return "int";
|
|
|
|
case NC_FLOAT:
|
|
|
|
return "float";
|
|
|
|
case NC_DOUBLE:
|
|
|
|
return "double";
|
|
|
|
case NC_UBYTE:
|
|
|
|
return "ubyte";
|
|
|
|
case NC_USHORT:
|
|
|
|
return "ushort";
|
|
|
|
case NC_UINT:
|
|
|
|
return "uint";
|
|
|
|
case NC_INT64:
|
|
|
|
return "longlong";
|
|
|
|
case NC_UINT64:
|
|
|
|
return "ulonglong";
|
|
|
|
case NC_STRING:
|
|
|
|
return "string";
|
|
|
|
default:
|
|
|
|
derror("ncstype: bad type code: %d",nctype);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the group name for the specified group*/
|
|
|
|
static const char*
|
|
|
|
groupncid(Symbol* sym)
|
|
|
|
{
|
|
|
|
#ifdef USE_NETCDF4
|
|
|
|
if(usingclassic) {
|
|
|
|
return "ncid";
|
|
|
|
} else {
|
|
|
|
char* grptmp;
|
|
|
|
const char* tmp1;
|
|
|
|
if(sym == NULL) return groupncid(rootgroup);
|
|
|
|
ASSERT(sym->objectclass == NC_GRP);
|
|
|
|
tmp1 = cname(sym);
|
|
|
|
grptmp = poolalloc(strlen(tmp1)+strlen("_grp")+1);
|
|
|
|
strcpy(grptmp,tmp1);
|
|
|
|
strcat(grptmp,"_grp");
|
|
|
|
return grptmp;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
return "ncid";
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the C name for a given type's id*/
|
|
|
|
/* Watch out: the result is a static*/
|
|
|
|
static const char*
|
|
|
|
typencid(Symbol* tsym)
|
|
|
|
{
|
|
|
|
char* typtmp;
|
|
|
|
const char* tmp1;
|
|
|
|
if(tsym->subclass == NC_PRIM)
|
|
|
|
return nctype(tsym->typ.typecode);
|
|
|
|
tmp1 = ctypename(tsym);
|
|
|
|
typtmp = poolalloc(strlen(tmp1)+strlen("_typ")+1);
|
|
|
|
strcpy(typtmp,tmp1);
|
|
|
|
strcat(typtmp,"_typ");
|
|
|
|
return typtmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the C name for a given var's id*/
|
|
|
|
/* Watch out: the result is a static*/
|
|
|
|
static const char*
|
|
|
|
varncid(Symbol* vsym)
|
|
|
|
{
|
|
|
|
const char* tmp1;
|
|
|
|
char* vartmp;
|
|
|
|
tmp1 = cname(vsym);
|
|
|
|
vartmp = poolalloc(strlen(tmp1)+strlen("_id")+1);
|
|
|
|
strcpy(vartmp,tmp1);
|
|
|
|
strcat(vartmp,"_id");
|
|
|
|
return vartmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the C name for a given dim's id*/
|
2013-09-21 10:31:21 +08:00
|
|
|
/* Watch out: the result is pooled*/
|
2010-06-03 21:24:43 +08:00
|
|
|
static const char*
|
|
|
|
dimncid(Symbol* dsym)
|
|
|
|
{
|
|
|
|
const char* tmp1;
|
|
|
|
char* dimtmp;
|
|
|
|
tmp1 = cname(dsym);
|
2013-09-22 06:19:06 +08:00
|
|
|
dimtmp = poolalloc(strlen(tmp1)+strlen("_dim")+1);
|
2010-06-03 21:24:43 +08:00
|
|
|
strcpy(dimtmp,tmp1);
|
2013-09-22 06:19:06 +08:00
|
|
|
strcat(dimtmp,"_dim");
|
2010-06-03 21:24:43 +08:00
|
|
|
return dimtmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the C name for a given type*/
|
|
|
|
const char*
|
|
|
|
ctypename(Symbol* tsym)
|
|
|
|
{
|
|
|
|
const char* name;
|
|
|
|
ASSERT(tsym->objectclass == NC_TYPE);
|
|
|
|
if(tsym->subclass == NC_PRIM)
|
|
|
|
name = ncctype(tsym->typ.typecode);
|
|
|
|
else
|
|
|
|
name = cname(tsym);
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef USE_NETCDF4
|
|
|
|
static void
|
|
|
|
definectype(Symbol* tsym)
|
|
|
|
{
|
|
|
|
int i,j;
|
|
|
|
|
|
|
|
ASSERT(tsym->objectclass == NC_TYPE);
|
|
|
|
switch (tsym->subclass) {
|
|
|
|
case NC_PRIM: break; /* these are already taken care of*/
|
|
|
|
case NC_OPAQUE:
|
|
|
|
bbprintf0(stmt,"typedef unsigned char %s[%lu];\n",
|
|
|
|
cname(tsym), tsym->typ.size);
|
|
|
|
codedump(stmt);
|
|
|
|
break;
|
|
|
|
case NC_ENUM:
|
|
|
|
for(i=0;i<listlength(tsym->subnodes);i++) {
|
|
|
|
Symbol* econst = (Symbol*)listget(tsym->subnodes,i);
|
2012-02-14 08:25:32 +08:00
|
|
|
Bytebuffer* econststring = bbNew();
|
2010-06-03 21:24:43 +08:00
|
|
|
ASSERT(econst->subclass == NC_ECONST);
|
2018-11-16 01:00:38 +08:00
|
|
|
c_generator->constant(c_generator,tsym,econst->typ.econst,econststring);
|
2012-02-14 08:25:32 +08:00
|
|
|
bbNull(econststring);
|
2013-09-21 10:31:21 +08:00
|
|
|
/* Enum constants must be converted to a fully qualified name */
|
2010-06-03 21:24:43 +08:00
|
|
|
bbprintf0(stmt,"#define %s ((%s)%s)\n",
|
|
|
|
cname(econst),
|
|
|
|
ctypename(econst->typ.basetype),
|
2012-02-14 08:25:32 +08:00
|
|
|
bbContents(econststring));
|
|
|
|
bbFree(econststring);
|
2010-06-03 21:24:43 +08:00
|
|
|
codedump(stmt);
|
|
|
|
}
|
|
|
|
bbprintf0(stmt,"typedef %s %s;\n",
|
|
|
|
ctypename(tsym->typ.basetype), cname(tsym));
|
|
|
|
codedump(stmt);
|
|
|
|
break;
|
|
|
|
case NC_VLEN:
|
|
|
|
bbprintf0(stmt,"typedef nc_vlen_t %s;\n",
|
|
|
|
ctypename(tsym));
|
|
|
|
codedump(stmt);
|
|
|
|
break;
|
|
|
|
case NC_COMPOUND:
|
|
|
|
bbprintf0(stmt,"typedef struct %s {\n",cname(tsym));
|
|
|
|
codedump(stmt);
|
|
|
|
for(i=0;i<listlength(tsym->subnodes);i++) {
|
|
|
|
Symbol* efield = (Symbol*)listget(tsym->subnodes,i);
|
|
|
|
ASSERT(efield->subclass == NC_FIELD);
|
|
|
|
bbprintf0(stmt,"%s%s %s",
|
|
|
|
indented(1),ctypename(efield->typ.basetype),cname(efield));
|
|
|
|
codedump(stmt);
|
|
|
|
/* compute any dimension specification*/
|
|
|
|
if(efield->typ.dimset.ndims > 0) {
|
|
|
|
Bytebuffer* dimbuf = bbNew();
|
|
|
|
for(j=0;j<efield->typ.dimset.ndims;j++) {
|
|
|
|
Symbol* dim;
|
|
|
|
char tmp[64];
|
|
|
|
bbCat(dimbuf,"[");
|
|
|
|
dim = efield->typ.dimset.dimsyms[j];
|
|
|
|
ASSERT(dim->dim.isconstant);
|
|
|
|
snprintf(tmp,sizeof(tmp),"%u",
|
|
|
|
(unsigned int)dim->dim.declsize);
|
|
|
|
bbCat(dimbuf,tmp);
|
|
|
|
bbCat(dimbuf,"]");
|
|
|
|
}
|
|
|
|
codedump(dimbuf);
|
|
|
|
bbFree(dimbuf);
|
|
|
|
}
|
|
|
|
codeline(";");
|
|
|
|
}
|
|
|
|
bbprintf0(stmt,"} %s;\n", ctypename(tsym));
|
|
|
|
codedump(stmt);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NC_ARRAY:
|
|
|
|
/* ignore: this will be handled by def_var*/
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: panic("definectype: unexpected type subclass: %d",tsym->subclass);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Generate the C code for defining a given type
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
genc_deftype(Symbol* tsym)
|
|
|
|
{
|
2023-12-01 01:29:43 +08:00
|
|
|
size_t i;
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
ASSERT(tsym->objectclass == NC_TYPE);
|
|
|
|
switch (tsym->subclass) {
|
|
|
|
case NC_PRIM: break; /* these are already taken care of*/
|
|
|
|
case NC_OPAQUE:
|
|
|
|
bbprintf0(stmt,"%sstat = nc_def_opaque(%s, %lu, \"%s\", &%s);\n",
|
|
|
|
indented(1),
|
|
|
|
groupncid(tsym->container),
|
|
|
|
tsym->typ.size,
|
|
|
|
tsym->name,
|
|
|
|
typencid(tsym));
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
break;
|
|
|
|
case NC_ENUM:
|
|
|
|
codelined(1,"{");
|
|
|
|
bbprintf0(stmt,"%s%s econst;\n",
|
|
|
|
indented(1),
|
|
|
|
ncctype(tsym->typ.basetype->typ.typecode));
|
|
|
|
codedump(stmt);
|
|
|
|
bbprintf0(stmt,"%sstat = nc_def_enum(%s, %s, \"%s\", &%s);\n",
|
|
|
|
indented(1),
|
|
|
|
groupncid(tsym->container),
|
|
|
|
nctype(tsym->typ.basetype->typ.typecode),
|
|
|
|
tsym->name,
|
|
|
|
typencid(tsym));
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
for(i=0;i<listlength(tsym->subnodes);i++) {
|
|
|
|
Symbol* econst = (Symbol*)listget(tsym->subnodes,i);
|
2012-02-14 08:25:32 +08:00
|
|
|
Bytebuffer* econststring = bbNew();
|
2010-06-03 21:24:43 +08:00
|
|
|
ASSERT(econst->subclass == NC_ECONST);
|
2018-11-16 01:00:38 +08:00
|
|
|
c_generator->constant(c_generator,tsym,econst->typ.econst,econststring);
|
2012-02-14 08:25:32 +08:00
|
|
|
bbNull(econststring);
|
2010-06-03 21:24:43 +08:00
|
|
|
bbprintf0(stmt,"%seconst = %s;\n",
|
2012-02-14 08:25:32 +08:00
|
|
|
indented(1),bbContents(econststring));
|
|
|
|
bbFree(econststring);
|
2010-06-03 21:24:43 +08:00
|
|
|
codedump(stmt);
|
|
|
|
bbprintf0(stmt,"%sstat = nc_insert_enum(%s, %s, \"%s\", &econst);\n",
|
|
|
|
indented(1),
|
|
|
|
groupncid(tsym->container),
|
|
|
|
typencid(tsym),
|
|
|
|
escapifyname(econst->name));
|
|
|
|
codedump(stmt);
|
|
|
|
}
|
|
|
|
codelined(1,"}");
|
|
|
|
break;
|
|
|
|
case NC_VLEN:
|
|
|
|
bbprintf0(stmt,"%sstat = nc_def_vlen(%s, \"%s\", %s, &%s);",
|
|
|
|
indented(1),
|
|
|
|
groupncid(tsym->container),
|
|
|
|
escapifyname(tsym->name),
|
|
|
|
typencid(tsym->typ.basetype),
|
|
|
|
typencid(tsym));
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
break;
|
|
|
|
case NC_COMPOUND:
|
|
|
|
bbprintf0(stmt,"%sstat = nc_def_compound(%s, sizeof(%s), \"%s\", &%s);",
|
|
|
|
indented(1),
|
|
|
|
groupncid(tsym->container),
|
|
|
|
ctypename(tsym),
|
|
|
|
escapifyname(tsym->name),
|
|
|
|
typencid(tsym));
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
/* Generate the field dimension constants*/
|
|
|
|
codelined(1,"{");
|
|
|
|
for(i=0;i<listlength(tsym->subnodes);i++) {
|
|
|
|
int j;
|
|
|
|
Symbol* efield = (Symbol*)listget(tsym->subnodes,i);
|
|
|
|
ASSERT(efield->subclass == NC_FIELD);
|
2015-11-12 06:36:02 +08:00
|
|
|
if(efield->typ.dimset.ndims == 0) continue;
|
2010-06-03 21:24:43 +08:00
|
|
|
bbprintf0(stmt,"%sstatic int %s_dims[%d] = {\n",
|
|
|
|
indented(1),
|
|
|
|
cname(efield),efield->typ.dimset.ndims);
|
|
|
|
for(j=0;j<efield->typ.dimset.ndims;j++) {
|
|
|
|
char tmp[256];
|
|
|
|
Symbol* e = efield->typ.dimset.dimsyms[j];
|
|
|
|
ASSERT(e->dim.isconstant);
|
|
|
|
snprintf(tmp,sizeof(tmp),"%u",(unsigned int)e->dim.declsize);
|
|
|
|
bbCat(stmt,(j==0?"":", "));
|
|
|
|
bbCat(stmt,tmp);
|
|
|
|
}
|
|
|
|
bbCat(stmt,"};");
|
|
|
|
codedump(stmt);
|
|
|
|
}
|
|
|
|
for(i=0;i<listlength(tsym->subnodes);i++) {
|
|
|
|
Symbol* efield = (Symbol*)listget(tsym->subnodes,i);
|
|
|
|
char tmp[1024];
|
|
|
|
ASSERT(efield->subclass == NC_FIELD);
|
|
|
|
#ifdef TESTALIGNMENT
|
|
|
|
snprintf(tmp,sizeof(tmp),"%lu",efield->typ.offset);
|
|
|
|
#else
|
|
|
|
snprintf(tmp,sizeof(tmp),"NC_COMPOUND_OFFSET(%s,%s)",
|
|
|
|
ctypename(tsym), cname(efield));
|
|
|
|
#endif
|
2015-11-12 06:36:02 +08:00
|
|
|
if(efield->typ.dimset.ndims > 0){
|
2010-06-03 21:24:43 +08:00
|
|
|
bbprintf0(stmt,"%sstat = nc_insert_array_compound(%s, %s, \"%s\", %s, %s, %d, %s_dims);",
|
|
|
|
indented(1),
|
|
|
|
groupncid(tsym->container),
|
|
|
|
typencid(tsym),
|
|
|
|
escapifyname(efield->name),
|
|
|
|
tmp,
|
|
|
|
typencid(efield->typ.basetype),
|
|
|
|
efield->typ.dimset.ndims,
|
|
|
|
cname(efield));
|
|
|
|
} else {
|
|
|
|
bbprintf0(stmt,"%sstat = nc_insert_compound(%s, %s, \"%s\", %s, %s);",
|
|
|
|
indented(1),
|
|
|
|
groupncid(tsym->container),
|
|
|
|
typencid(tsym),
|
|
|
|
escapifyname(efield->name),
|
|
|
|
tmp,
|
|
|
|
typencid(efield->typ.basetype));
|
|
|
|
}
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
}
|
|
|
|
codelined(1,"}");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NC_ARRAY:
|
|
|
|
/* ignore: this will be handled by def_var*/
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: panic("genc_deftype: unexpected type subclass: %d",tsym->subclass);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /*USE_NETCDF4*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
genc_defineattr(Symbol* asym)
|
|
|
|
{
|
2012-02-14 08:25:32 +08:00
|
|
|
/* we need to capture vlen strings for dumping */
|
|
|
|
Bytebuffer* save = bbNew(); /* capture so we can dump
|
|
|
|
vlens first */
|
|
|
|
List* oldstate = NULL;
|
|
|
|
generator_getstate(c_generator,(void*)&oldstate);
|
|
|
|
listfree(oldstate);
|
|
|
|
generator_reset(c_generator,(void*)listnew());
|
|
|
|
generate_attrdata(asym,c_generator,(Writer)genc_write,save);
|
|
|
|
bbFree(save);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
genc_definevardata(Symbol* vsym)
|
|
|
|
{
|
|
|
|
Bytebuffer* save; /* capture so we can dump vlens first */
|
|
|
|
List* oldstate = NULL;
|
|
|
|
if(vsym->data == NULL) return;
|
|
|
|
save = bbNew();
|
|
|
|
generator_getstate(c_generator,(void*)&oldstate);
|
|
|
|
listfree(oldstate);
|
|
|
|
generator_reset(c_generator,(void*)listnew());
|
|
|
|
generate_vardata(vsym,c_generator,(Writer)genc_write,save);
|
|
|
|
bbFree(save);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
genc_write(Generator* generator, Symbol* sym, Bytebuffer* code,
|
|
|
|
int rank, size_t* start, size_t* count)
|
|
|
|
{
|
|
|
|
if(sym->objectclass == NC_ATT)
|
|
|
|
genc_writeattr(generator,sym,code,rank,start,count);
|
|
|
|
else if(sym->objectclass == NC_VAR)
|
|
|
|
genc_writevar(generator,sym,code,rank,start,count);
|
|
|
|
else
|
|
|
|
PANIC("illegal symbol for genc_write");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
genc_writevar(Generator* generator, Symbol* vsym, Bytebuffer* code,
|
|
|
|
int rank, size_t* start, size_t* count)
|
|
|
|
{
|
|
|
|
Symbol* basetype = vsym->typ.basetype;
|
2010-06-03 21:24:43 +08:00
|
|
|
nc_type typecode = basetype->typ.typecode;
|
2012-02-14 08:25:32 +08:00
|
|
|
List* vlendecls;
|
|
|
|
|
|
|
|
/* define a block to avoid name clashes*/
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"{");
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
/* Dump any vlen decls first */
|
|
|
|
generator_getstate(generator,(void**)&vlendecls);
|
|
|
|
if(vlendecls != NULL && listlength(vlendecls) > 0) {
|
2023-12-01 01:29:43 +08:00
|
|
|
for(size_t i=0;i<listlength(vlendecls);i++) {
|
2012-02-14 08:25:32 +08:00
|
|
|
Bytebuffer* decl = (Bytebuffer*)listget(vlendecls,i);
|
|
|
|
codelined(1,bbContents(decl));
|
|
|
|
bbFree(decl);
|
|
|
|
}
|
|
|
|
listfree(vlendecls);
|
|
|
|
generator_reset(generator,NULL);
|
2015-11-12 06:36:02 +08:00
|
|
|
}
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
if(rank == 0) {
|
2013-07-11 04:00:48 +08:00
|
|
|
codelined(1,"size_t count = 0;");
|
2012-02-14 08:25:32 +08:00
|
|
|
/* We make the data be an array so we do not need to
|
|
|
|
ampersand it later => we need an outer pair of braces
|
|
|
|
*/
|
2013-07-11 04:00:48 +08:00
|
|
|
commify(code); /* insert commas at proper places */
|
|
|
|
bbprintf0(stmt,"%sstatic %s %s_data[1] = {%s};\n",
|
2012-02-14 08:25:32 +08:00
|
|
|
indented(1),
|
|
|
|
ctypename(basetype),
|
|
|
|
cname(vsym),
|
|
|
|
bbContents(code));
|
|
|
|
codedump(stmt);
|
2013-07-11 04:00:48 +08:00
|
|
|
bbprintf0(stmt,"%sstat = nc_put_var1(%s, %s, &count, %s_data);\n",
|
2012-02-14 08:25:32 +08:00
|
|
|
indented(1),
|
|
|
|
groupncid(vsym->container),
|
|
|
|
varncid(vsym),
|
|
|
|
cname(vsym));
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2012-02-14 08:25:32 +08:00
|
|
|
codeflush();
|
|
|
|
} else { /* rank > 0 */
|
|
|
|
int i;
|
|
|
|
size_t length = 0;
|
|
|
|
if(typecode == NC_CHAR) {
|
|
|
|
length = bbLength(code);
|
|
|
|
/* generate data constant */
|
|
|
|
bbprintf(stmt,"%schar* %s_data = ",
|
|
|
|
indented(1),
|
|
|
|
cname(vsym),
|
|
|
|
(unsigned long)length);
|
|
|
|
codedump(stmt);
|
|
|
|
cquotestring(code,'"');
|
|
|
|
codedump(code);
|
|
|
|
codeline(" ;");
|
|
|
|
} else {
|
2015-11-12 06:36:02 +08:00
|
|
|
/* Compute total size */
|
2012-02-14 08:25:32 +08:00
|
|
|
length = 1;
|
|
|
|
for(i=0;i<rank;i++) length *= count[i];
|
|
|
|
/* generate data constant */
|
|
|
|
commify(code); /* insert commas at proper places */
|
|
|
|
bbprintf(stmt,"%s%s %s_data[%lu] = ",
|
|
|
|
indented(1),
|
|
|
|
ctypename(basetype),
|
|
|
|
cname(vsym),
|
|
|
|
(unsigned long)length);
|
|
|
|
codedump(stmt);
|
|
|
|
/* C requires an outer set of braces on datalist constants */
|
|
|
|
codepartial("{");
|
|
|
|
codedump(code);
|
|
|
|
codeline("} ;");
|
|
|
|
}
|
2015-11-12 06:36:02 +08:00
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
/* generate constants for startset, countset*/
|
2015-11-12 06:36:02 +08:00
|
|
|
bbprintf0(stmt,"%ssize_t %s_startset[%u] = {",
|
2012-02-14 08:25:32 +08:00
|
|
|
indented(1),
|
|
|
|
cname(vsym),
|
|
|
|
rank);
|
|
|
|
for(i=0;i<rank;i++) {
|
|
|
|
bbprintf(stmt,"%s%lu",(i>0?", ":""),start[i]);
|
|
|
|
}
|
|
|
|
codedump(stmt);
|
|
|
|
codeline("} ;");
|
2015-11-12 06:36:02 +08:00
|
|
|
|
|
|
|
bbprintf0(stmt,"%ssize_t %s_countset[%u] = {",
|
2012-02-14 08:25:32 +08:00
|
|
|
indented(1),
|
|
|
|
cname(vsym),
|
|
|
|
rank);
|
|
|
|
for(i=0;i<rank;i++) {
|
|
|
|
bbprintf(stmt,"%s%lu",(i>0?", ":""),count[i]);
|
|
|
|
}
|
|
|
|
codedump(stmt);
|
|
|
|
codeline("};");
|
2015-11-12 06:36:02 +08:00
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
bbprintf0(stmt,"%sstat = nc_put_vara(%s, %s, %s_startset, %s_countset, %s_data);\n",
|
|
|
|
indented(1),
|
|
|
|
groupncid(vsym->container), varncid(vsym),
|
|
|
|
cname(vsym),
|
|
|
|
cname(vsym),
|
|
|
|
cname(vsym));
|
|
|
|
codedump(stmt);
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2015-11-12 06:36:02 +08:00
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
}
|
|
|
|
/* end defined block*/
|
|
|
|
codelined(1,"}\n");
|
|
|
|
codeflush();
|
|
|
|
}
|
2015-11-12 06:36:02 +08:00
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
static void
|
|
|
|
genc_writeattr(Generator* generator, Symbol* asym, Bytebuffer* code,
|
|
|
|
int rank, size_t* start, size_t* count)
|
|
|
|
{
|
|
|
|
Symbol* basetype = asym->typ.basetype;
|
|
|
|
int typecode = basetype->typ.typecode;
|
|
|
|
size_t len = asym->data->length; /* default assumption */
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2012-02-14 08:25:32 +08:00
|
|
|
/* define a block to avoid name clashes*/
|
|
|
|
codeline("");
|
|
|
|
codelined(1,"{");
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
/* Handle NC_CHAR specially */
|
|
|
|
if(typecode == NC_CHAR) {
|
2012-02-14 08:25:32 +08:00
|
|
|
len = bbLength(code); /* presumably before quoting */
|
2011-11-14 12:20:19 +08:00
|
|
|
/* Revise length if length == 0 */
|
|
|
|
if(len == 0) len++;
|
2012-02-14 08:25:32 +08:00
|
|
|
cquotestring(code,'"');
|
2010-06-03 21:24:43 +08:00
|
|
|
} else {
|
|
|
|
/* All other cases */
|
2013-07-11 04:00:48 +08:00
|
|
|
/* Dump any vlen decls first */
|
|
|
|
List* vlendecls;
|
|
|
|
generator_getstate(generator,(void**)&vlendecls);
|
|
|
|
if(vlendecls != NULL && listlength(vlendecls) > 0) {
|
2023-12-01 01:29:43 +08:00
|
|
|
for(size_t i=0;i<listlength(vlendecls);i++) {
|
2013-07-11 04:00:48 +08:00
|
|
|
Bytebuffer* decl = (Bytebuffer*)listget(vlendecls,i);
|
|
|
|
codelined(1,bbContents(decl));
|
|
|
|
bbFree(decl);
|
|
|
|
}
|
|
|
|
listfree(vlendecls);
|
|
|
|
generator_reset(generator,NULL);
|
2015-11-12 06:36:02 +08:00
|
|
|
}
|
2010-06-03 21:24:43 +08:00
|
|
|
commify(code);
|
2012-02-14 08:25:32 +08:00
|
|
|
bbprintf0(stmt,"%sstatic const %s %s_att[%ld] = ",
|
2013-07-11 04:00:48 +08:00
|
|
|
indented(1),
|
|
|
|
ctypename(basetype),
|
|
|
|
cname(asym),
|
|
|
|
asym->data->length
|
|
|
|
);
|
2010-06-03 21:24:43 +08:00
|
|
|
codedump(stmt);
|
|
|
|
codepartial("{");
|
|
|
|
codedump(code);
|
|
|
|
codepartial("}");
|
|
|
|
codeline(" ;");
|
|
|
|
bbClear(code);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Use the specialized put_att_XX routines if possible*/
|
|
|
|
switch (basetype->typ.typecode) {
|
|
|
|
case NC_BYTE:
|
|
|
|
case NC_SHORT:
|
|
|
|
case NC_INT:
|
|
|
|
case NC_FLOAT:
|
|
|
|
case NC_DOUBLE:
|
|
|
|
bbprintf0(stmt,"%sstat = nc_put_att_%s(%s, %s, \"%s\", %s, %lu, %s_att);\n",
|
|
|
|
indented(1),
|
|
|
|
ncstype(basetype->typ.typecode),
|
|
|
|
groupncid(asym->container),
|
|
|
|
(asym->att.var == NULL?"NC_GLOBAL"
|
|
|
|
:varncid(asym->att.var)),
|
|
|
|
escapifyname(asym->name),
|
2015-11-12 06:36:02 +08:00
|
|
|
typencid(basetype),
|
2010-06-03 21:24:43 +08:00
|
|
|
len,
|
|
|
|
cname(asym));
|
|
|
|
codedump(stmt);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NC_CHAR:
|
|
|
|
/* Include the string constant in-line */
|
|
|
|
bbprintf0(stmt,"%sstat = nc_put_att_%s(%s, %s, \"%s\", %lu, %s);\n",
|
|
|
|
indented(1),
|
|
|
|
ncstype(basetype->typ.typecode),
|
|
|
|
groupncid(asym->container),
|
|
|
|
(asym->att.var == NULL?"NC_GLOBAL"
|
|
|
|
:varncid(asym->att.var)),
|
|
|
|
escapifyname(asym->name),
|
|
|
|
len,
|
|
|
|
bbContents(code));
|
|
|
|
codedump(stmt);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* !usingclassic only (except NC_STRING) */
|
|
|
|
case NC_UBYTE:
|
|
|
|
case NC_USHORT:
|
|
|
|
case NC_UINT:
|
|
|
|
case NC_INT64:
|
|
|
|
case NC_UINT64:
|
2015-08-16 06:26:35 +08:00
|
|
|
if(usingclassic && k_flag <= 2) {
|
2010-06-03 21:24:43 +08:00
|
|
|
verror("Non-classic type: %s",nctypename(basetype->typ.typecode));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
bbprintf0(stmt,"%sstat = nc_put_att_%s(%s, %s, \"%s\", %s, %lu, %s_att);",
|
|
|
|
indented(1),
|
|
|
|
ncstype(basetype->typ.typecode),
|
|
|
|
groupncid(asym->container),
|
|
|
|
(asym->att.var == NULL?"NC_GLOBAL"
|
|
|
|
:varncid(asym->att.var)),
|
|
|
|
escapifyname(asym->name),
|
2015-11-12 06:36:02 +08:00
|
|
|
typencid(basetype),
|
2010-06-03 21:24:43 +08:00
|
|
|
len,
|
|
|
|
cname(asym));
|
|
|
|
codedump(stmt);
|
|
|
|
break;
|
|
|
|
|
2015-08-16 06:26:35 +08:00
|
|
|
#ifdef USE_NETCDF4
|
2010-06-03 21:24:43 +08:00
|
|
|
case NC_STRING:
|
|
|
|
if(usingclassic) {
|
|
|
|
verror("Non-classic type: %s",nctypename(basetype->typ.typecode));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
bbprintf0(stmt,"%sstat = nc_put_att_%s(%s, %s, \"%s\", %lu, %s_att);",
|
|
|
|
indented(1),
|
|
|
|
ncstype(basetype->typ.typecode),
|
|
|
|
groupncid(asym->container),
|
|
|
|
(asym->att.var == NULL?"NC_GLOBAL"
|
|
|
|
:varncid(asym->att.var)),
|
|
|
|
escapifyname(asym->name),
|
|
|
|
len,
|
|
|
|
cname(asym));
|
|
|
|
codedump(stmt);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default: /* User defined type */
|
|
|
|
#ifndef USE_NETCDF4
|
|
|
|
verror("Non-classic type: %s",nctypename(basetype->typ.typecode));
|
2015-08-16 06:26:35 +08:00
|
|
|
#else /* !USE_NETCDF4 */
|
2010-06-03 21:24:43 +08:00
|
|
|
if(usingclassic && !isclassicprim(basetype->typ.typecode)) {
|
|
|
|
verror("Non-classic type: %s",nctypename(basetype->typ.typecode));
|
|
|
|
}
|
2012-02-14 08:25:32 +08:00
|
|
|
bbprintf0(stmt,"%sstat = nc_put_att(%s, %s, \"%s\", %s, %lu, %s_att);\n",
|
2010-06-03 21:24:43 +08:00
|
|
|
indented(1),
|
|
|
|
groupncid(asym->container),
|
|
|
|
(asym->att.var == NULL?"NC_GLOBAL"
|
|
|
|
:varncid(asym->att.var)),
|
|
|
|
escapifyname(asym->name),
|
|
|
|
typencid(basetype),
|
|
|
|
len,
|
|
|
|
cname(asym));
|
|
|
|
codedump(stmt);
|
|
|
|
#endif
|
|
|
|
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
|
|
|
codelined(1,"CHECK_ERR(stat);");
|
2010-06-03 21:24:43 +08:00
|
|
|
codelined(1,"}");
|
|
|
|
}
|
2013-09-21 10:31:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* Compute the C name for a given symbol;
|
|
|
|
modified to use the fqn
|
|
|
|
*/
|
|
|
|
const char*
|
|
|
|
cname(Symbol* sym)
|
|
|
|
{
|
|
|
|
char* name;
|
|
|
|
|
|
|
|
assert (sym->fqn != NULL && sym->name != NULL);
|
|
|
|
/* Convert the fqn as its C name. */
|
|
|
|
if(sym->grp.is_root)
|
|
|
|
name = codify(sym->name);
|
|
|
|
else
|
2015-11-12 06:36:02 +08:00
|
|
|
name = codify(sym->fqn);
|
2013-09-21 10:31:21 +08:00
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
#endif /*ENABLE_C*/
|