Commit c0fb11ce authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cdfInqContents: support of lon/lat units radian

parent 5859c14e
2008-04-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* using GRIB library version 1.1.1
* configure: --with-szlib=<directory>
* cdfInqContents: support of lon/lat units radian
* cdfInqContents: bug fix for gridtype cell
* cdfInqContents: bug fix for inconsistent curvilinear grid [report: Holger Goettel]
* cdfInqContents: bug fix for unsupported grids (dims > 2) [report: Wolfgang Langhans]
......
......@@ -121,6 +121,7 @@ RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SZLIBDIR = @SZLIBDIR@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
......
......@@ -12,6 +12,6 @@ createtable_SOURCES = createtable.c
#
createtable_LDADD = ../src/libcdi.a $(LDFLAGS) -lm
#
CPPFLAGS = -I$(top_srcdir)/src
AM_CPPFLAGS = -I$(top_srcdir)/src
#
CLEANFILES = `ls *~`
......@@ -79,8 +79,7 @@ CCDEPMODE = @CCDEPMODE@
CFINT = @CFINT@
CFLAGS = @CFLAGS@
CPP = @CPP@
#
CPPFLAGS = -I$(top_srcdir)/src
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
......@@ -116,6 +115,7 @@ RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SZLIBDIR = @SZLIBDIR@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
......@@ -180,6 +180,8 @@ createtable_SOURCES = createtable.c
#
createtable_LDADD = ../src/libcdi.a $(LDFLAGS) -lm
#
AM_CPPFLAGS = -I$(top_srcdir)/src
#
CLEANFILES = `ls *~`
all: all-am
......
......@@ -309,13 +309,18 @@ static void printGridInfo(int vlistID)
nd = gridInqGMEnd(gridID);
fprintf(stdout, "size : dim = %d nd = %d ni = %d\n", gridsize, nd, ni);
}
else if ( gridtype == GRID_CURVILINEAR )
else if ( gridtype == GRID_CURVILINEAR || gridtype == GRID_CELL )
{
fprintf(stdout, "size : dim = %d nx = %d ny = %d\n", gridsize, xsize, ysize);
if ( gridtype == GRID_CURVILINEAR )
fprintf(stdout, "size : dim = %d nx = %d ny = %d\n", gridsize, xsize, ysize);
else
fprintf(stdout, "size : dim = %d nvertex = %d\n", gridsize, gridInqNvertex(gridID));
if ( gridInqXvals(gridID, NULL) && gridInqYvals(gridID, NULL) )
{
int i;
char xunits[256];
char yunits[256];
double *xvals, *yvals;
double xfirst, xlast, yfirst, ylast;
xvals = (double *) malloc(gridsize*sizeof(double));
......@@ -323,6 +328,8 @@ static void printGridInfo(int vlistID)
gridInqXvals(gridID, xvals);
gridInqYvals(gridID, yvals);
gridInqXunits(gridID, xunits);
gridInqYunits(gridID, yunits);
xfirst = xvals[0];
xlast = xvals[0];
......@@ -337,21 +344,17 @@ static void printGridInfo(int vlistID)
}
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "longitude : first = %.9g last = %.9g", xfirst, xlast);
fprintf(stdout, "longitude : min = %.9g max = %.9g %s", xfirst, xlast, xunits);
if ( gridIsCircular(gridID) )
fprintf(stdout, " circular");
fprintf(stdout, "\n");
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "latitude : first = %.9g last = %.9g\n", yfirst, ylast);
fprintf(stdout, "latitude : min = %.9g max = %.9g %s\n", yfirst, ylast, yunits);
free(xvals);
free(yvals);
}
}
else if ( gridtype == GRID_CELL )
{
fprintf(stdout, "size : dim = %d nvertex = %d\n", gridsize, gridInqNvertex(gridID));
}
else if ( gridtype == GRID_LAMBERT )
{
double originLon, originLat, lonParY, lat1, lat2, xincm, yincm;
......
......@@ -15,33 +15,34 @@ case "${HOSTNAME}" in
ds*)
./configure --prefix=$HOME/local \
--with-netcdf=/pool/ia64/netcdf/netcdf-3.6.0-p1 \
CPPFLAGS="-DHAVE_LIBSZ -I$HOME/local/include" LIBS=$HOME/local/lib/libsz.a \
--with-szlib=$HOME/local \
CC=icc CFLAGS="-g -O2 -Wall -fno-alias -DMIN_BUF_SIZE=4194304" CFINT=-Df2cFortran
;;
# i686-suse-linux
linux | laptop)
./configure --prefix=$HOME/local \
--with-netcdf=$HOME/local \
CPPFLAGS="-DHAVE_LIBSZ -I$HOME/local/include" LIBS=$HOME/local/lib/libsz.a \
--with-szlib=$HOME/local \
CC=g++ CFLAGS="-g -O2 -Wall -W -Wfloat-equal" CFINT=-Df2cFortran
;;
gata)
./configure --prefix=$HOME/local/etch-ia32 \
--with-netcdf=/client \
CPPFLAGS="-DHAVE_LIBSZ -I$HOME/local/etch-ia32/include" LIBS=$HOME/local/etch-ia32/lib/libsz.a \
--with-szlib=$HOME/local/etch-ia32 \
CC=gcc CFLAGS="-g -O2 -Wall -W -Wfloat-equal" CFINT=-Df2cFortran
;;
# sparc-sun-solaris2.8
xxf)
./configure --prefix=$HOME/local/SUN \
--with-netcdf=/client \
CPPFLAGS="-DHAVE_LIBSZ -I$HOME/local/SUN/include" LIBS=$HOME/local/SUN/lib/libsz.a \
--with-szlib=$HOME/local/solaris10 \
CC=cc CFLAGS="-fast"
;;
# sparc-sun-solaris2.9
executor | yang | yin)
./configure --prefix=$HOME/local/SUN64 \
--with-netcdf=/scratch/small/m214/m214089/local/SunOS64 \
--with-szlib=$HOME/local/solaris10 \
CC=cc CFLAGS="-g -mt -fast -xtarget=native -m64"
;;
# sx6-nec-superux12.2
......
......@@ -710,6 +710,7 @@ RANLIB
CPP
GREP
EGREP
SZLIBDIR
FC
LIBOBJS
LTLIBOBJS'
......@@ -1320,7 +1321,12 @@ Optional Packages:
--with-service Use the internal SERVICE library [default=yes]
--with-extra Use the internal EXTRA library [default=yes]
--with-ieg Use the internal IEG library [default=yes]
--with-netcdf=DIR Use the netCDF library [default=no]
--with-netcdf=<directory>
Specify location of netCDF library. Configure will
expect to find subdirs include and lib.
--with-szlib=<directory>
Specify location of SZLIB library. Configure will
expect to find subdirs include and lib.
Some influential environment variables:
CFINT C/Fortran interface preprocessor flag, e.g. -Df2cFortran
......@@ -2386,7 +2392,7 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
# Checks for programs.
# Checks for programs.
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
......@@ -3956,7 +3962,7 @@ done
test -n "$AR" || AR="ar"
# Check large file support on 32 bit systems
# Check large file support on 32 bit systems
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then
......@@ -4309,7 +4315,7 @@ rm -f conftest*
fi
# Checks for library functions.
# Checks for library functions.
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
......@@ -5373,7 +5379,7 @@ fi
rm -f conftest.mmap
# Checks for library malloc.
# Checks for library malloc.
{ echo "$as_me:$LINENO: checking for mallinfo in -lmalloc" >&5
echo $ECHO_N "checking for mallinfo in -lmalloc... $ECHO_C" >&6; }
......@@ -6176,7 +6182,98 @@ echo "$as_me: error: couldn't find netCDF library" >&2;}
;;
esac
# Check C / Fortran interface
# ----------------------------------------------------------------------
# Compile interface with SZLIB library
#
{ echo "$as_me:$LINENO: checking whether a location for the SZLIB library was specified" >&5
echo $ECHO_N "checking whether a location for the SZLIB library was specified... $ECHO_C" >&6; }
# Check whether --with-szlib was given.
if test "${with_szlib+set}" = set; then
withval=$with_szlib; SZLIBDIR=$with_szlib
fi
{ echo "$as_me:$LINENO: result: $SZLIBDIR" >&5
echo "${ECHO_T}$SZLIBDIR" >&6; }
LDFLAGS="$LDFLAGS -L$SZLIBDIR/lib"
CPPFLAGS="$CPPFLAGS -I$SZLIBDIR/include"
{ echo "$as_me:$LINENO: checking for SZ_BufftoBuffCompress in -lsz" >&5
echo $ECHO_N "checking for SZ_BufftoBuffCompress in -lsz... $ECHO_C" >&6; }
if test "${ac_cv_lib_sz_SZ_BufftoBuffCompress+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsz $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char SZ_BufftoBuffCompress ();
int
main ()
{
return SZ_BufftoBuffCompress ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_lib_sz_SZ_BufftoBuffCompress=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_sz_SZ_BufftoBuffCompress=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5
echo "${ECHO_T}$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; }
if test $ac_cv_lib_sz_SZ_BufftoBuffCompress = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSZ 1
_ACEOF
LIBS="-lsz $LIBS"
else
LDFLAGS="$LDFLAGS"
fi
SZLIBDIR=$SZLIBDIR
# Check C / Fortran interface
{ echo "$as_me:$LINENO: checking whether the C / Fortran interface works" >&5
echo $ECHO_N "checking whether the C / Fortran interface works... $ECHO_C" >&6; }
......@@ -6951,7 +7048,7 @@ RANLIB!$RANLIB$ac_delim
CPP!$CPP$ac_delim
GREP!$GREP$ac_delim
EGREP!$EGREP$ac_delim
FC!$FC$ac_delim
SZLIBDIR!$SZLIBDIR$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
......@@ -6993,11 +7090,12 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
FC!$FC$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 2; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 3; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
......
# Process this file with autoconf to produce a configure script.
# Process this file with autoconf to produce a configure script.
AC_INIT(cdi, 1.1.1, Uwe.Schulzweida@zmaw.de)
......@@ -13,20 +13,20 @@ AC_CANONICAL_TARGET
AM_CONFIG_HEADER(src/config.h)
AM_INIT_AUTOMAKE
# Checks for programs.
# Checks for programs.
AC_PROG_CC
AC_PROG_F77
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_CHECK_PROGS(AR, ar, [ar])
# Check large file support on 32 bit systems
# Check large file support on 32 bit systems
AC_SYS_LARGEFILE
# Checks for library functions.
# Checks for library functions.
AC_FUNC_MMAP
# Checks for library malloc.
# Checks for library malloc.
AC_CHECK_LIB(malloc, mallinfo)
# ----------------------------------------------------------------------
......@@ -112,8 +112,8 @@ fi
# If the library path is specified then it must be preceded by a comma.
#
AC_ARG_WITH([netcdf],
[AC_HELP_STRING([--with-netcdf=DIR],
[Use the netCDF library [default=no]])],,
[AC_HELP_STRING([--with-netcdf=<directory>],
[Specify location of netCDF library. Configure will expect to find subdirs include and lib.])],,
withval=no)
case $withval in
......@@ -194,7 +194,21 @@ fi
;;
esac
# Check C / Fortran interface
# ----------------------------------------------------------------------
# Compile interface with SZLIB library
#
AC_MSG_CHECKING([whether a location for the SZLIB library was specified])
AC_ARG_WITH([szlib],
[AS_HELP_STRING([--with-szlib=<directory>],
[Specify location of SZLIB library. Configure will expect to find subdirs include and lib.])],
[SZLIBDIR=$with_szlib])
AC_MSG_RESULT([$SZLIBDIR])
LDFLAGS="$LDFLAGS -L$SZLIBDIR/lib"
CPPFLAGS="$CPPFLAGS -I$SZLIBDIR/include"
AC_CHECK_LIB(sz, SZ_BufftoBuffCompress,, LDFLAGS="$LDFLAGS")
AC_SUBST([SZLIBDIR], [$SZLIBDIR])
# Check C / Fortran interface
UD_CHECK_CFINT([$srcdir/src/cfortran.h])
AC_SUBST([CPPFLAGS])
......
......@@ -11,6 +11,6 @@ cdi_read_LDADD = ../src/libcdi.a $(LDFLAGS) -lm
cdi_copy_SOURCES = cdi_copy.c
cdi_copy_LDADD = ../src/libcdi.a $(LDFLAGS) -lm
#
CPPFLAGS = -I$(top_srcdir)/src
AM_CPPFLAGS = -I$(top_srcdir)/src
#
CLEANFILES = `ls *~`
......@@ -81,8 +81,7 @@ CCDEPMODE = @CCDEPMODE@
CFINT = @CFINT@
CFLAGS = @CFLAGS@
CPP = @CPP@
#
CPPFLAGS = -I$(top_srcdir)/src
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
......@@ -118,6 +117,7 @@ RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SZLIBDIR = @SZLIBDIR@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
......@@ -183,6 +183,8 @@ cdi_read_LDADD = ../src/libcdi.a $(LDFLAGS) -lm
cdi_copy_SOURCES = cdi_copy.c
cdi_copy_LDADD = ../src/libcdi.a $(LDFLAGS) -lm
#
AM_CPPFLAGS = -I$(top_srcdir)/src
#
CLEANFILES = `ls *~`
all: all-am
......
......@@ -135,6 +135,7 @@ RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SZLIBDIR = @SZLIBDIR@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
......
......@@ -30,6 +30,9 @@
/* Define to 1 for SERVICE interface */
#undef HAVE_LIBSERVICE
/* Define to 1 if you have the `sz' library (-lsz). */
#undef HAVE_LIBSZ
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
......
/* Generated automatically from m214003 on Mon Mar 10 12:43:34 CET 2008 */
/* Generated automatically from m214003 on Mon Mar 17 11:13:55 CET 2008 */
/* GRIBLIB_VERSION="1.1.1" */
......@@ -7546,6 +7546,10 @@ void gribPrintBDS(int nrec, long recpos, long recsize, unsigned char *gribbuffer
BDS_Len, BDS_Flag, scale, refval, BDS_NumBits, cr);
}
#if defined (HAVE_CONFIG_H)
# include "config.h"
#endif
/* #define SZTEST */
#if defined (HAVE_LIBSZ)
......@@ -8150,7 +8154,7 @@ int gribZip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufs
#else
if ( libszwarn )
{
Warning(func, "Decompression disabled, szlib not available!");
Warning(func, "Compression disabled, szlib not available!");
libszwarn = 0;
}
#endif
......@@ -8325,14 +8329,14 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
#else
if ( libszwarn )
{
Warning(func, "Compression disabled, szlib not available!");
Warning(func, "Decompression disabled, szlib not available!");
libszwarn = 0;
}
#endif
return (gribLen);
}
static const char grb_libvers[] = "1.1.1" " of ""Mar 10 2008"" ""12:43:34";
static const char grb_libvers[] = "1.1.1" " of ""Mar 17 2008"" ""11:13:55";
const char *
gribLibraryVersion(void)
{
......
......@@ -2976,7 +2976,7 @@ void gridPrint(int gridID, int opt)
if ( gridptr->yname[0] ) fprintf(fp, "yname : %s\n", gridptr->yname);
if ( gridptr->ylongname[0] ) fprintf(fp, "ylongname : %s\n", gridptr->ylongname);
if ( gridptr->yunits[0] ) fprintf(fp, "yunits : %s\n", gridptr->yunits);
if ( type == GRID_CELL ) fprintf(fp, "nvertex : %d\n", nvertex);
if ( type == GRID_CELL ) fprintf(fp, "nvertex : %d\n", nvertex);
}
switch (type)
......@@ -2998,8 +2998,11 @@ void gridPrint(int gridID, int opt)
ydim = ysize;
}
if ( xsize > 0 ) fprintf(fp, "xsize : %d\n", xsize);
if ( ysize > 0 ) fprintf(fp, "ysize : %d\n", ysize);
if ( type != GRID_CELL )
{
if ( xsize > 0 ) fprintf(fp, "xsize : %d\n", xsize);
if ( ysize > 0 ) fprintf(fp, "ysize : %d\n", ysize);
}
if ( gridptr->isRotated )
{
......
......@@ -1416,19 +1416,19 @@ double areas(struct cart *dv1, struct cart *dv2, struct cart *dv3)
ca2 = -( u23.x[0]*u12.x[0]+u23.x[1]*u12.x[1]+u23.x[2]*u12.x[2] );
ca3 = -( u31.x[0]*u23.x[0]+u31.x[1]*u23.x[1]+u31.x[2]*u23.x[2] );
#if ! defined (fmax)
#define fmax(a,b) ({double _a = (a), _b = (b); _a > _b ? _a : _b; })
#if ! defined (FMAX)
#define FMAX(a,b) ((a) > (b) ? (a) : (b))
#endif
#if ! defined (fmin)
#define fmin(a,b) ({double _a = (a), _b = (b); _a < _b ? _a : _b; })
#if ! defined (FMIN)
#define FMIN(a,b) ((a) < (b) ? (a) : (b))
#endif
ca1 = fmax(ca1, -1.0);
ca1 = fmin(ca1, +1.0);
ca2 = fmax(ca2, -1.0);
ca2 = fmin(ca2, +1.0);
ca3 = fmax(ca3, -1.0);
ca3 = fmin(ca3, +1.0);
ca1 = FMAX(ca1, -1.0);
ca1 = FMIN(ca1, +1.0);
ca2 = FMAX(ca2, -1.0);
ca2 = FMIN(ca2, +1.0);
ca3 = FMAX(ca3, -1.0);
ca3 = FMIN(ca3, +1.0);
a1 = acos(ca1);
a2 = acos(ca2);
......
......@@ -49,6 +49,7 @@ typedef struct {
NCDIM;
typedef struct {
int ignore;
int vartype;
int isvar;
int islon;
......@@ -3103,8 +3104,9 @@ void cdfSetVar(NCVAR *ncvars, int ncvarid, int isvar)
ncvars[ncvarid].isvar != isvar &&
ncvars[ncvarid].warn == FALSE )
{
Warning(func, "Inconsistent variable definition for %s!", ncvars[ncvarid].name);
if ( ! ncvars[ncvarid].ignore )
Warning(func, "Inconsistent variable definition for %s!", ncvars[ncvarid].name);
ncvars[ncvarid].warn = TRUE;
isvar = FALSE;
}
......@@ -3184,7 +3186,7 @@ int cdfInqContents(int streamID)
int fileID;
int nvdims, nvatts;
int *dimidsp;
nc_type xtype;
nc_type xtype, atttype;
size_t size = 0, xsize, ysize;
size_t ntsteps;
int timedimid = -1;
......@@ -3263,6 +3265,7 @@ int cdfInqContents(int streamID)
/* init ncvars */
for ( ncvarid = 0; ncvarid < nvars; ncvarid++ )
{
ncvars[ncvarid].ignore = FALSE;
ncvars[ncvarid].vartype = UNDEFID;
ncvars[ncvarid].isvar = UNDEFID;
ncvars[ncvarid].islon = FALSE;
......@@ -3425,6 +3428,8 @@ int cdfInqContents(int streamID)
for ( iatt = 0; iatt < nvatts; iatt++ )
{
cdf_inq_attname(fileID, ncvarid, iatt, attname);
cdf_inq_atttype(fileID, ncvarid, attname, &atttype);
cdf_inq_attlen(fileID, ncvarid, attname, &attlen);
if ( strcmp(attname, "long_name") == 0 )
{
......@@ -3460,14 +3465,12 @@ int cdfInqContents(int streamID)
}
else if ( strcmp(attname, "trunc_type") == 0 )
{
cdf_inq_attlen(fileID, ncvarid, attname, &attlen);
cdfGetAttText(fileID, ncvarid, attname, attstringlen-1, attstring);
if ( strncmp(attstring, "Triangular", attlen) == 0 )
ncvars[ncvarid].gridtype = GRID_SPECTRAL;
}
else if ( strcmp(attname, "grid_type") == 0 )
{
cdf_inq_attlen(fileID, ncvarid, attname, &attlen);
cdfGetAttText(fileID, ncvarid, attname, attstringlen-1, attstring);
if ( strncmp(attstring, "gaussian", attlen) == 0 )
......@@ -3506,26 +3509,26 @@ int cdfInqContents(int streamID)
}
else if ( strcmp(attname, "add_offset") == 0 )
{
if ( xtype != NC_CHAR )
if ( atttype != NC_CHAR )
{
cdfGetAttDouble(fileID, ncvarid, attname, 1, &ncvars[ncvarid].addoffset);
/*
if ( xtype != NC_BYTE && xtype != NC_SHORT && xtype != NC_INT )
if ( atttype != NC_BYTE && atttype != NC_SHORT && atttype != NC_INT )
if ( ncvars[ncvarid].addoffset != 0 )
Warning(func, "attribute add_offset not supported for xtype %d\n", xtype);
Warning(func, "attribute add_offset not supported for atttype %d\n", atttype);
*/
cdfSetVar(ncvars, ncvarid, TRUE);
}
}
else if ( strcmp(attname, "scale_factor") == 0 )
{
if ( xtype != NC_CHAR )
if ( atttype != NC_CHAR )
{
cdfGetAttDouble(fileID, ncvarid, attname, 1, &ncvars[ncvarid].scalefactor);
/*
if ( xtype != NC_BYTE && xtype != NC_SHORT && xtype != NC_INT )
if ( atttype != NC_BYTE && atttype != NC_SHORT && atttype != NC_INT )
if ( ncvars[ncvarid].scalefactor != 1 )
Warning(func, "attribute scale_factor not supported for xtype %d\n", xtype);
Warning(func, "attribute scale_factor not supported for atttype %d\n", atttype);
*/