Commit 34d3ac5e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cgribexlib update

parent 2666665f
/* Automatically generated by m214003 at 2013-02-12, do not edit */ /* Automatically generated by m214003 at 2013-02-26, do not edit */
/* CGRIBEXLIB_VERSION="1.6.0" */ /* CGRIBEXLIB_VERSION="1.6.0" */
...@@ -366,7 +366,7 @@ void gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3, ...@@ -366,7 +366,7 @@ void gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
#include <math.h> #include <math.h>
double _pow2tab[158] = { const double const _pow2tab[158] = {
/* pow(2.0, 0.0) */ 1.0, /* pow(2.0, 0.0) */ 1.0,
/* pow(2.0, 1.0) */ 2.0, /* pow(2.0, 1.0) */ 2.0,
/* pow(2.0, 2.0) */ 4.0, /* pow(2.0, 2.0) */ 4.0,
...@@ -528,7 +528,7 @@ double _pow2tab[158] = { ...@@ -528,7 +528,7 @@ double _pow2tab[158] = {
}; };
double _pow16tab[71] = { const double const _pow16tab[71] = {
/* pow(16.0, 0.0) */ 1.0, /* pow(16.0, 0.0) */ 1.0,
/* pow(16.0, 1.0) */ 16.0, /* pow(16.0, 1.0) */ 16.0,
/* pow(16.0, 2.0) */ 256.0, /* pow(16.0, 2.0) */ 256.0,
...@@ -1485,13 +1485,15 @@ void encode_double_array_unrolled(int numBits, size_t packStart, size_t datasize ...@@ -1485,13 +1485,15 @@ void encode_double_array_unrolled(int numBits, size_t packStart, size_t datasize
#else #else
#define __UNROLL_DEPTH_2 8 #define __UNROLL_DEPTH_2 8
#endif #endif
size_t residual = datasize % __UNROLL_DEPTH_2; size_t residual;
size_t ofs = datasize - residual; size_t ofs;
double dval[__UNROLL_DEPTH_2]; double dval[__UNROLL_DEPTH_2];
unsigned long ival; unsigned long ival;
data += packStart; data += packStart;
datasize -= packStart; datasize -= packStart;
residual = datasize % __UNROLL_DEPTH_2;
ofs = datasize - residual;
// reducing FP operations to single FMA is slowing down on pwr6 ... // reducing FP operations to single FMA is slowing down on pwr6 ...
...@@ -2227,12 +2229,12 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround) ...@@ -2227,12 +2229,12 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
- replace 1.0 / pow(16.0, (double)(iexp - 70)) by rpow16m70tab[iexp] - replace 1.0 / pow(16.0, (double)(iexp - 70)) by rpow16m70tab[iexp]
*/ */
double zval, rpowref; double rpowref;
double zref, zeps; double zref, zeps;
int iexp, isign; int iexp, isign;
int iround; int iround;
extern int CGRIBEX_Debug; // extern int CGRIBEX_Debug;
extern double _pow16tab[71]; extern const double const _pow16tab[71];
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/* Section 1 . Initialise */ /* Section 1 . Initialise */
...@@ -2391,19 +2393,20 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround) ...@@ -2391,19 +2393,20 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
LABEL900: LABEL900:
/*
if ( CGRIBEX_Debug ) if ( CGRIBEX_Debug )
{ {
double zval;
Message("Conversion type parameter = %4d", kround); Message("Conversion type parameter = %4d", kround);
Message("Original number = %30.20f", pval); Message("Original number = %30.20f", pval);
zval = decfp2(*kexp, *kmant); zval = decfp2(*kexp, *kmant);
Message("Converted to %30.20f", zval); Message("Converted to %30.20f", zval);
Message("Sign = %3d, Exponent = %3d, Mantissa = %12d", Message("Sign = %3d, Exponent = %3d, Mantissa = %12d", isign, iexp, *kmant);
isign, iexp, *kmant);
} }
*/
return; return;
} /* confp3 */ } /* confp3 */
...@@ -2477,14 +2480,14 @@ double decfp2(int kexp, int kmant) ...@@ -2477,14 +2480,14 @@ double decfp2(int kexp, int kmant)
double pval; double pval;
int iexp, isign; int iexp, isign;
extern int CGRIBEX_Debug; //extern int CGRIBEX_Debug;
extern double _pow16tab[71]; extern const double const _pow16tab[71];
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/* Section 1 . Convert value of 0.0. Ignore sign bit. */ /* Section 1 . Convert value of 0.0. Ignore sign bit. */
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
if ( CGRIBEX_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 )
*/ */
...@@ -2528,7 +2531,7 @@ double decfp2(int kexp, int kmant) ...@@ -2528,7 +2531,7 @@ double decfp2(int kexp, int kmant)
LABEL900: LABEL900:
if ( CGRIBEX_Debug ) Message("Returned value = %f", pval); //if ( CGRIBEX_Debug ) Message("Returned value = %f", pval);
return (pval); return (pval);
} /* decfp2 */ } /* decfp2 */
...@@ -4959,7 +4962,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise ...@@ -4959,7 +4962,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise
double jpepsln = 1.0e-12; /* -----> tolerance used to check equality */ double jpepsln = 1.0e-12; /* -----> tolerance used to check equality */
/* 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 const double const _pow2tab[158];
extern int CGRIBEX_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 )
...@@ -6099,7 +6102,7 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, ...@@ -6099,7 +6102,7 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4,
if ( lspherc && !lcomplex ) if ( lspherc && !lcomplex )
{ {
/* 20100705: Fix ZeroShiftError - Edi Kirk */ /* 20100705: Fix ZeroShiftError - Edi Kirk */
if ( fsec4[1] != 0.0 ) if ( IS_NOT_EQUAL(fsec4[1], 0.0) )
{ {
double zserr = fsec4[1]; double zserr = fsec4[1];
for ( i = 1; i < ISEC4_NumValues; i++ ) fsec4[i] -= zserr; for ( i = 1; i < ISEC4_NumValues; i++ ) fsec4[i] -= zserr;
...@@ -7056,7 +7059,7 @@ double calculate_pfactor(const double* spectralField, long fieldTruncation, long ...@@ -7056,7 +7059,7 @@ double calculate_pfactor(const double* spectralField, long fieldTruncation, long
for( loop = ismin; loop <= ismax; loop++ ) { for( loop = ismin; loop <= ismax; loop++ ) {
norms[n] = norms[n] > zeps ? norms[n] : zeps; norms[n] = norms[n] > zeps ? norms[n] : zeps;
if( norms[n] == zeps ) weights[n] = 100.0 * zeps; if( IS_EQUAL(norms[n], zeps) ) weights[n] = 100.0 * zeps;
} }
/* /*
...@@ -9365,7 +9368,7 @@ void grib1PrintALL(int nrec, long offset, long recpos, long recsize, unsigned ch ...@@ -9365,7 +9368,7 @@ void grib1PrintALL(int nrec, long offset, long recpos, long recsize, unsigned ch
bdslen = BDS_Len; bdslen = BDS_Len;
bdslen = correct_bdslen(bdslen, recsize, bds-gribbuffer); bdslen = correct_bdslen(bdslen, recsize, bds-gribbuffer);
if ( ((BDS_Flag >> 4)&1) && BDS_Z == 128 ) if ( ((BDS_Flag >> 4)&1) && (BDS_Z == 128 || BDS_Z == 130) )
{ {
int s1, s2; int s1, s2;
s1 = gribrec_len(bds[14], bds[15], bds[16]); s1 = gribrec_len(bds[14], bds[15], bds[16]);
...@@ -9768,7 +9771,7 @@ void gribCheck1(int nrec, long recpos, long recsize, unsigned char *gribbuffer) ...@@ -9768,7 +9771,7 @@ void gribCheck1(int nrec, long recpos, long recsize, unsigned char *gribbuffer)
cr = ((double)s1)/s2; cr = ((double)s1)/s2;
} }
if ( cr == 1 && BDS_NumBits == 24 ) if ( IS_EQUAL(cr, 1) && BDS_NumBits == 24 )
{ {
fprintf(stdout, "GRIB record %5d : code = %4d level = %7d\n", nrec, PDS_Parameter, level); fprintf(stdout, "GRIB record %5d : code = %4d level = %7d\n", nrec, PDS_Parameter, level);
} }
...@@ -10113,7 +10116,10 @@ int gribZip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufs ...@@ -10113,7 +10116,10 @@ int gribZip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufs
status = aec_buffer_encode(&strm); status = aec_buffer_encode(&strm);
if ( status != AEC_OK ) if ( status != AEC_OK )
Warning("AEC ERROR: %d code %3d level %3d", status, PDS_Parameter, PDS_Level2); {
if ( status != AEC_DATA_ERROR )
Warning("AEC ERROR: %d code %3d level %3d", status, PDS_Parameter, PDS_Level2);
}
destLen = strm.total_out; destLen = strm.total_out;
#else #else
...@@ -10391,7 +10397,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu ...@@ -10391,7 +10397,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
strm.avail_out = tmpLen; strm.avail_out = tmpLen;
status = aec_buffer_decode(&strm); status = aec_buffer_decode(&strm);
if (status != AEC_OK) if ( status != AEC_OK )
Warning("AEC ERROR: %d code %3d level %3d", status, PDS_Parameter, PDS_Level2); Warning("AEC ERROR: %d code %3d level %3d", status, PDS_Parameter, PDS_Level2);
tmpLen = strm.total_out; tmpLen = strm.total_out;
...@@ -10503,7 +10509,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu ...@@ -10503,7 +10509,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return (gribLen); return (gribLen);
} }
static const char grb_libvers[] = "1.6.0" " of ""Feb 12 2013"" ""09:17:09"; static const char grb_libvers[] = "1.6.0" " of ""Feb 26 2013"" ""12:10:29";
const char * const char *
cgribexLibraryVersion(void) cgribexLibraryVersion(void)
{ {
......
Supports Markdown
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