netcdf-c/ncgen/Makefile.am

71 lines
2.5 KiB
Makefile
Raw Normal View History

2010-06-03 21:24:43 +08:00
## This is a automake file, part of Unidata's netCDF package.
2018-12-07 06:40:43 +08:00
# Copyright 2008, see the COPYRIGHT file for more information.
2010-06-03 21:24:43 +08:00
# This file builds and runs the ncgen program.
# Put together AM_CPPFLAGS and AM_LDFLAGS.
include $(top_srcdir)/lib_flags.am
2011-05-12 03:51:11 +08:00
LDADD = ${top_builddir}/liblib/libnetcdf.la
2010-06-03 21:24:43 +08:00
# Build ncgen from the listed sources.
bin_PROGRAMS = ncgen
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
ncgen_SOURCES = bindata.c bytebuffer.c cdata.c cvt.c data.c \
debug.c dump.c escapes.c f77data.c genbin.c \
genc.c genchar.c generate.c generr.c genf77.c \
genj.c genlib.c getfill.c jdata.c list.c \
main.c ncgeny.c semantics.c \
util.c bytebuffer.h data.h debug.h dump.h \
generate.h generr.h genlib.h includes.h list.h \
ncgen.h ncgeny.h util.h
# Obsolete
OBSOLETE = odom.c odom.h jdatastd.c jdatajni.c genjni.c cdfdata.c cmldata.c
2010-06-03 21:24:43 +08:00
# This is the man page.
man_MANS = ncgen.1
# These files all need to be distributed.
2015-11-20 04:44:07 +08:00
EXTRA_DIST = ncgen.y ncgen.l ncgenl.c $(man_MANS) internals.html \
c0.cdl c0_4.cdl ref_camrun.cdl \
ncf199.cdl CMakeLists.txt c5.cdl \
compound_datasize_test.cdl compound_datasize_test2.cdl \
tst_gattenum.cdl tst_usuffix.cdl
2010-06-03 21:24:43 +08:00
# This shell script causes ncgen to build a classic and a 64-bit
# offset file from a cdl file shipped with the distribution.
#if !BUILD_DLL
2017-05-25 04:33:55 +08:00
##
# Moved to ncdump as these tests rely on ncdump having been built.
##
#TESTS = run_tests.sh
#if USE_HDF5
2017-05-25 04:33:55 +08:00
#TESTS += run_nc4_tests.sh
#endif # USE_HDF5
#endif # !BUILD_DLL
2010-06-03 21:24:43 +08:00
2012-11-01 04:07:11 +08:00
CLEANFILES = c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c \
ncf199.nc c5.nc compound_datasize_test.nc compound_datasize_test2.nc \
2016-11-19 05:09:01 +08:00
tst_compound_datasize_test.cdl tst_compound_datasize_test2.cdl tst_ncf199.cdl \
2017-03-21 03:50:44 +08:00
tst_tst_gattenum.cdl tst_gattenum.nc \
tst_tst_usuffix.cdl tst_usuffix.nc \
2016-11-19 05:09:01 +08:00
tst_c0.cdl tst_c0_4.cdl tst_c0_4c.cdl tst_c0_64.cdl
2010-06-03 21:24:43 +08:00
2015-11-20 04:44:07 +08:00
# These rules are used if someone wants to rebuild ncgenl.c or ncgeny.c
2010-06-03 21:24:43 +08:00
# Otherwise never invoked, but records how to do it.
# BTW: note that renaming is essential because otherwise
# autoconf will forcibly delete files of the name *.tab.*
# Note also that this should be built under linux or cygwin
# using bison version 3 or later.
2017-08-13 05:50:31 +08:00
# Note also that this code is in a shell script if you do
# not want to other to ./configure.
2010-08-26 03:01:07 +08:00
makeparser::
rm -f ncgenl.c lex.ncg.c
Add support for Zarr string type to NCZarr * re: https://github.com/Unidata/netcdf-c/pull/2278 * re: https://github.com/Unidata/netcdf-c/issues/2485 * re: https://github.com/Unidata/netcdf-c/issues/2474 This PR subsumes PR https://github.com/Unidata/netcdf-c/pull/2278. Actually is a bit an omnibus covering several issues. ## PR https://github.com/Unidata/netcdf-c/pull/2278 Add support for the Zarr string type. Zarr strings are restricted currently to be of fixed size. The primary issue to be addressed is to provide a way for user to specify the size of the fixed length strings. This is handled by providing the following new attributes special: 1. **_nczarr_default_maxstrlen** — This is an attribute of the root group. It specifies the default maximum string length for string types. If not specified, then it has the value of 64 characters. 2. **_nczarr_maxstrlen** — This is a per-variable attribute. It specifies the maximum string length for the string type associated with the variable. If not specified, then it is assigned the value of **_nczarr_default_maxstrlen**. This PR also requires some hacking to handle the existing netcdf-c NC_CHAR type, which does not exist in zarr. The goal was to choose numpy types for both the netcdf-c NC_STRING type and the netcdf-c NC_CHAR type such that if a pure zarr implementation read them, it would still work and an NC_CHAR type would be handled by zarr as a string of length 1. For writing variables and NCZarr attributes, the type mapping is as follows: * "|S1" for NC_CHAR. * ">S1" for NC_STRING && MAXSTRLEN==1 * ">Sn" for NC_STRING && MAXSTRLEN==n Note that it is a bit of a hack to use endianness, but it should be ok since for string/char, the endianness has no meaning. For reading attributes with pure zarr (i.e. with no nczarr atribute types defined), they will always be interpreted as of type NC_CHAR. ## Issue: https://github.com/Unidata/netcdf-c/issues/2474 This PR partly fixes this issue because it provided more comprehensive support for Zarr attributes that are JSON valued expressions. This PR still does not address the problem in that issue where the _ARRAY_DIMENSION attribute is incorrectly set. Than can only be fixed by the creator of the datasets. ## Issue: https://github.com/Unidata/netcdf-c/issues/2485 This PR also fixes the scalar failure shown in this issue. It generally cleans up scalar handling. It also adds a note to the documentation describing that NCZarr supports scalars while Zarr does not and also how scalar interoperability is achieved. ## Misc. Other Changes 1. Convert the nczarr special attributes and keys to be all lower case. So "_NCZARR_ATTR" now used "_nczarr_attr. Support back compatibility for the upper case names. 2. Cleanup my too-clever-by-half handling of scalars in libnczarr.
2022-08-28 10:21:13 +08:00
flex -Pncg -8 ncgen.l
2015-11-20 04:44:07 +08:00
sed -e s/lex.ncg.c/ncgenl.c/g <lex.ncg.c >ncgenl.c
bison -pncg -t -d ncgen.y
rm -f ncgeny.c ncgeny.h
2015-11-20 04:44:07 +08:00
sed -e s/ncgen.tab.c/ncgeny.c/g -e s/ncgen.tab.h/ncgeny.h/g <ncgen.tab.c >ncgeny.c
sed -e s/ncgen.tab.c/ncgeny.c/g -e s/ncgen.tab.h/ncgeny.h/g <ncgen.tab.h >ncgeny.h
rm -f lex.ncg.c ncgen.tab.h ncgen.tab.c