Commit 64ecb01b authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cdilib update

parent c4cca286
/* Automatically generated by m214003 at 2011-01-25, do not edit */ /* Automatically generated by m214003 at 2011-02-15, do not edit */
/* CGRIBEXLIB_VERSION="1.4.7" */ /* CGRIBEXLIB_VERSION="1.5.0" */
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)
# include "config.h" # include "config.h"
...@@ -136,7 +136,7 @@ int cdiEncodeTime(int hour, int minute, int second); ...@@ -136,7 +136,7 @@ int cdiEncodeTime(int hour, int minute, int second);
extern FILE *grprsm; extern FILE *grprsm;
extern int GRB_Debug; extern int CGRIBEX_Debug;
void gprintf(const char *caller, const char *fmt, ...); void gprintf(const char *caller, const char *fmt, ...);
...@@ -699,7 +699,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround) ...@@ -699,7 +699,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
double zref, zeps; double zref, zeps;
int iexp, isign; int iexp, isign;
int iround; int iround;
extern int GRB_Debug; extern int CGRIBEX_Debug;
extern double _pow16tab[71]; extern double _pow16tab[71];
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
...@@ -860,7 +860,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround) ...@@ -860,7 +860,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
LABEL900: LABEL900:
if ( GRB_Debug ) if ( CGRIBEX_Debug )
{ {
Message("Conversion type parameter = %4d", kround); Message("Conversion type parameter = %4d", kround);
Message("Original number = %30.20f", pval); Message("Original number = %30.20f", pval);
...@@ -945,14 +945,14 @@ double decfp2(int kexp, int kmant) ...@@ -945,14 +945,14 @@ double decfp2(int kexp, int kmant)
double pval; double pval;
int iexp, isign; int iexp, isign;
extern int GRB_Debug; extern int CGRIBEX_Debug;
extern double _pow16tab[71]; extern double _pow16tab[71];
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/* Section 1 . Convert value of 0.0. Ignore sign bit. */ /* Section 1 . Convert value of 0.0. Ignore sign bit. */
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
if ( GRB_Debug ) Message("KEXP = %d KMANT = %d", kexp, kmant); if ( CGRIBEX_Debug ) Message("KEXP = %d KMANT = %d", kexp, kmant);
/* /*
if ( (kexp == 128 || kexp == 0) && kmant == 0 ) if ( (kexp == 128 || kexp == 0) && kmant == 0 )
*/ */
...@@ -996,7 +996,7 @@ double decfp2(int kexp, int kmant) ...@@ -996,7 +996,7 @@ double decfp2(int kexp, int kmant)
LABEL900: LABEL900:
if ( GRB_Debug ) Message("Returned value = %f", pval); if ( CGRIBEX_Debug ) Message("Returned value = %f", pval);
return (pval); return (pval);
} /* decfp2 */ } /* decfp2 */
...@@ -1270,33 +1270,33 @@ gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3, ...@@ -1270,33 +1270,33 @@ gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3,
} }
} }
int GRB_Fix_ZSE = 0; /* 1: Fix ZeroShiftError of simple packed spherical harmonics */ int CGRIBEX_Fix_ZSE = 0; /* 1: Fix ZeroShiftError of simple packed spherical harmonics */
int GRB_Const = 0; /* 1: Don't pack constant fields on regular grids */ int CGRIBEX_Const = 0; /* 1: Don't pack constant fields on regular grids */
int GRB_Debug = 0; /* 1: Debugging */ int CGRIBEX_Debug = 0; /* 1: Debugging */
void gribSetDebug(int debug) void gribSetDebug(int debug)
{ {
GRB_Debug = debug; CGRIBEX_Debug = debug;
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("debug level %d", debug); Message("debug level %d", debug);
} }
void gribFixZSE(int flag) void gribFixZSE(int flag)
{ {
GRB_Fix_ZSE = flag; CGRIBEX_Fix_ZSE = flag;
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("Fix ZeroShiftError set to %d", flag); Message("Fix ZeroShiftError set to %d", flag);
} }
void gribSetConst(int flag) void gribSetConst(int flag)
{ {
GRB_Const = flag; CGRIBEX_Const = flag;
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("Const set to %d", flag); Message("Const set to %d", flag);
} }
...@@ -3530,7 +3530,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise ...@@ -3530,7 +3530,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise
/* of floating point numbers - needed */ /* of floating point numbers - needed */
/* on some platforms (eg vpp700, linux) */ /* on some platforms (eg vpp700, linux) */
extern double _pow2tab[158]; extern double _pow2tab[158];
extern int GRB_Const; /* 1: Don't pack constant fields on regular grids */ extern int CGRIBEX_Const; /* 1: Don't pack constant fields on regular grids */
if ( isec2 ) if ( isec2 )
{ {
...@@ -3645,7 +3645,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise ...@@ -3645,7 +3645,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise
zref = fmin; zref = fmin;
if ( GRB_Const && !lspherc ) if ( CGRIBEX_Const && !lspherc )
{ {
if ( IS_EQUAL(fmin, fmax) ) nbpv = 0; if ( IS_EQUAL(fmin, fmax) ) nbpv = 0;
} }
...@@ -4562,7 +4562,7 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, ...@@ -4562,7 +4562,7 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4,
double fmin = 0., zscale = 0.; double fmin = 0., zscale = 0.;
double *fpdata = fsec4; double *fpdata = fsec4;
int bdsLen; int bdsLen;
extern int GRB_Fix_ZSE; extern int CGRIBEX_Fix_ZSE;
*iret = 0; *iret = 0;
igrib = bds; igrib = bds;
...@@ -4800,7 +4800,7 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, ...@@ -4800,7 +4800,7 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4,
scaleComplex(fsec4, pcStart, pcScale, ISEC2_PentaJ, 1); scaleComplex(fsec4, pcStart, pcScale, ISEC2_PentaJ, 1);
} }
if ( GRB_Fix_ZSE ) /* Fix ZeroShiftError of simple packed spherical harmonics */ if ( CGRIBEX_Fix_ZSE ) /* Fix ZeroShiftError of simple packed spherical harmonics */
if ( lspherc && !lcomplex ) if ( lspherc && !lcomplex )
{ {
/* 20100705: Fix ZeroShiftError - Edi Kirk */ /* 20100705: Fix ZeroShiftError - Edi Kirk */
...@@ -5241,7 +5241,7 @@ int gribCheckFiletype(int fileID) ...@@ -5241,7 +5241,7 @@ int gribCheckFiletype(int fileID)
if ( memcmp(buffer, "GRIB", 4) == 0 ) if ( memcmp(buffer, "GRIB", 4) == 0 )
{ {
found = 1; found = 1;
if ( GRB_Debug ) Message("found GRIB file = %s", fileInqName(fileID)); if ( CGRIBEX_Debug ) Message("found GRIB file = %s", fileInqName(fileID));
} }
else else
{ {
...@@ -5252,7 +5252,7 @@ int gribCheckFiletype(int fileID) ...@@ -5252,7 +5252,7 @@ int gribCheckFiletype(int fileID)
if ( !ierr ) if ( !ierr )
{ {
found = 1; found = 1;
if ( GRB_Debug ) Message("found seek GRIB file = %s", fileInqName(fileID)); if ( CGRIBEX_Debug ) Message("found seek GRIB file = %s", fileInqName(fileID));
} }
} }
...@@ -5309,7 +5309,7 @@ int gribFileSeekOld(int fileID, long *offset) ...@@ -5309,7 +5309,7 @@ int gribFileSeekOld(int fileID, long *offset)
buffer[i+2] == 'I' && buffer[i+2] == 'I' &&
buffer[i+3] == 'B') buffer[i+3] == 'B')
{ {
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset); Message("record offset = %d", (int) *offset);
return (0); return (0);
} }
...@@ -5325,7 +5325,7 @@ int gribFileSeekOld(int fileID, long *offset) ...@@ -5325,7 +5325,7 @@ int gribFileSeekOld(int fileID, long *offset)
buffer[3] = buffer[i+3]; buffer[3] = buffer[i+3];
} }
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset); Message("record offset = %d", (int) *offset);
return (1); return (1);
...@@ -5354,7 +5354,7 @@ int gribFileSeek(int fileID, long *offset) ...@@ -5354,7 +5354,7 @@ int gribFileSeek(int fileID, long *offset)
if ( code == GRIB ) if ( code == GRIB )
{ {
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset); Message("record offset = %d", (int) *offset);
return (0); return (0);
} }
...@@ -5362,7 +5362,7 @@ int gribFileSeek(int fileID, long *offset) ...@@ -5362,7 +5362,7 @@ int gribFileSeek(int fileID, long *offset)
(*offset)++; (*offset)++;
} }
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset); Message("record offset = %d", (int) *offset);
return (1); return (1);
...@@ -5401,7 +5401,7 @@ int gribFileSeekTest(int fileID, long *offset) ...@@ -5401,7 +5401,7 @@ int gribFileSeekTest(int fileID, long *offset)
if ( code == GRIB ) if ( code == GRIB )
{ {
/* printf("end: %d %d\n", nread, i); */ /* printf("end: %d %d\n", nread, i); */
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset); Message("record offset = %d", (int) *offset);
if ( i != nread ) fileSetPos(fileID, (off_t) i-nread, SEEK_CUR); if ( i != nread ) fileSetPos(fileID, (off_t) i-nread, SEEK_CUR);
...@@ -5412,7 +5412,7 @@ int gribFileSeekTest(int fileID, long *offset) ...@@ -5412,7 +5412,7 @@ int gribFileSeekTest(int fileID, long *offset)
(*offset)++; (*offset)++;
} }
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset); Message("record offset = %d", (int) *offset);
return (1); return (1);
...@@ -5454,7 +5454,7 @@ int gribReadSize(int fileID) ...@@ -5454,7 +5454,7 @@ int gribReadSize(int fileID)
if ( gribversion != 1 && gribversion != 2 ) gribversion = 0; if ( gribversion != 1 && gribversion != 2 ) gribversion = 0;
} }
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("gribversion = %d", gribversion); Message("gribversion = %d", gribversion);
if ( gribversion == 0 ) if ( gribversion == 0 )
...@@ -5465,10 +5465,10 @@ int gribReadSize(int fileID) ...@@ -5465,10 +5465,10 @@ int gribReadSize(int fileID)
pdssize = gribsize; pdssize = gribsize;
fileSetPos(fileID, (off_t) 3, SEEK_CUR); fileSetPos(fileID, (off_t) 3, SEEK_CUR);
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("pdssize = %d", pdssize); Message("pdssize = %d", pdssize);
flag = filePtrGetc(fileptr); flag = filePtrGetc(fileptr);
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("flag = %d", flag); Message("flag = %d", flag);
fileSetPos(fileID, (off_t) pdssize-8, SEEK_CUR); fileSetPos(fileID, (off_t) pdssize-8, SEEK_CUR);
...@@ -5481,7 +5481,7 @@ int gribReadSize(int fileID) ...@@ -5481,7 +5481,7 @@ int gribReadSize(int fileID)
gdssize = (b1 << 16) + (b2 << 8) + b3; gdssize = (b1 << 16) + (b2 << 8) + b3;
fileSetPos(fileID, (off_t) gdssize-3, SEEK_CUR); fileSetPos(fileID, (off_t) gdssize-3, SEEK_CUR);
} }
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("gdssize = %d", gdssize); Message("gdssize = %d", gdssize);
if ( flag & 64 ) if ( flag & 64 )
...@@ -5492,7 +5492,7 @@ int gribReadSize(int fileID) ...@@ -5492,7 +5492,7 @@ int gribReadSize(int fileID)
bmssize = (b1 << 16) + (b2 << 8) + b3; bmssize = (b1 << 16) + (b2 << 8) + b3;
fileSetPos(fileID, (off_t) bmssize-3, SEEK_CUR); fileSetPos(fileID, (off_t) bmssize-3, SEEK_CUR);
} }
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("bmssize = %d", bmssize); Message("bmssize = %d", bmssize);
b1 = filePtrGetc(fileptr); b1 = filePtrGetc(fileptr);
...@@ -5500,7 +5500,7 @@ int gribReadSize(int fileID) ...@@ -5500,7 +5500,7 @@ int gribReadSize(int fileID)
b3 = filePtrGetc(fileptr); b3 = filePtrGetc(fileptr);
bdssize = (b1 << 16) + (b2 << 8) + b3; bdssize = (b1 << 16) + (b2 << 8) + b3;
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("bdssize = %d", bdssize); Message("bdssize = %d", bdssize);
gribsize = issize + pdssize + gdssize + bmssize + bdssize + essize; gribsize = issize + pdssize + gdssize + bmssize + bdssize + essize;
...@@ -5523,7 +5523,7 @@ int gribReadSize(int fileID) ...@@ -5523,7 +5523,7 @@ int gribReadSize(int fileID)
if ( filePtrEOF(fileptr) ) gribsize = 0; if ( filePtrEOF(fileptr) ) gribsize = 0;
if ( GRB_Debug ) if ( CGRIBEX_Debug )
Message("gribsize = %d", gribsize); Message("gribsize = %d", gribsize);
fileSetPos(fileID, pos, SEEK_SET); fileSetPos(fileID, pos, SEEK_SET);
...@@ -5552,7 +5552,7 @@ int gribGetSize(int fileID) ...@@ -5552,7 +5552,7 @@ int gribGetSize(int fileID)
recsize = gribReadSize(fileID); recsize = gribReadSize(fileID);
if ( GRB_Debug ) Message("recsize = %d", recsize); if ( CGRIBEX_Debug ) Message("recsize = %d", recsize);
fileSetPos(fileID, (off_t) -4, SEEK_CUR); fileSetPos(fileID, (off_t) -4, SEEK_CUR);
...@@ -6815,9 +6815,10 @@ C ---------------------------------------------------------------- ...@@ -6815,9 +6815,10 @@ C ----------------------------------------------------------------
C* Section 0 . Definition of variables. C* Section 0 . Definition of variables.
C ---------------------------------------------------------------- C ----------------------------------------------------------------
*/ */
char *hndbg, *hnvck, *envString; char *envString;
char *env_stream; char *env_stream;
static int lfirst = TRUE; static int lfirst = TRUE;
extern int CGRIBEX_Const;
if ( ! lfirst ) return; if ( ! lfirst ) return;
...@@ -6877,27 +6878,36 @@ C ---------------------------------------------------------------- ...@@ -6877,27 +6878,36 @@ C ----------------------------------------------------------------
*/ */
ndbg = 0; ndbg = 0;
hndbg = getenv("GRIBEX_DEBUG"); envString = getenv("GRIBEX_DEBUG");
if ( hndbg != NULL ) if ( envString != NULL )
{ {
if ( !strncmp(hndbg, "ON", 2) ) if ( !strncmp(envString, "ON", 2) )
ndbg = 1; ndbg = 1;
else if( *hndbg == '1') else if( *envString == '1')
ndbg = 1; ndbg = 1;
else if( *hndbg == '2') else if( *envString == '2')
ndbg = 2; ndbg = 2;
else else
ndbg = 0; ndbg = 0;
} }
/*
Set GRIBEX compatibility mode.
*/
envString = getenv("GRIB_GRIBEX_MODE_ON");
if ( envString != NULL )
{
if ( atoi(envString) == 1 ) CGRIBEX_Const = 0;
}
/* /*
Set GRIB value checking on. Set GRIB value checking on.
*/ */
nvck = 1; nvck = 1;
hnvck = getenv("GRIBEX_CHECK"); envString = getenv("GRIBEX_CHECK");
if ( hnvck ) if ( envString )
{ {
if ( !strncmp(hnvck, "OFF", 3) ) if ( !strncmp(envString, "OFF", 3) )
nvck = 0; nvck = 0;
else else
nvck = 1; nvck = 1;
...@@ -7512,7 +7522,7 @@ void ref2ibm(double *pref, int kbits) ...@@ -7512,7 +7522,7 @@ void ref2ibm(double *pref, int kbits)
static int itrnd; static int itrnd;
static int kexp, kmant; static int kexp, kmant;
static double ztemp, zdumm; static double ztemp, zdumm;
extern int GRB_Debug; extern int CGRIBEX_Debug;
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/* Section 1. Convert to and from IBM format. */ /* Section 1. Convert to and from IBM format. */
...@@ -7551,7 +7561,7 @@ void ref2ibm(double *pref, int kbits) ...@@ -7551,7 +7561,7 @@ void ref2ibm(double *pref, int kbits)
if ( ztemp < *pref ) if ( ztemp < *pref )
{ {
if ( GRB_Debug ) if ( CGRIBEX_Debug )
{ {
Message("Reference value error."); Message("Reference value error.");
Message("Notify Met.Applications Section."); Message("Notify Met.Applications Section.");
...@@ -9069,7 +9079,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu ...@@ -9069,7 +9079,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return (gribLen); return (gribLen);
} }
static const char grb_libvers[] = "1.4.7" " of ""Jan 25 2011"" ""12:07:17"; static const char grb_libvers[] = "1.5.0" " of ""Feb 15 2011"" ""10:23:39";
const char * const char *
cgribexLibraryVersion(void) cgribexLibraryVersion(void)
{ {
......
...@@ -113,8 +113,8 @@ void cdiInitialize(void) ...@@ -113,8 +113,8 @@ void cdiInitialize(void)
Init_CDI = TRUE; Init_CDI = TRUE;
#if defined (HAVE_LIBCGRIBEX) #if defined (HAVE_LIBCGRIBEX)
gribFixZSE(1); /* 1: Fix ZeroShiftError of simple packed spherical harmonics */ gribFixZSE(1); // 1: Fix ZeroShiftError of simple packed spherical harmonics
gribSetConst(1); /* 1: Don't pack constant fields on regular grids */ gribSetConst(1); // 1: Don't pack constant fields on regular grids
#endif #endif
value = cdiGetenvInt("CD_REGULARGRID"); value = cdiGetenvInt("CD_REGULARGRID");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment