diff --git a/ChangeLog b/ChangeLog index 87698934265622e82f58d55d31e80af0d6aa485c..23fe4d40bdf272713024ef5d287b7dbeca48cb77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ * using CGRIBEX library version 1.7.6 * Version 1.8.0 released +2017-01-19 Uwe Schulzweida + + * Version 1.8.0rc6 released + 2016-12-20 Uwe Schulzweida * Added support for GRIB level type 210 diff --git a/configure b/configure index 0b8a769ba3d2c1231ed029a4a84b7cb710983f17..2aa8ebb65e25567e28a39afd0ce57f7aa4c70556 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for cdi 1.8.0rc6. +# Generated by GNU Autoconf 2.68 for cdi 1.8.0rc7. # # Report bugs to <http://mpimet.mpg.de/cdi>. # @@ -570,8 +570,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cdi' PACKAGE_TARNAME='cdi' -PACKAGE_VERSION='1.8.0rc6' -PACKAGE_STRING='cdi 1.8.0rc6' +PACKAGE_VERSION='1.8.0rc7' +PACKAGE_STRING='cdi 1.8.0rc7' PACKAGE_BUGREPORT='http://mpimet.mpg.de/cdi' PACKAGE_URL='' @@ -1460,7 +1460,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures cdi 1.8.0rc6 to adapt to many kinds of systems. +\`configure' configures cdi 1.8.0rc7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1530,7 +1530,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of cdi 1.8.0rc6:";; + short | recursive ) echo "Configuration of cdi 1.8.0rc7:";; esac cat <<\_ACEOF @@ -1723,7 +1723,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -cdi configure 1.8.0rc6 +cdi configure 1.8.0rc7 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2568,7 +2568,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by cdi $as_me 1.8.0rc6, which was +It was created by cdi $as_me 1.8.0rc7, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -3520,7 +3520,7 @@ fi # Define the identity of the package. PACKAGE='cdi' - VERSION='1.8.0rc6' + VERSION='1.8.0rc7' cat >>confdefs.h <<_ACEOF @@ -23389,7 +23389,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -cdi config.lt 1.8.0rc6 +cdi config.lt 1.8.0rc7 configured by $0, generated by GNU Autoconf 2.68. Copyright (C) 2011 Free Software Foundation, Inc. @@ -30534,7 +30534,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by cdi $as_me 1.8.0rc6, which was +This file was extended by cdi $as_me 1.8.0rc7, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -30600,7 +30600,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -cdi config.status 1.8.0rc6 +cdi config.status 1.8.0rc7 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index b20816481758044b7431a22476cc8a488016636d..100dbbba5fc6da9c650d4895cc63e501f746e124 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ # autoconf 2.68 # libtool 2.4.2 -AC_INIT([cdi], [1.8.0rc6], [http://mpimet.mpg.de/cdi]) +AC_INIT([cdi], [1.8.0rc7], [http://mpimet.mpg.de/cdi]) AC_DEFINE_UNQUOTED(CDI, ["$PACKAGE_VERSION"], [CDI version]) diff --git a/examples/cdi_write_refvgrid.c b/examples/cdi_write_refvgrid.c index cfd0dc7098941f789d8c06987e34bcad6636d516..acdcfa44dea8a1f18ae654c1d967d1ed22fcbfd3 100644 --- a/examples/cdi_write_refvgrid.c +++ b/examples/cdi_write_refvgrid.c @@ -27,6 +27,7 @@ int main(void) zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1); // Create a general vertical height Z-axis + // zaxisID2 = zaxisCreate(ZAXIS_HEIGHT, nlev); zaxisID2 = zaxisCreate(ZAXIS_REFERENCE, nlev); zaxisDefLevels(zaxisID2, levs); zaxisDefNlevRef(zaxisID2, nlev); diff --git a/src/Makefile.in b/src/Makefile.in index 234a5d46f45d3ac46d56f25594a163057b0e4ff5..be115a80ebafb926b136c7920686d5963e4ee8e5 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -941,8 +941,8 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -@ENABLE_CDI_LIB_FALSE@install-exec-local: @ENABLE_CDI_LIB_FALSE@uninstall-local: +@ENABLE_CDI_LIB_FALSE@install-exec-local: clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ diff --git a/src/cdf_int.c b/src/cdf_int.c index e9d1fbbd4ac904199ac726aa2384257f189f8bd9..65f83e865d847802a783d5542c132f78f23438b5 100644 --- a/src/cdf_int.c +++ b/src/cdf_int.c @@ -690,6 +690,19 @@ void cdf_get_att_int(int ncid, int varid, const char *name, int *ip) } +void cdf_get_att_long(int ncid, int varid, const char *name, long *ip) +{ +#if defined (HAVE_NETCDF4) + int status = nc_get_att_long(ncid, varid, name, ip); + + if ( CDF_Debug || status != NC_NOERR ) + Message("ncid = %d varid = %d att = %s val = %ld", ncid, varid, name, *ip); + + if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); +#endif +} + + void cdf_get_att_double(int ncid, int varid, const char *name, double *dp) { int status; diff --git a/src/cdf_int.h b/src/cdf_int.h index 223091eb27f86bdf97fd5a91bde5efc6cfcdc84f..91de788839a602f394a646214c11729857d63304 100644 --- a/src/cdf_int.h +++ b/src/cdf_int.h @@ -76,6 +76,7 @@ void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, si void cdf_get_att_string(int ncid, int varid, const char *name, char **tp); void cdf_get_att_text (int ncid, int varid, const char *name, char *tp); void cdf_get_att_int (int ncid, int varid, const char *name, int *ip); +void cdf_get_att_long (int ncid, int varid, const char *name, long *ip); void cdf_get_att_double(int ncid, int varid, const char *name, double *dp); void cdf_inq_att (int ncid, int varid, const char *name, nc_type * xtypep, size_t * lenp); diff --git a/src/stream_cdf_i.c b/src/stream_cdf_i.c index bfb44cdf0889f059ccc4e28f67fccb9a719eabc3..5df70a4494c4fe07730358b8310fc45bfeb9f7b8 100644 --- a/src/stream_cdf_i.c +++ b/src/stream_cdf_i.c @@ -7,6 +7,7 @@ //#define TEST_GROUPS 1 #include <ctype.h> +#include <limits.h> #include "dmemory.h" #include "gaussgrid.h" @@ -873,7 +874,6 @@ void cdf_set_cdi_attr(int ncid, int ncvarid, int attnum, int cdiID, int varID) cdf_inq_attname(ncid, ncvarid, attnum, attname); cdf_inq_attlen(ncid, ncvarid, attname, &attlen); cdf_inq_atttype(ncid, ncvarid, attname, &atttype); - if ( xtypeIsInt(atttype) ) { int attint[attlen]; diff --git a/src/stream_cdf_o.c b/src/stream_cdf_o.c index 2b8a0908bb1b189991d40d02840695f005f410ff..c86a9a289f1591ec1cafabead15893ccdbfdef9f 100644 --- a/src/stream_cdf_o.c +++ b/src/stream_cdf_o.c @@ -1337,46 +1337,60 @@ void cdf_def_vct_echam(stream_t *streamptr, int zaxisID) if ( streamptr->ncmode == 2 ) cdf_redef(fileID); - int ncdimid, ncdimid2; - cdf_def_dim(fileID, "nhym", (size_t)mlev, &ncdimid); + int ncdimid, ncdimid2 = -1; + int hyaiid, hybiid, hyamid = -1, hybmid = -1; + cdf_def_dim(fileID, "nhyi", (size_t)ilev, &ncdimid2); + cdf_def_var(fileID, "hyai", NC_DOUBLE, 1, &ncdimid2, &hyaiid); + cdf_def_var(fileID, "hybi", NC_DOUBLE, 1, &ncdimid2, &hybiid); + if ( mlev > 0 ) + { + cdf_def_dim(fileID, "nhym", (size_t)mlev, &ncdimid); + cdf_def_var(fileID, "hyam", NC_DOUBLE, 1, &ncdimid, &hyamid); + cdf_def_var(fileID, "hybm", NC_DOUBLE, 1, &ncdimid, &hybmid); + } - streamptr->vct.mlev = mlev; streamptr->vct.ilev = ilev; + streamptr->vct.mlev = mlev; streamptr->vct.mlevID = ncdimid; streamptr->vct.ilevID = ncdimid2; - int hyaiid, hybiid, hyamid, hybmid; - cdf_def_var(fileID, "hyai", NC_DOUBLE, 1, &ncdimid2, &hyaiid); - cdf_def_var(fileID, "hybi", NC_DOUBLE, 1, &ncdimid2, &hybiid); - cdf_def_var(fileID, "hyam", NC_DOUBLE, 1, &ncdimid, &hyamid); - cdf_def_var(fileID, "hybm", NC_DOUBLE, 1, &ncdimid, &hybmid); - { static const char lname_n[] = "long_name", - lname_v_ai[] = "hybrid A coefficient at layer interfaces", units_n[] = "units", + lname_v_ai[] = "hybrid A coefficient at layer interfaces", units_v_ai[] = "Pa", lname_v_bi[] = "hybrid B coefficient at layer interfaces", - units_v_bi[] = "1", - lname_v_am[] = "hybrid A coefficient at layer midpoints", - units_v_am[] = "Pa", - lname_v_bm[] = "hybrid B coefficient at layer midpoints", - units_v_bm[] = "1"; + units_v_bi[] = "1"; static const struct attTxtTab2 tab[] = { { lname_n, lname_v_ai, sizeof (lname_v_ai) - 1 }, { units_n, units_v_ai, sizeof (units_v_ai) - 1 }, { lname_n, lname_v_bi, sizeof (lname_v_bi) - 1 }, { units_n, units_v_bi, sizeof (units_v_bi) - 1 }, + }; + enum { tabLen = sizeof (tab) / sizeof (tab[0]) }; + int ids[tabLen] = { hyaiid, hyaiid, hybiid, hybiid }; + for ( size_t i = 0; i < tabLen; ++i ) + cdf_put_att_text(fileID, ids[i], tab[i].attName, tab[i].valLen, tab[i].attVal); + } + + { + static const char lname_n[] = "long_name", + units_n[] = "units", + lname_v_am[] = "hybrid A coefficient at layer midpoints", + units_v_am[] = "Pa", + lname_v_bm[] = "hybrid B coefficient at layer midpoints", + units_v_bm[] = "1"; + static const struct attTxtTab2 tab[] + = { { lname_n, lname_v_am, sizeof (lname_v_am) - 1 }, { units_n, units_v_am, sizeof (units_v_am) - 1 }, { lname_n, lname_v_bm, sizeof (lname_v_bm) - 1 }, { units_n, units_v_bm, sizeof (units_v_bm) - 1 }, }; enum { tabLen = sizeof (tab) / sizeof (tab[0]) }; - int ids[tabLen] = { hyaiid, hyaiid, hybiid, hybiid, - hyamid, hyamid, hybmid, hybmid }; + int ids[tabLen] = { hyamid, hyamid, hybmid, hybmid }; for ( size_t i = 0; i < tabLen; ++i ) cdf_put_att_text(fileID, ids[i], tab[i].attName, tab[i].valLen, tab[i].attVal); } @@ -1691,7 +1705,7 @@ void cdf_def_zaxis_hybrid_cf(stream_t *streamptr, int type, int *ncvaridp, int z //if ( zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL) ) { size_t nvertex = 2; - if ( nc_inq_dimid(fileID, bndsName, &nvdimID) != NC_NOERR ) + if ( dimlen > 1 && nc_inq_dimid(fileID, bndsName, &nvdimID) != NC_NOERR ) cdf_def_dim(fileID, bndsName, nvertex, &nvdimID); if ( nvdimID != CDI_UNDEFID ) diff --git a/src/stream_ieg.c b/src/stream_ieg.c index df6a6df9a4da1aeb360315ff21b69380afca6dd3..ea209bed0e2a90b36aaff0ac7620fa94fe5473eb 100644 --- a/src/stream_ieg.c +++ b/src/stream_ieg.c @@ -1121,7 +1121,7 @@ long iegScanTimestep(stream_t *streamptr) if ( streamptr->ntsteps != streamptr->rtsteps ) { - int tsID = tstepsNewEntry(streamptr); + tsID = tstepsNewEntry(streamptr); if ( tsID != streamptr->rtsteps ) Error("Internal error. tsID = %d", tsID); diff --git a/src/vlist.c b/src/vlist.c index 1cb7fd66edbbb547c8af82bdddd0df50df7edda1..eddd332cb3e08c85f470dea8fa38b68c2099bd7e 100644 --- a/src/vlist.c +++ b/src/vlist.c @@ -650,6 +650,8 @@ void vlistCopyFlag(int vlistID2, int vlistID1) zaxisInqUnits(zaxisID, ctemp); zaxisDefUnits(zaxisID2, ctemp); + if ( zaxisType == ZAXIS_GENERIC ) zaxisDefLtype(zaxisID2, zaxisInqLtype(zaxisID)); + zaxisID = zaxisID2; vars2[varID2].zaxisID = zaxisID2; } diff --git a/src/zaxis.c b/src/zaxis.c index f116c0967d3a9c89454136732dc75804242f4fd2..114f6d4d32beaf3cfdc2bb7c447483336fbb29be 100644 --- a/src/zaxis.c +++ b/src/zaxis.c @@ -645,12 +645,8 @@ void zaxisInqUnits(int zaxisID, char *units) void zaxisInqStdname(int zaxisID, char *stdname) { - if ( stdname ) - { - stdname[0] = 0; - zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); - if ( zaxisptr->stdname ) strcpy(stdname, zaxisptr->stdname); - } + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + strcpy(stdname, zaxisptr->stdname); }