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)
# include "config.h"
......@@ -136,7 +136,7 @@ int cdiEncodeTime(int hour, int minute, int second);
extern FILE *grprsm;
extern int GRB_Debug;
extern int CGRIBEX_Debug;
void gprintf(const char *caller, const char *fmt, ...);
......@@ -699,7 +699,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
double zref, zeps;
int iexp, isign;
int iround;
extern int GRB_Debug;
extern int CGRIBEX_Debug;
extern double _pow16tab[71];
/* ----------------------------------------------------------------- */
......@@ -860,7 +860,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
LABEL900:
if ( GRB_Debug )
if ( CGRIBEX_Debug )
{
Message("Conversion type parameter = %4d", kround);
Message("Original number = %30.20f", pval);
......@@ -945,14 +945,14 @@ double decfp2(int kexp, int kmant)
double pval;
int iexp, isign;
extern int GRB_Debug;
extern int CGRIBEX_Debug;
extern double _pow16tab[71];
/* ----------------------------------------------------------------- */
/* 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 )
*/
......@@ -996,7 +996,7 @@ double decfp2(int kexp, int kmant)
LABEL900:
if ( GRB_Debug ) Message("Returned value = %f", pval);
if ( CGRIBEX_Debug ) Message("Returned value = %f", pval);
return (pval);
} /* decfp2 */
......@@ -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 GRB_Const = 0; /* 1: Don't pack constant fields on regular grids */
int GRB_Debug = 0; /* 1: Debugging */
int CGRIBEX_Fix_ZSE = 0; /* 1: Fix ZeroShiftError of simple packed spherical harmonics */
int CGRIBEX_Const = 0; /* 1: Don't pack constant fields on regular grids */
int CGRIBEX_Debug = 0; /* 1: Debugging */
void gribSetDebug(int debug)
{
GRB_Debug = debug;
CGRIBEX_Debug = debug;
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("debug level %d", debug);
}
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);
}
void gribSetConst(int flag)
{
GRB_Const = flag;
CGRIBEX_Const = flag;
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("Const set to %d", flag);
}
......@@ -3530,7 +3530,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise
/* of floating point numbers - needed */
/* on some platforms (eg vpp700, linux) */
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 )
{
......@@ -3645,7 +3645,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise
zref = fmin;
if ( GRB_Const && !lspherc )
if ( CGRIBEX_Const && !lspherc )
{
if ( IS_EQUAL(fmin, fmax) ) nbpv = 0;
}
......@@ -4562,7 +4562,7 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4,
double fmin = 0., zscale = 0.;
double *fpdata = fsec4;
int bdsLen;
extern int GRB_Fix_ZSE;
extern int CGRIBEX_Fix_ZSE;
*iret = 0;
igrib = bds;
......@@ -4800,7 +4800,7 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4,
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 )
{
/* 20100705: Fix ZeroShiftError - Edi Kirk */
......@@ -5241,7 +5241,7 @@ int gribCheckFiletype(int fileID)
if ( memcmp(buffer, "GRIB", 4) == 0 )
{
found = 1;
if ( GRB_Debug ) Message("found GRIB file = %s", fileInqName(fileID));
if ( CGRIBEX_Debug ) Message("found GRIB file = %s", fileInqName(fileID));
}
else
{
......@@ -5252,7 +5252,7 @@ int gribCheckFiletype(int fileID)
if ( !ierr )
{
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)
buffer[i+2] == 'I' &&
buffer[i+3] == 'B')
{
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset);
return (0);
}
......@@ -5325,7 +5325,7 @@ int gribFileSeekOld(int fileID, long *offset)
buffer[3] = buffer[i+3];
}
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset);
return (1);
......@@ -5354,7 +5354,7 @@ int gribFileSeek(int fileID, long *offset)
if ( code == GRIB )
{
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset);
return (0);
}
......@@ -5362,7 +5362,7 @@ int gribFileSeek(int fileID, long *offset)
(*offset)++;
}
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset);
return (1);
......@@ -5401,7 +5401,7 @@ int gribFileSeekTest(int fileID, long *offset)
if ( code == GRIB )
{
/* printf("end: %d %d\n", nread, i); */
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset);
if ( i != nread ) fileSetPos(fileID, (off_t) i-nread, SEEK_CUR);
......@@ -5412,7 +5412,7 @@ int gribFileSeekTest(int fileID, long *offset)
(*offset)++;
}
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("record offset = %d", (int) *offset);
return (1);
......@@ -5454,7 +5454,7 @@ int gribReadSize(int fileID)
if ( gribversion != 1 && gribversion != 2 ) gribversion = 0;
}
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("gribversion = %d", gribversion);
if ( gribversion == 0 )
......@@ -5465,10 +5465,10 @@ int gribReadSize(int fileID)
pdssize = gribsize;
fileSetPos(fileID, (off_t) 3, SEEK_CUR);
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("pdssize = %d", pdssize);
flag = filePtrGetc(fileptr);
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("flag = %d", flag);
fileSetPos(fileID, (off_t) pdssize-8, SEEK_CUR);
......@@ -5481,7 +5481,7 @@ int gribReadSize(int fileID)
gdssize = (b1 << 16) + (b2 << 8) + b3;
fileSetPos(fileID, (off_t) gdssize-3, SEEK_CUR);
}
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("gdssize = %d", gdssize);
if ( flag & 64 )
......@@ -5492,7 +5492,7 @@ int gribReadSize(int fileID)
bmssize = (b1 << 16) + (b2 << 8) + b3;
fileSetPos(fileID, (off_t) bmssize-3, SEEK_CUR);
}
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("bmssize = %d", bmssize);
b1 = filePtrGetc(fileptr);
......@@ -5500,7 +5500,7 @@ int gribReadSize(int fileID)
b3 = filePtrGetc(fileptr);
bdssize = (b1 << 16) + (b2 << 8) + b3;
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("bdssize = %d", bdssize);
gribsize = issize + pdssize + gdssize + bmssize + bdssize + essize;
......@@ -5523,7 +5523,7 @@ int gribReadSize(int fileID)
if ( filePtrEOF(fileptr) ) gribsize = 0;
if ( GRB_Debug )
if ( CGRIBEX_Debug )
Message("gribsize = %d", gribsize);
fileSetPos(fileID, pos, SEEK_SET);
......@@ -5552,7 +5552,7 @@ int gribGetSize(int 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);
......@@ -6815,9 +6815,10 @@ C ----------------------------------------------------------------
C* Section 0 . Definition of variables.
C ----------------------------------------------------------------
*/
char *hndbg, *hnvck, *envString;
char *envString;
char *env_stream;
static int lfirst = TRUE;
extern int CGRIBEX_Const;
if ( ! lfirst ) return;
......@@ -6877,27 +6878,36 @@ C ----------------------------------------------------------------
*/
ndbg = 0;
hndbg = getenv("GRIBEX_DEBUG");
if ( hndbg != NULL )
envString = getenv("GRIBEX_DEBUG");
if ( envString != NULL )
{
if ( !strncmp(hndbg, "ON", 2) )
if ( !strncmp(envString, "ON", 2) )
ndbg = 1;
else if( *hndbg == '1')
else if( *envString == '1')
ndbg = 1;
else if( *hndbg == '2')
else if( *envString == '2')
ndbg = 2;
else
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.
*/
nvck = 1;
hnvck = getenv("GRIBEX_CHECK");
if ( hnvck )
envString = getenv("GRIBEX_CHECK");
if ( envString )
{
if ( !strncmp(hnvck, "OFF", 3) )
if ( !strncmp(envString, "OFF", 3) )
nvck = 0;
else
nvck = 1;
......@@ -7512,7 +7522,7 @@ void ref2ibm(double *pref, int kbits)
static int itrnd;
static int kexp, kmant;
static double ztemp, zdumm;
extern int GRB_Debug;
extern int CGRIBEX_Debug;
/* ----------------------------------------------------------------- */
/* Section 1. Convert to and from IBM format. */
......@@ -7551,7 +7561,7 @@ void ref2ibm(double *pref, int kbits)
if ( ztemp < *pref )
{
if ( GRB_Debug )
if ( CGRIBEX_Debug )
{
Message("Reference value error.");
Message("Notify Met.Applications Section.");
......@@ -9069,7 +9079,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
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 *
cgribexLibraryVersion(void)
{
......
......@@ -113,8 +113,8 @@ void cdiInitialize(void)
Init_CDI = TRUE;
#if defined (HAVE_LIBCGRIBEX)
gribFixZSE(1); /* 1: Fix ZeroShiftError of simple packed spherical harmonics */
gribSetConst(1); /* 1: Don't pack constant fields on regular grids */
gribFixZSE(1); // 1: Fix ZeroShiftError of simple packed spherical harmonics
gribSetConst(1); // 1: Don't pack constant fields on regular grids
#endif
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