Commits (34)
2019-10-29 Uwe Schulzweida 2021-01-25 Uwe Schulzweida
* using CGRIBEX library version 1.9.5
* Version 1.9.10 released
2021-01-07 Uwe Schulzweida
* gridDefParamRLL: set x/y units to degrees
2020-12-03 Uwe Schulzweida
* gridDefParamLCC: write latitude_of_projection_origin to lat_0 (bug fix)
2020-11-27 Uwe Schulzweida
* struct record_t: changed data type of levelID from short to int
2020-11-26 Uwe Schulzweida
* cdi.h: removed function gaussianLatitudes() from cdi interface
2020-10-09 Uwe Schulzweida
* using CGRIBEX library version 1.9.5 * using CGRIBEX library version 1.9.5
* Version 1.9.9 released * Version 1.9.9 released
2020-09-25 Uwe Schulzweida
* cdi_generate_vars: set level to level1 if zaxis bounds are available (removed level = (level1 + level2) / 2)
2020-09-21 Uwe Schulzweida 2020-09-21 Uwe Schulzweida
* Ignore netCDF attribute _NCProperties * Ignore netCDF attribute _NCProperties
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
# autoconf 2.69 # autoconf 2.69
# libtool 2.4.6 # libtool 2.4.6
AC_PREREQ([2.69]) AC_PREREQ([2.70])
LT_PREREQ([2.4.6]) LT_PREREQ([2.4.6])
AC_INIT([cdi], [1.9.9rc5], [https://mpimet.mpg.de/cdi]) AC_INIT([cdi],[1.9.10],[https://mpimet.mpg.de/cdi])
AC_DEFINE_UNQUOTED(CDI, ["$PACKAGE_VERSION"], [CDI version]) AC_DEFINE_UNQUOTED(CDI, ["$PACKAGE_VERSION"], [CDI version])
...@@ -27,7 +27,7 @@ AC_CONFIG_HEADERS([src/config.h]) ...@@ -27,7 +27,7 @@ AC_CONFIG_HEADERS([src/config.h])
AM_MAINTAINER_MODE([disable]) AM_MAINTAINER_MODE([disable])
# Check building environment # Check building environment
AC_PROG_CC_C99 AC_PROG_CC
dnl The check above forgets to delete the following directory dnl The check above forgets to delete the following directory
dnl generated by the MacOS linker, which results in multiple dnl generated by the MacOS linker, which results in multiple
dnl annoying messages from the rm utility: dnl annoying messages from the rm utility:
...@@ -439,10 +439,11 @@ AC_CONFIG_FILES([tests/test_cksum_grib \ ...@@ -439,10 +439,11 @@ AC_CONFIG_FILES([tests/test_cksum_grib \
tables/gen_tableheaderfile \ tables/gen_tableheaderfile \
util/serialrun],[chmod a+x "$ac_file"]) util/serialrun],[chmod a+x "$ac_file"])
AC_OUTPUT([Makefile src/Makefile interfaces/Makefile app/Makefile \ AC_CONFIG_FILES([Makefile src/Makefile interfaces/Makefile app/Makefile \
tests/Makefile examples/Makefile cdi.settings \ tests/Makefile examples/Makefile cdi.settings \
examples/pio/Makefile src/pkgconfig/cdi.pc src/pkgconfig/cdipio.pc \ examples/pio/Makefile src/pkgconfig/cdi.pc src/pkgconfig/cdipio.pc \
src/pkgconfig/cdi_f2003.pc]) src/pkgconfig/cdi_f2003.pc])
AC_OUTPUT
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Show configuration # Show configuration
......
...@@ -64,7 +64,7 @@ libcdi_la_SOURCES = \ ...@@ -64,7 +64,7 @@ libcdi_la_SOURCES = \
extralib.c \ extralib.c \
file.c \ file.c \
file.h \ file.h \
gaussgrid.c \ gaussian_latitudes.c \
gribapi.c \ gribapi.c \
gribapi.h \ gribapi.h \
gribapi_utilities.h \ gribapi_utilities.h \
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
UINT32 get_UINT32(unsigned char *x) UINT32 get_UINT32(unsigned char *x)
{ {
// clang-format off
switch (HOST_ENDIANNESS) switch (HOST_ENDIANNESS)
{ {
case CDI_BIGENDIAN: case CDI_BIGENDIAN:
...@@ -17,11 +18,13 @@ UINT32 get_UINT32(unsigned char *x) ...@@ -17,11 +18,13 @@ UINT32 get_UINT32(unsigned char *x)
Error("Unhandled endianness %d", HOST_ENDIANNESS); Error("Unhandled endianness %d", HOST_ENDIANNESS);
return UINT32_C(0xFFFFFFFF); return UINT32_C(0xFFFFFFFF);
} }
// clang-format on
} }
UINT32 get_SUINT32(unsigned char *x) UINT32 get_SUINT32(unsigned char *x)
{ {
// clang-format off
switch (HOST_ENDIANNESS) switch (HOST_ENDIANNESS)
{ {
case CDI_BIGENDIAN: case CDI_BIGENDIAN:
...@@ -32,11 +35,13 @@ UINT32 get_SUINT32(unsigned char *x) ...@@ -32,11 +35,13 @@ UINT32 get_SUINT32(unsigned char *x)
Error("Unhandled endianness %d", HOST_ENDIANNESS); Error("Unhandled endianness %d", HOST_ENDIANNESS);
return UINT32_C(0xFFFFFFFF); return UINT32_C(0xFFFFFFFF);
} }
// clang-format on
} }
UINT64 get_UINT64(unsigned char *x) UINT64 get_UINT64(unsigned char *x)
{ {
// clang-format off
switch (HOST_ENDIANNESS) switch (HOST_ENDIANNESS)
{ {
case CDI_BIGENDIAN: case CDI_BIGENDIAN:
...@@ -49,11 +54,13 @@ UINT64 get_UINT64(unsigned char *x) ...@@ -49,11 +54,13 @@ UINT64 get_UINT64(unsigned char *x)
Error("Unhandled endianness %d", HOST_ENDIANNESS); Error("Unhandled endianness %d", HOST_ENDIANNESS);
return UINT64_C(0xFFFFFFFFFFFFFFFF); return UINT64_C(0xFFFFFFFFFFFFFFFF);
} }
// clang-format on
} }
UINT64 get_SUINT64(unsigned char *x) UINT64 get_SUINT64(unsigned char *x)
{ {
// clang-format off
switch (HOST_ENDIANNESS) switch (HOST_ENDIANNESS)
{ {
case CDI_BIGENDIAN: case CDI_BIGENDIAN:
...@@ -66,6 +73,7 @@ UINT64 get_SUINT64(unsigned char *x) ...@@ -66,6 +73,7 @@ UINT64 get_SUINT64(unsigned char *x)
Error("Unhandled endianness %d", HOST_ENDIANNESS); Error("Unhandled endianness %d", HOST_ENDIANNESS);
return UINT64_C(0xFFFFFFFFFFFFFFFF); return UINT64_C(0xFFFFFFFFFFFFFFFF);
} }
// clang-format on
} }
...@@ -85,8 +93,8 @@ size_t binReadF77Block(int fileID, int byteswap) ...@@ -85,8 +93,8 @@ size_t binReadF77Block(int fileID, int byteswap)
void binWriteF77Block(int fileID, int byteswap, size_t blocksize) void binWriteF77Block(int fileID, int byteswap, size_t blocksize)
{ {
static unsigned int s[4] = {0, 8, 16, 24}; static const unsigned int s[4] = {0, 8, 16, 24};
unsigned long ublocksize = (unsigned long) blocksize; const unsigned long ublocksize = (unsigned long) blocksize;
unsigned char f77block[4]; unsigned char f77block[4];
switch (HOST_ENDIANNESS) switch (HOST_ENDIANNESS)
...@@ -142,28 +150,6 @@ int binReadInt64(int fileID, int byteswap, size_t size, INT64 *ptr) ...@@ -142,28 +150,6 @@ int binReadInt64(int fileID, int byteswap, size_t size, INT64 *ptr)
} }
int binReadFlt32(int fileID, int byteswap, size_t size, FLT32 *ptr)
{
if ( sizeof(FLT32) != 4 ) Error("Not implemented for %d byte float!", sizeof(FLT32));
fileRead(fileID, (void *) ptr, 4*size);
if ( byteswap ) swap4byte(ptr, size);
return 0;
}
int binReadFlt64(int fileID, int byteswap, size_t size, FLT64 *ptr)
{
if ( sizeof(FLT64) != 8 ) Error("Not implemented for %d byte float!", sizeof(FLT64));
fileRead(fileID, (void *) ptr, 8*size);
if ( byteswap ) swap8byte(ptr, size);
return 0;
}
int binWriteInt32(int fileID, int byteswap, size_t size, INT32 *ptr) int binWriteInt32(int fileID, int byteswap, size_t size, INT32 *ptr)
{ {
if ( sizeof(INT32) != 4 ) Error("Not implemented for %d byte integer!", sizeof(INT32)); if ( sizeof(INT32) != 4 ) Error("Not implemented for %d byte integer!", sizeof(INT32));
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define BINARY_H #define BINARY_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" #include "config.h"
#endif #endif
#include <inttypes.h> #include <inttypes.h>
...@@ -34,9 +34,6 @@ int binReadInt64(int fileID, int byteswap, size_t size, INT64 *ptr); ...@@ -34,9 +34,6 @@ int binReadInt64(int fileID, int byteswap, size_t size, INT64 *ptr);
int binWriteInt32(int fileID, int byteswap, size_t size, INT32 *ptr); int binWriteInt32(int fileID, int byteswap, size_t size, INT32 *ptr);
int binWriteInt64(int fileID, int byteswap, size_t size, INT64 *ptr); int binWriteInt64(int fileID, int byteswap, size_t size, INT64 *ptr);
int binReadFlt32(int fileID, int byteswap, size_t size, FLT32 *ptr);
int binReadFlt64(int fileID, int byteswap, size_t size, FLT64 *ptr);
int binWriteFlt32(int fileID, int byteswap, size_t size, FLT32 *ptr); int binWriteFlt32(int fileID, int byteswap, size_t size, FLT32 *ptr);
int binWriteFlt64(int fileID, int byteswap, size_t size, FLT64 *ptr); int binWriteFlt64(int fileID, int byteswap, size_t size, FLT64 *ptr);
......
...@@ -27,25 +27,12 @@ int days_per_month(int calendar, int year, int month) ...@@ -27,25 +27,12 @@ int days_per_month(int calendar, int year, int month)
{ {
int daysperyear = calendar_dpy(calendar); int daysperyear = calendar_dpy(calendar);
const int *dpm; const int *dpm = (daysperyear == 360) ? month_360 : ((daysperyear == 365) ? month_365 : month_366);
if ( daysperyear == 360 ) dpm = month_360;
else if ( daysperyear == 365 ) dpm = month_365; int dayspermonth = ( month >= 1 && month <= 12 ) ? dpm[month-1] : 0;
else dpm = month_366;
if (daysperyear == 0 && month == 2)
int dayspermonth = 0; dayspermonth = ((year%4 == 0 && year%100 != 0) || year%400 == 0) ? 29 : 28;
if ( month >= 1 && month <= 12 )
dayspermonth = dpm[month-1];
/*
else
fprintf(stderr, "days_per_month: month %d out of range\n", month);
*/
if ( daysperyear == 0 && month == 2 )
{
if ( (year%4 == 0 && year%100 != 0) || year%400 == 0 )
dayspermonth = 29;
else
dayspermonth = 28;
}
return dayspermonth; return dayspermonth;
} }
...@@ -55,11 +42,11 @@ int days_per_year(int calendar, int year) ...@@ -55,11 +42,11 @@ int days_per_year(int calendar, int year)
{ {
int daysperyear = calendar_dpy(calendar); int daysperyear = calendar_dpy(calendar);
if ( daysperyear == 0 ) if (daysperyear == 0)
{ {
if ( year == 1582 && (calendar == CALENDAR_STANDARD || calendar == CALENDAR_GREGORIAN) ) if (year == 1582 && (calendar == CALENDAR_STANDARD || calendar == CALENDAR_GREGORIAN))
daysperyear = 355; daysperyear = 355;
else if ( (year%4 == 0 && year%100 != 0) || year%400 == 0 ) else if ((year%4 == 0 && year%100 != 0) || year%400 == 0)
daysperyear = 366; daysperyear = 366;
else else
daysperyear = 365; daysperyear = 365;
...@@ -71,8 +58,6 @@ int days_per_year(int calendar, int year) ...@@ -71,8 +58,6 @@ int days_per_year(int calendar, int year)
static void decode_day(int dpy, int days, int *year, int *month, int *day) static void decode_day(int dpy, int days, int *year, int *month, int *day)
{ {
int i = 0;
*year = (days-1) / dpy; *year = (days-1) / dpy;
days -= (*year*dpy); days -= (*year*dpy);
...@@ -81,6 +66,7 @@ static void decode_day(int dpy, int days, int *year, int *month, int *day) ...@@ -81,6 +66,7 @@ static void decode_day(int dpy, int days, int *year, int *month, int *day)
else if ( dpy == 365 ) dpm = month_365; else if ( dpy == 365 ) dpm = month_365;
else if ( dpy == 366 ) dpm = month_366; else if ( dpy == 366 ) dpm = month_366;
int i = 0;
if ( dpm ) if ( dpm )
for ( i = 0; i < 12; i++ ) for ( i = 0; i < 12; i++ )
{ {
...@@ -112,7 +98,7 @@ static int64_t encode_day(int dpy, int year, int month, int day) ...@@ -112,7 +98,7 @@ static int64_t encode_day(int dpy, int year, int month, int day)
void encode_caldaysec(int calendar, int year, int month, int day, int hour, int minute, int second, void encode_caldaysec(int calendar, int year, int month, int day, int hour, int minute, int second,
int64_t *julday, int *secofday) int64_t *julday, int *secofday)
{ {
int dpy = calendar_dpy(calendar); const int dpy = calendar_dpy(calendar);
if ( dpy == 360 || dpy == 365 || dpy == 366 ) if ( dpy == 360 || dpy == 365 || dpy == 366 )
*julday = encode_day(dpy, year, month, day); *julday = encode_day(dpy, year, month, day);
...@@ -126,7 +112,7 @@ void encode_caldaysec(int calendar, int year, int month, int day, int hour, int ...@@ -126,7 +112,7 @@ void encode_caldaysec(int calendar, int year, int month, int day, int hour, int
void decode_caldaysec(int calendar, int64_t julday, int secofday, void decode_caldaysec(int calendar, int64_t julday, int secofday,
int *year, int *month, int *day, int *hour, int *minute, int *second) int *year, int *month, int *day, int *hour, int *minute, int *second)
{ {
int dpy = calendar_dpy(calendar); const int dpy = calendar_dpy(calendar);
if ( dpy == 360 || dpy == 365 || dpy == 366 ) if ( dpy == 360 || dpy == 365 || dpy == 366 )
decode_day(dpy, julday, year, month, day); decode_day(dpy, julday, year, month, day);
...@@ -142,7 +128,7 @@ void decode_caldaysec(int calendar, int64_t julday, int secofday, ...@@ -142,7 +128,7 @@ void decode_caldaysec(int calendar, int64_t julday, int secofday,
#ifdef TEST #ifdef TEST
static int date_to_calday(int calendar, int date) static int date_to_calday(int calendar, int date)
{ {
int dpy = calendar_dpy(calendar); const int dpy = calendar_dpy(calendar);
int year, month, day; int year, month, day;
cdiDecodeDate(date, &year, &month, &day); cdiDecodeDate(date, &year, &month, &day);
...@@ -160,14 +146,14 @@ static int date_to_calday(int calendar, int date) ...@@ -160,14 +146,14 @@ static int date_to_calday(int calendar, int date)
static int calday_to_date(int calendar, int calday) static int calday_to_date(int calendar, int calday)
{ {
int year, month, day; int year, month, day;
int dpy = calendar_dpy(calendar); const int dpy = calendar_dpy(calendar);
if ( dpy == 360 || dpy == 365 || dpy == 366 ) if ( dpy == 360 || dpy == 365 || dpy == 366 )
decode_day(dpy, calday, &year, &month, &day); decode_day(dpy, calday, &year, &month, &day);
else else
decode_julday(calendar, calday, &year, &month, &day); decode_julday(calendar, calday, &year, &month, &day);
int date = cdiEncodeDate(year, month, day); const int date = cdiEncodeDate(year, month, day);
return date; return date;
} }
......
...@@ -103,7 +103,7 @@ static int cdfOpenFile(const char *filename, const char *mode, int *filetype) ...@@ -103,7 +103,7 @@ static int cdfOpenFile(const char *filename, const char *mode, int *filetype)
{ {
case 'r': case 'r':
{ {
int status = cdf_open(filename, readmode, &ncid); const int status = cdf_open(filename, readmode, &ncid);
if ( status > 0 && ncid < 0 ) ncid = CDI_ESYSTEM; if ( status > 0 && ncid < 0 ) ncid = CDI_ESYSTEM;
#ifdef HAVE_NETCDF4 #ifdef HAVE_NETCDF4
else else
......
...@@ -28,7 +28,7 @@ void cdf_create(const char *path, int cmode, int *ncidp) ...@@ -28,7 +28,7 @@ void cdf_create(const char *path, int cmode, int *ncidp)
int status = my_nc__create(path, cmode, initialsz, &chunksizehint, ncidp); int status = my_nc__create(path, cmode, initialsz, &chunksizehint, ncidp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d mode = %d chunksizehint = %zu file = %s", *ncidp, cmode, chunksizehint, path); Message("ncid=%d mode=%d chunksizehint=%zu file=%s", *ncidp, cmode, chunksizehint, path);
if ( status != NC_NOERR ) Error("%s: %s", path, nc_strerror(status)); if ( status != NC_NOERR ) Error("%s: %s", path, nc_strerror(status));
...@@ -75,7 +75,7 @@ int cdf_open(const char *path, int omode, int *ncidp) ...@@ -75,7 +75,7 @@ int cdf_open(const char *path, int omode, int *ncidp)
} }
if ( CDF_Debug ) if ( CDF_Debug )
Message("ncid = %d mode = %d file = %s", *ncidp, omode, path); Message("ncid=%d mode=%d file=%s", *ncidp, omode, path);
if ( CDF_Debug && status != NC_NOERR ) Message("%s", nc_strerror(status)); if ( CDF_Debug && status != NC_NOERR ) Message("%s", nc_strerror(status));
...@@ -85,21 +85,21 @@ int cdf_open(const char *path, int omode, int *ncidp) ...@@ -85,21 +85,21 @@ int cdf_open(const char *path, int omode, int *ncidp)
void cdf_close(int ncid) void cdf_close(int ncid)
{ {
int status = nc_close(ncid); const int status = nc_close(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
void cdf_redef(int ncid) void cdf_redef(int ncid)
{ {
int status = nc_redef(ncid); const int status = nc_redef(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
void cdf_enddef(int ncid) void cdf_enddef(int ncid)
{ {
int status = nc_enddef(ncid); const int status = nc_enddef(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -111,24 +111,24 @@ void cdf__enddef(const int ncid, const size_t hdr_pad) ...@@ -111,24 +111,24 @@ void cdf__enddef(const int ncid, const size_t hdr_pad)
const size_t r_align = 4UL; // [B] Alignment of beginning of data section for record variables const size_t r_align = 4UL; // [B] Alignment of beginning of data section for record variables
// nc_enddef(ncid) is equivalent to nc__enddef(ncid, 0, 4, 0, 4) // nc_enddef(ncid) is equivalent to nc__enddef(ncid, 0, 4, 0, 4)
int status = nc__enddef(ncid, hdr_pad, v_align, v_minfree, r_align); const int status = nc__enddef(ncid, hdr_pad, v_align, v_minfree, r_align);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
void cdf_sync(int ncid) void cdf_sync(int ncid)
{ {
int status = nc_sync(ncid); const int status = nc_sync(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
void cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) void cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp)
{ {
int status = nc_inq(ncid, ndimsp, nvarsp, ngattsp, unlimdimidp); const int status = nc_inq(ncid, ndimsp, nvarsp, ngattsp, unlimdimidp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d ndims = %d nvars = %d ngatts = %d unlimid = %d", Message("ncid=%d ndims=%d nvars=%d ngatts=%d unlimid=%d",
ncid, *ndimsp, *nvarsp, *ngattsp, *unlimdimidp); ncid, *ndimsp, *nvarsp, *ngattsp, *unlimdimidp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
...@@ -137,10 +137,10 @@ void cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) ...@@ -137,10 +137,10 @@ void cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp)
void cdf_def_dim(int ncid, const char *name, size_t len, int *dimidp) void cdf_def_dim(int ncid, const char *name, size_t len, int *dimidp)
{ {
int status = nc_def_dim(ncid, name, len, dimidp); const int status = nc_def_dim(ncid, name, len, dimidp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d name = %s len = %d", ncid, name, len); Message("ncid=%d name=%s len=%d", ncid, name, len);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -148,10 +148,10 @@ void cdf_def_dim(int ncid, const char *name, size_t len, int *dimidp) ...@@ -148,10 +148,10 @@ void cdf_def_dim(int ncid, const char *name, size_t len, int *dimidp)
void cdf_inq_dimid(int ncid, const char *name, int *dimidp) void cdf_inq_dimid(int ncid, const char *name, int *dimidp)
{ {
int status = nc_inq_dimid(ncid, name, dimidp); const int status = nc_inq_dimid(ncid, name, dimidp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d name = %s dimid= %d", ncid, name, *dimidp); Message("ncid=%d name=%s dimid=%d", ncid, name, *dimidp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -159,10 +159,10 @@ void cdf_inq_dimid(int ncid, const char *name, int *dimidp) ...@@ -159,10 +159,10 @@ void cdf_inq_dimid(int ncid, const char *name, int *dimidp)
void cdf_inq_dim(int ncid, int dimid, char *name, size_t * lengthp) void cdf_inq_dim(int ncid, int dimid, char *name, size_t * lengthp)
{ {
int status = nc_inq_dim(ncid, dimid, name, lengthp); const int status = nc_inq_dim(ncid, dimid, name, lengthp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d dimid = %d length = %d name = %s", ncid, dimid, *lengthp, name); Message("ncid=%d dimid=%d length=%d name=%s", ncid, dimid, *lengthp, name);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -170,10 +170,10 @@ void cdf_inq_dim(int ncid, int dimid, char *name, size_t * lengthp) ...@@ -170,10 +170,10 @@ void cdf_inq_dim(int ncid, int dimid, char *name, size_t * lengthp)
void cdf_inq_dimname(int ncid, int dimid, char *name) void cdf_inq_dimname(int ncid, int dimid, char *name)
{ {
int status = nc_inq_dimname(ncid, dimid, name); const int status = nc_inq_dimname(ncid, dimid, name);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d dimid = %d name = %s", ncid, dimid, name); Message("ncid=%d dimid=%d name=%s", ncid, dimid, name);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -181,10 +181,10 @@ void cdf_inq_dimname(int ncid, int dimid, char *name) ...@@ -181,10 +181,10 @@ void cdf_inq_dimname(int ncid, int dimid, char *name)
void cdf_inq_dimlen(int ncid, int dimid, size_t * lengthp) void cdf_inq_dimlen(int ncid, int dimid, size_t * lengthp)
{ {
int status = nc_inq_dimlen(ncid, dimid, lengthp); const int status = nc_inq_dimlen(ncid, dimid, lengthp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d dimid = %d length = %d", ncid, dimid, *lengthp); Message("ncid=%d dimid=%d length=%d", ncid, dimid, *lengthp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -202,11 +202,10 @@ void ...@@ -202,11 +202,10 @@ void
cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims, cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims,
const int dimids[], int *varidp) const int dimids[], int *varidp)
{ {
int status = nc_def_var(ncid, name, xtype, ndims, dimids, varidp); const int status = nc_def_var(ncid, name, xtype, ndims, dimids, varidp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d name = %s xtype = %d ndims = %d varid = %d", Message("ncid=%d name=%s xtype=%d ndims=%d varid=%d", ncid, name, xtype, ndims, *varidp);
ncid, name, xtype, ndims, *varidp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -215,10 +214,10 @@ cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims, ...@@ -215,10 +214,10 @@ cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims,
void cdf_inq_varid(int ncid, const char *name, int *varidp) void cdf_inq_varid(int ncid, const char *name, int *varidp)
{ {
int status = nc_inq_varid(ncid, name, varidp); const int status = nc_inq_varid(ncid, name, varidp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d name = %s varid = %d ", ncid, name, *varidp); Message("ncid=%d name=%s varid=%d", ncid, name, *varidp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -226,10 +225,10 @@ void cdf_inq_varid(int ncid, const char *name, int *varidp) ...@@ -226,10 +225,10 @@ void cdf_inq_varid(int ncid, const char *name, int *varidp)
void cdf_inq_nvars(int ncid, int *nvarsp) void cdf_inq_nvars(int ncid, int *nvarsp)
{ {
int status = nc_inq_nvars(ncid, nvarsp); const int status = nc_inq_nvars(ncid, nvarsp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d nvars = %d", ncid, *nvarsp); Message("ncid=%d nvars=%d", ncid, *nvarsp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -238,10 +237,10 @@ void cdf_inq_nvars(int ncid, int *nvarsp) ...@@ -238,10 +237,10 @@ void cdf_inq_nvars(int ncid, int *nvarsp)
void cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, void cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp,
int dimids[], int *nattsp) int dimids[], int *nattsp)
{ {
int status = nc_inq_var(ncid, varid, name, xtypep, ndimsp, dimids, nattsp); const int status = nc_inq_var(ncid, varid, name, xtypep, ndimsp, dimids, nattsp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d ndims = %d xtype = %d natts = %d name = %s", Message("ncid=%d varid=%d ndims=%d xtype=%d natts=%d name=%s",
ncid, varid, *ndimsp, *xtypep, *nattsp, name); ncid, varid, *ndimsp, *xtypep, *nattsp, name);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
...@@ -250,10 +249,10 @@ void cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, ...@@ -250,10 +249,10 @@ void cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp,
void cdf_inq_varname(int ncid, int varid, char *name) void cdf_inq_varname(int ncid, int varid, char *name)
{ {
int status = nc_inq_varname(ncid, varid, name); const int status = nc_inq_varname(ncid, varid, name);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d name = %s", ncid, varid, name); Message("ncid=%d varid=%d name=%s", ncid, varid, name);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -261,10 +260,10 @@ void cdf_inq_varname(int ncid, int varid, char *name) ...@@ -261,10 +260,10 @@ void cdf_inq_varname(int ncid, int varid, char *name)
void cdf_inq_vartype(int ncid, int varid, nc_type *xtypep) void cdf_inq_vartype(int ncid, int varid, nc_type *xtypep)
{ {
int status = nc_inq_vartype(ncid, varid, xtypep); const int status = nc_inq_vartype(ncid, varid, xtypep);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d xtype = %s", ncid, varid, *xtypep); Message("ncid=%d varid=%d xtype=%s", ncid, varid, *xtypep);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -272,10 +271,10 @@ void cdf_inq_vartype(int ncid, int varid, nc_type *xtypep) ...@@ -272,10 +271,10 @@ void cdf_inq_vartype(int ncid, int varid, nc_type *xtypep)
void cdf_inq_varndims(int ncid, int varid, int *ndimsp) void cdf_inq_varndims(int ncid, int varid, int *ndimsp)
{ {
int status = nc_inq_varndims(ncid, varid, ndimsp); const int status = nc_inq_varndims(ncid, varid, ndimsp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -283,10 +282,10 @@ void cdf_inq_varndims(int ncid, int varid, int *ndimsp) ...@@ -283,10 +282,10 @@ void cdf_inq_varndims(int ncid, int varid, int *ndimsp)
void cdf_inq_vardimid(int ncid, int varid, int dimids[]) void cdf_inq_vardimid(int ncid, int varid, int dimids[])
{ {
int status = nc_inq_vardimid(ncid, varid, dimids); const int status = nc_inq_vardimid(ncid, varid, dimids);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -294,10 +293,10 @@ void cdf_inq_vardimid(int ncid, int varid, int dimids[]) ...@@ -294,10 +293,10 @@ void cdf_inq_vardimid(int ncid, int varid, int dimids[])
void cdf_inq_varnatts(int ncid, int varid, int *nattsp) void cdf_inq_varnatts(int ncid, int varid, int *nattsp)
{ {
int status = nc_inq_varnatts(ncid, varid, nattsp); const int status = nc_inq_varnatts(ncid, varid, nattsp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d nattsp = %d", ncid, varid, *nattsp); Message("ncid=%d varid=%d nattsp=%d", ncid, varid, *nattsp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -305,7 +304,7 @@ void cdf_inq_varnatts(int ncid, int varid, int *nattsp) ...@@ -305,7 +304,7 @@ void cdf_inq_varnatts(int ncid, int varid, int *nattsp)
void cdf_put_var_text(int ncid, int varid, const char *tp) void cdf_put_var_text(int ncid, int varid, const char *tp)
{ {
int status = nc_put_var_text(ncid, varid, tp); const int status = nc_put_var_text(ncid, varid, tp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %s", ncid, varid, tp); Message("%d %d %s", ncid, varid, tp);
...@@ -316,7 +315,7 @@ void cdf_put_var_text(int ncid, int varid, const char *tp) ...@@ -316,7 +315,7 @@ void cdf_put_var_text(int ncid, int varid, const char *tp)
void cdf_put_var_short(int ncid, int varid, const short *sp) void cdf_put_var_short(int ncid, int varid, const short *sp)
{ {
int status = nc_put_var_short(ncid, varid, sp); const int status = nc_put_var_short(ncid, varid, sp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %hd", ncid, varid, *sp); Message("%d %d %hd", ncid, varid, *sp);
...@@ -327,7 +326,7 @@ void cdf_put_var_short(int ncid, int varid, const short *sp) ...@@ -327,7 +326,7 @@ void cdf_put_var_short(int ncid, int varid, const short *sp)
void cdf_put_var_int(int ncid, int varid, const int *ip) void cdf_put_var_int(int ncid, int varid, const int *ip)
{ {
int status = nc_put_var_int(ncid, varid, ip); const int status = nc_put_var_int(ncid, varid, ip);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %d", ncid, varid, *ip); Message("%d %d %d", ncid, varid, *ip);
...@@ -338,7 +337,7 @@ void cdf_put_var_int(int ncid, int varid, const int *ip) ...@@ -338,7 +337,7 @@ void cdf_put_var_int(int ncid, int varid, const int *ip)
void cdf_put_var_long(int ncid, int varid, const long *lp) void cdf_put_var_long(int ncid, int varid, const long *lp)
{ {
int status = nc_put_var_long(ncid, varid, lp); const int status = nc_put_var_long(ncid, varid, lp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %ld", ncid, varid, *lp); Message("%d %d %ld", ncid, varid, *lp);
...@@ -349,7 +348,7 @@ void cdf_put_var_long(int ncid, int varid, const long *lp) ...@@ -349,7 +348,7 @@ void cdf_put_var_long(int ncid, int varid, const long *lp)
void cdf_put_var_float(int ncid, int varid, const float *fp) void cdf_put_var_float(int ncid, int varid, const float *fp)
{ {
int status = nc_put_var_float(ncid, varid, fp); const int status = nc_put_var_float(ncid, varid, fp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %f", ncid, varid, *fp); Message("%d %d %f", ncid, varid, *fp);
...@@ -407,7 +406,7 @@ void minmaxvalf(size_t nvals, const float *array, double *minval, double *maxval ...@@ -407,7 +406,7 @@ void minmaxvalf(size_t nvals, const float *array, double *minval, double *maxval
void cdf_put_vara_double(int ncid, int varid, const size_t start[], void cdf_put_vara_double(int ncid, int varid, const size_t start[],
const size_t count[], const double *dp) const size_t count[], const double *dp)
{ {
int status = nc_put_vara_double(ncid, varid, start, count, dp); const int status = nc_put_vara_double(ncid, varid, start, count, dp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
{ {
...@@ -417,11 +416,11 @@ void cdf_put_vara_double(int ncid, int varid, const size_t start[], ...@@ -417,11 +416,11 @@ void cdf_put_vara_double(int ncid, int varid, const size_t start[],
nc_inq_vartype(ncid, varid, &xtype); nc_inq_vartype(ncid, varid, &xtype);
int ndims; int ndims;
nc_inq_varndims(ncid, varid, &ndims); nc_inq_varndims(ncid, varid, &ndims);
double minval = 0, maxval = 0; double minval = 0.0, maxval = 0.0;
size_t nvals = 1; size_t nvals = 1;
for ( int i = 0; i < ndims; ++i ) nvals *= count[i]; for ( int i = 0; i < ndims; ++i ) nvals *= count[i];
minmaxval(nvals, dp, &minval, &maxval); minmaxval(nvals, dp, &minval, &maxval);
// Message("ncid = %d varid = %d val0 = %f", ncid, varid, *dp); // Message("ncid=%d varid=%d val0=%f", ncid, varid, *dp);
Message("name=%s type=%s minval=%f maxval=%f", name, cdf_var_type(xtype), minval, maxval); Message("name=%s type=%s minval=%f maxval=%f", name, cdf_var_type(xtype), minval, maxval);
} }
...@@ -432,7 +431,7 @@ void cdf_put_vara_double(int ncid, int varid, const size_t start[], ...@@ -432,7 +431,7 @@ void cdf_put_vara_double(int ncid, int varid, const size_t start[],
void cdf_put_vara_float(int ncid, int varid, const size_t start[], void cdf_put_vara_float(int ncid, int varid, const size_t start[],
const size_t count[], const float *fp) const size_t count[], const float *fp)
{ {
int status = nc_put_vara_float(ncid, varid, start, count, fp); const int status = nc_put_vara_float(ncid, varid, start, count, fp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
{ {
...@@ -442,11 +441,11 @@ void cdf_put_vara_float(int ncid, int varid, const size_t start[], ...@@ -442,11 +441,11 @@ void cdf_put_vara_float(int ncid, int varid, const size_t start[],
nc_inq_vartype(ncid, varid, &xtype); nc_inq_vartype(ncid, varid, &xtype);
int ndims; int ndims;
nc_inq_varndims(ncid, varid, &ndims); nc_inq_varndims(ncid, varid, &ndims);
double minval = 0, maxval = 0; double minval = 0.0, maxval = 0.0;
size_t nvals = 1; size_t nvals = 1;
for ( int i = 0; i < ndims; ++i ) nvals *= count[i]; for ( int i = 0; i < ndims; ++i ) nvals *= count[i];
minmaxvalf(nvals, fp, &minval, &maxval); minmaxvalf(nvals, fp, &minval, &maxval);
// Message("ncid = %d varid = %d val0 = %f", ncid, varid, *dp); // Message("ncid=%d varid=%d val0=%f", ncid, varid, *dp);
Message("name=%s type=%s minval=%f maxval=%f", name, cdf_var_type(xtype), minval, maxval); Message("name=%s type=%s minval=%f maxval=%f", name, cdf_var_type(xtype), minval, maxval);
} }
...@@ -456,10 +455,10 @@ void cdf_put_vara_float(int ncid, int varid, const size_t start[], ...@@ -456,10 +455,10 @@ void cdf_put_vara_float(int ncid, int varid, const size_t start[],
void cdf_put_vara(int ncid, int varid, const size_t start[], const size_t count[], const void *cp) void cdf_put_vara(int ncid, int varid, const size_t start[], const size_t count[], const void *cp)
{ {
int status = nc_put_vara(ncid, varid, start, count, cp); const int status = nc_put_vara(ncid, varid, start, count, cp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -467,10 +466,10 @@ void cdf_put_vara(int ncid, int varid, const size_t start[], const size_t count[ ...@@ -467,10 +466,10 @@ void cdf_put_vara(int ncid, int varid, const size_t start[], const size_t count[
void cdf_get_vara(int ncid, int varid, const size_t start[], const size_t count[], void *cp) void cdf_get_vara(int ncid, int varid, const size_t start[], const size_t count[], void *cp)
{ {
int status = nc_get_vara(ncid, varid, start, count, cp); const int status = nc_get_vara(ncid, varid, start, count, cp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -478,10 +477,10 @@ void cdf_get_vara(int ncid, int varid, const size_t start[], const size_t count[ ...@@ -478,10 +477,10 @@ void cdf_get_vara(int ncid, int varid, const size_t start[], const size_t count[
void cdf_get_vara_int(int ncid, int varid, const size_t start[], const size_t count[], int *dp) void cdf_get_vara_int(int ncid, int varid, const size_t start[], const size_t count[], int *dp)
{ {
int status = nc_get_vara_int(ncid, varid, start, count, dp); const int status = nc_get_vara_int(ncid, varid, start, count, dp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -489,10 +488,10 @@ void cdf_get_vara_int(int ncid, int varid, const size_t start[], const size_t co ...@@ -489,10 +488,10 @@ void cdf_get_vara_int(int ncid, int varid, const size_t start[], const size_t co
void cdf_get_vara_double(int ncid, int varid, const size_t start[], const size_t count[], double *dp) void cdf_get_vara_double(int ncid, int varid, const size_t start[], const size_t count[], double *dp)
{ {
int status = nc_get_vara_double(ncid, varid, start, count, dp); const int status = nc_get_vara_double(ncid, varid, start, count, dp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d start[0]=%zu count[0]=%zu", ncid, varid, start[0], count[0]);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -500,10 +499,10 @@ void cdf_get_vara_double(int ncid, int varid, const size_t start[], const size_t ...@@ -500,10 +499,10 @@ void cdf_get_vara_double(int ncid, int varid, const size_t start[], const size_t
void cdf_get_vara_float(int ncid, int varid, const size_t start[], const size_t count[], float *fp) void cdf_get_vara_float(int ncid, int varid, const size_t start[], const size_t count[], float *fp)
{ {
int status = nc_get_vara_float(ncid, varid, start, count, fp); const int status = nc_get_vara_float(ncid, varid, start, count, fp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d start[0]=%zu count[0]=%zu", ncid, varid, start[0], count[0]);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -511,10 +510,10 @@ void cdf_get_vara_float(int ncid, int varid, const size_t start[], const size_t ...@@ -511,10 +510,10 @@ void cdf_get_vara_float(int ncid, int varid, const size_t start[], const size_t
void cdf_get_vara_text(int ncid, int varid, const size_t start[], const size_t count[], char *tp) void cdf_get_vara_text(int ncid, int varid, const size_t start[], const size_t count[], char *tp)
{ {
int status = nc_get_vara_text(ncid, varid, start, count, tp); const int status = nc_get_vara_text(ncid, varid, start, count, tp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -522,10 +521,10 @@ void cdf_get_vara_text(int ncid, int varid, const size_t start[], const size_t c ...@@ -522,10 +521,10 @@ void cdf_get_vara_text(int ncid, int varid, const size_t start[], const size_t c
void cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t count[], unsigned char *tp) void cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t count[], unsigned char *tp)
{ {
int status = nc_get_vara_uchar(ncid, varid, start, count, tp); const int status = nc_get_vara_uchar(ncid, varid, start, count, tp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -533,10 +532,10 @@ void cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t ...@@ -533,10 +532,10 @@ void cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t
void cdf_put_var_double(int ncid, int varid, const double *dp) void cdf_put_var_double(int ncid, int varid, const double *dp)
{ {
int status = nc_put_var_double(ncid, varid, dp); const int status = nc_put_var_double(ncid, varid, dp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d val0 = %f", ncid, varid, *dp); Message("ncid=%d varid=%d val0=%f", ncid, varid, *dp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -544,10 +543,10 @@ void cdf_put_var_double(int ncid, int varid, const double *dp) ...@@ -544,10 +543,10 @@ void cdf_put_var_double(int ncid, int varid, const double *dp)
void cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp) void cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp)
{ {
int status = nc_get_var1_text(ncid, varid, index, tp); const int status = nc_get_var1_text(ncid, varid, index, tp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -555,10 +554,10 @@ void cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp) ...@@ -555,10 +554,10 @@ void cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp)
void cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp) void cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp)
{ {
int status = nc_get_var1_double(ncid, varid, index, dp); const int status = nc_get_var1_double(ncid, varid, index, dp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -566,10 +565,10 @@ void cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp) ...@@ -566,10 +565,10 @@ void cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp)
void cdf_put_var1_double(int ncid, int varid, const size_t index[], const double *dp) void cdf_put_var1_double(int ncid, int varid, const size_t index[], const double *dp)
{ {
int status = nc_put_var1_double(ncid, varid, index, dp); const int status = nc_put_var1_double(ncid, varid, index, dp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d val = %f", ncid, varid, *dp); Message("ncid=%d varid=%d val=%f", ncid, varid, *dp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -577,10 +576,10 @@ void cdf_put_var1_double(int ncid, int varid, const size_t index[], const double ...@@ -577,10 +576,10 @@ void cdf_put_var1_double(int ncid, int varid, const size_t index[], const double
void cdf_get_var_text(int ncid, int varid, char *tp) void cdf_get_var_text(int ncid, int varid, char *tp)
{ {
int status = nc_get_var_text(ncid, varid, tp); const int status = nc_get_var_text(ncid, varid, tp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -588,10 +587,10 @@ void cdf_get_var_text(int ncid, int varid, char *tp) ...@@ -588,10 +587,10 @@ void cdf_get_var_text(int ncid, int varid, char *tp)
void cdf_get_var_short(int ncid, int varid, short *sp) void cdf_get_var_short(int ncid, int varid, short *sp)
{ {
int status = nc_get_var_short(ncid, varid, sp); const int status = nc_get_var_short(ncid, varid, sp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -599,10 +598,10 @@ void cdf_get_var_short(int ncid, int varid, short *sp) ...@@ -599,10 +598,10 @@ void cdf_get_var_short(int ncid, int varid, short *sp)
void cdf_get_var_int(int ncid, int varid, int *ip) void cdf_get_var_int(int ncid, int varid, int *ip)
{ {
int status = nc_get_var_int(ncid, varid, ip); const int status = nc_get_var_int(ncid, varid, ip);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -610,10 +609,10 @@ void cdf_get_var_int(int ncid, int varid, int *ip) ...@@ -610,10 +609,10 @@ void cdf_get_var_int(int ncid, int varid, int *ip)
void cdf_get_var_long(int ncid, int varid, long *lp) void cdf_get_var_long(int ncid, int varid, long *lp)
{ {
int status = nc_get_var_long(ncid, varid, lp); const int status = nc_get_var_long(ncid, varid, lp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -621,10 +620,10 @@ void cdf_get_var_long(int ncid, int varid, long *lp) ...@@ -621,10 +620,10 @@ void cdf_get_var_long(int ncid, int varid, long *lp)
void cdf_get_var_float(int ncid, int varid, float *fp) void cdf_get_var_float(int ncid, int varid, float *fp)
{ {
int status = nc_get_var_float(ncid, varid, fp); const int status = nc_get_var_float(ncid, varid, fp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid); Message("ncid=%d varid=%d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -632,10 +631,10 @@ void cdf_get_var_float(int ncid, int varid, float *fp) ...@@ -632,10 +631,10 @@ void cdf_get_var_float(int ncid, int varid, float *fp)
void cdf_get_var_double(int ncid, int varid, double *dp) void cdf_get_var_double(int ncid, int varid, double *dp)
{ {
int status = nc_get_var_double(ncid, varid, dp); const int status = nc_get_var_double(ncid, varid, dp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d val[0] = %f", ncid, varid, *dp); Message("ncid=%d varid=%d val[0]=%f", ncid, varid, *dp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -643,7 +642,7 @@ void cdf_get_var_double(int ncid, int varid, double *dp) ...@@ -643,7 +642,7 @@ void cdf_get_var_double(int ncid, int varid, double *dp)
void cdf_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out) void cdf_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out)
{ {
int status = nc_copy_att(ncid_in, varid_in, name, ncid_out, varid_out); const int status = nc_copy_att(ncid_in, varid_in, name, ncid_out, varid_out);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %s %d %d", ncid_in, varid_out, name, ncid_out, varid_out); Message("%d %d %s %d %d", ncid_in, varid_out, name, ncid_out, varid_out);
...@@ -654,10 +653,10 @@ void cdf_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int ...@@ -654,10 +653,10 @@ void cdf_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int
void cdf_put_att_text(int ncid, int varid, const char *name, size_t len, const char *tp) void cdf_put_att_text(int ncid, int varid, const char *name, size_t len, const char *tp)
{ {
int status = nc_put_att_text(ncid, varid, name, len, tp); const int status = nc_put_att_text(ncid, varid, name, len, tp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s text = %.*s", ncid, varid, name, (int)len, tp); Message("ncid=%d varid=%d att=%s text=%.*s", ncid, varid, name, (int)len, tp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -665,10 +664,10 @@ void cdf_put_att_text(int ncid, int varid, const char *name, size_t len, const c ...@@ -665,10 +664,10 @@ void cdf_put_att_text(int ncid, int varid, const char *name, size_t len, const c
void cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_t len, const int *ip) void cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_t len, const int *ip)
{ {
int status = nc_put_att_int(ncid, varid, name, xtype, len, ip); const int status = nc_put_att_int(ncid, varid, name, xtype, len, ip);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s val = %d", ncid, varid, name, *ip); Message("ncid=%d varid=%d att=%s val=%d", ncid, varid, name, *ip);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -676,10 +675,10 @@ void cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_ ...@@ -676,10 +675,10 @@ void cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_
void cdf_put_att_float(int ncid, int varid, const char *name, nc_type xtype, size_t len, const float *dp) void cdf_put_att_float(int ncid, int varid, const char *name, nc_type xtype, size_t len, const float *dp)
{ {
int status = nc_put_att_float(ncid, varid, name, xtype, len, dp); const int status = nc_put_att_float(ncid, varid, name, xtype, len, dp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s val = %g", ncid, varid, name, *dp); Message("ncid=%d varid=%d att=%s val=%g", ncid, varid, name, *dp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -687,10 +686,10 @@ void cdf_put_att_float(int ncid, int varid, const char *name, nc_type xtype, siz ...@@ -687,10 +686,10 @@ void cdf_put_att_float(int ncid, int varid, const char *name, nc_type xtype, siz
void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, size_t len, const double *dp) void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, size_t len, const double *dp)
{ {
int status = nc_put_att_double(ncid, varid, name, xtype, len, dp); const int status = nc_put_att_double(ncid, varid, name, xtype, len, dp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s val = %g", ncid, varid, name, *dp); Message("ncid=%d varid=%d att=%s val=%g", ncid, varid, name, *dp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -698,10 +697,10 @@ void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, si ...@@ -698,10 +697,10 @@ void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, si
void cdf_get_att_text(int ncid, int varid, const char *name, char *tp) void cdf_get_att_text(int ncid, int varid, const char *name, char *tp)
{ {
int status = nc_get_att_text(ncid, varid, name, tp); const int status = nc_get_att_text(ncid, varid, name, tp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d name = %s", ncid, varid, name); Message("ncid=%d varid=%d name=%s", ncid, varid, name);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -710,10 +709,10 @@ void cdf_get_att_text(int ncid, int varid, const char *name, char *tp) ...@@ -710,10 +709,10 @@ void cdf_get_att_text(int ncid, int varid, const char *name, char *tp)
void cdf_get_att_string(int ncid, int varid, const char *name, char **tp) void cdf_get_att_string(int ncid, int varid, const char *name, char **tp)
{ {
#ifdef HAVE_NETCDF4 #ifdef HAVE_NETCDF4
int status = nc_get_att_string(ncid, varid, name, tp); const int status = nc_get_att_string(ncid, varid, name, tp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d name = %s", ncid, varid, name); Message("ncid=%d varid=%d name=%s", ncid, varid, name);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
#endif #endif
...@@ -722,10 +721,10 @@ void cdf_get_att_string(int ncid, int varid, const char *name, char **tp) ...@@ -722,10 +721,10 @@ void cdf_get_att_string(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_int(int ncid, int varid, const char *name, int *ip)
{ {
int status = nc_get_att_int(ncid, varid, name, ip); const int status = nc_get_att_int(ncid, varid, name, ip);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s val = %d", ncid, varid, name, *ip); Message("ncid=%d varid=%d att=%s val=%d", ncid, varid, name, *ip);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -734,10 +733,10 @@ void cdf_get_att_int(int ncid, int varid, const char *name, int *ip) ...@@ -734,10 +733,10 @@ 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_long(int ncid, int varid, const char *name, long *ip)
{ {
#ifdef HAVE_NETCDF4 #ifdef HAVE_NETCDF4
int status = nc_get_att_long(ncid, varid, name, ip); const int status = nc_get_att_long(ncid, varid, name, ip);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s val = %ld", ncid, varid, name, *ip); Message("ncid=%d varid=%d att=%s val=%ld", ncid, varid, name, *ip);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
#endif #endif
...@@ -746,12 +745,10 @@ void cdf_get_att_long(int ncid, int varid, const char *name, long *ip) ...@@ -746,12 +745,10 @@ 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_get_att_double(int ncid, int varid, const char *name, double *dp)
{ {
int status; const int status = nc_get_att_double(ncid, varid, name, dp);
status = nc_get_att_double(ncid, varid, name, dp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s val = %.9g", ncid, varid, name, *dp); Message("ncid=%d varid=%d att=%s val=%.9g", ncid, varid, name, *dp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -759,10 +756,10 @@ void cdf_get_att_double(int ncid, int varid, const char *name, double *dp) ...@@ -759,10 +756,10 @@ 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) void cdf_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp)
{ {
int status = nc_inq_att(ncid, varid, name, xtypep, lenp); const int status = nc_inq_att(ncid, varid, name, xtypep, lenp);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s", ncid, varid, name); Message("ncid=%d varid=%d att=%s", ncid, varid, name);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
} }
...@@ -770,10 +767,10 @@ void cdf_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t ...@@ -770,10 +767,10 @@ void cdf_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t
void cdf_inq_atttype(int ncid, int varid, const char *name, nc_type * xtypep) void cdf_inq_atttype(int ncid, int varid, const char *name, nc_type * xtypep)
{ {
int status = nc_inq_atttype(ncid, varid, name, xtypep); const int status = nc_inq_atttype(ncid, varid, name, xtypep);
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s", ncid, varid, name); Message("ncid=%d varid=%d att=%s", ncid, varid, name);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status)); if ( status != NC_NOERR ) Error("%s", nc_strerror(status));