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

No commit message

No commit message
parent c4a23f1c
/* Generated automatically from m214003 on Wed Jan 2 12:09:11 CET 2008 */
/* Generated automatically from m214003 on Fri Jan 18 11:53:23 CET 2008 */
/* GRIBLIB_VERSION="1.1.0" */
......@@ -123,6 +123,7 @@ void gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
#define GET_INT3(a,b,c) ((1-(int) ((unsigned) (a & 128) >> 6)) * (int) (((a & 127) << 16)+(b<<8)+c))
#define GET_INT2(a,b) ((1-(int) ((unsigned) (a & 128) >> 6)) * (int) (((a & 127) << 8) + b))
#define GET_INT1(a) ((1-(int) ((unsigned) (a & 128) >> 6)) * (int) (a))
/* this requires a 32-bit default integer machine */
#define GET_UINT4(a,b,c,d) ((int) ((a << 24) + (b << 16) + (c << 8) + (d)))
......@@ -151,7 +152,7 @@ void gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
#define PDS_Level1 (pds[10])
#define PDS_Level2 (pds[11])
#define PDS_Level GET_UINT2(pds[10], pds[11])
#define PDS_Year GET_UINT1(pds[12])
#define PDS_Year GET_INT1(pds[12])
#define PDS_Month GET_UINT1(pds[13])
#define PDS_Day GET_UINT1(pds[14])
#define PDS_Hour GET_UINT1(pds[15])
......@@ -264,6 +265,7 @@ void gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
(lGrib[z++] = (Value) >> 8), \
(lGrib[z++] = (Value)))
#define Put1Int(Value) {ival = Value; if ( ival < 0 ) ival = 256 - ival; Put1Byte(ival);}
#define Put3Int(Value) {ival = Value; if ( ival < 0 ) ival = 8388608 - ival; Put3Byte(ival);}
#define Put1Real(Value) \
......@@ -2862,6 +2864,16 @@ void encodePDS(GRIBPACK *lpds, int pdsLen, int *isec1)
{
GRIBPACK *lGrib = lpds;
int z = 0;
int ival, century, year;
century = ISEC1_Century;
year = ISEC1_Year;
if ( century < 0 )
{
century = -century;
year = -year;
}
Put3Byte(pdsLen); /* 0 Length of Block 1 */
Put1Byte(ISEC1_CodeTable); /* 3 Local table number */
......@@ -2894,7 +2906,7 @@ void encodePDS(GRIBPACK *lpds, int pdsLen, int *isec1)
{
Put2Byte(ISEC1_Level1); /* 10 Level */
}
Put1Byte(ISEC1_Year); /* 12 Year of Century */
Put1Int(year); /* 12 Year of Century */
Put1Byte(ISEC1_Month); /* 13 Month */
Put1Byte(ISEC1_Day); /* 14 Day */
Put1Byte(ISEC1_Hour); /* 15 Hour */
......@@ -2935,7 +2947,7 @@ void encodePDS(GRIBPACK *lpds, int pdsLen, int *isec1)
}
Put1Byte(ISEC1_AvgMiss); /* 23 Missing from averages */
Put1Byte(ISEC1_Century); /* 24 Century */
Put1Byte(century); /* 24 Century */
Put1Byte(ISEC1_SubCenterID); /* 25 Subcenter */
Put2Byte(ISEC1_DecScaleFactor); /* 26 Decimal scale factor */
......@@ -3970,6 +3982,12 @@ static int decodePDS(unsigned char *pds, int *isec0, int *isec1)
ISEC1_DecScaleFactor = 0;
}
if ( ISEC1_Year < 0 )
{
ISEC1_Year = -ISEC1_Year;
ISEC1_Century = -ISEC1_Century;
}
ISEC1_LocalFLag = 0;
if ( pdsLen > 28 )
{
......@@ -8264,7 +8282,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return (gribLen);
}
static const char grb_libvers[] = "1.1.0" " of ""Jan 2 2008"" ""12:09:18";
static const char grb_libvers[] = "1.1.0" " of ""Jan 18 2008"" ""11:53:23";
......
......@@ -1470,7 +1470,7 @@ void gridDefMask(int gridID, int *mask)
if ( gridptr->mask == NULL )
gridptr->mask = (int *) malloc(size*sizeof(int));
else if ( CDI_Debug )
Warning(func, "mask allready defined!");
Warning(func, "mask already defined!");
for ( i = 0; i < size; i++ )
gridptr->mask[i] = mask[i];
......@@ -1564,7 +1564,7 @@ void gridDefXvals(int gridID, double *xvals)
if ( gridptr->xvals == NULL )
gridptr->xvals = (double *) malloc(size*sizeof(double));
else if ( CDI_Debug )
Warning(func, "values allready defined!");
Warning(func, "values already defined!");
for ( i = 0; i < size; i++ )
gridptr->xvals[i] = xvals[i];
......@@ -1658,7 +1658,7 @@ void gridDefYvals(int gridID, double *yvals)
if ( gridptr->yvals == NULL )
gridptr->yvals = (double *) malloc(size*sizeof(double));
else if ( CDI_Debug )
Warning(func, "Values allready defined!");
Warning(func, "Values already defined!");
for ( i = 0; i < size; i++ )
gridptr->yvals[i] = yvals[i];
......@@ -2639,7 +2639,7 @@ void gridDefArea(int gridID, double *area)
if ( gridptr->area == NULL )
gridptr->area = (double *) malloc(size*sizeof(double));
else if ( CDI_Debug )
Warning(func, "values allready defined!");
Warning(func, "values already defined!");
for ( i = 0; i < size; i++ ) gridptr->area[i] = area[i];
}
......@@ -2744,7 +2744,7 @@ void gridDefXbounds(int gridID, double *xbounds)
if ( gridptr->xbounds == NULL )
gridptr->xbounds = (double *) malloc(size*sizeof(double));
else if ( CDI_Debug )
Warning(func, "values allready defined!");
Warning(func, "values already defined!");
for ( i = 0; i < size; i++ )
gridptr->xbounds[i] = xbounds[i];
......@@ -2852,7 +2852,7 @@ void gridDefYbounds(int gridID, double *ybounds)
if ( gridptr->ybounds == NULL )
gridptr->ybounds = (double *) malloc(size*sizeof(double));
else if ( CDI_Debug )
Warning(func, "values allready defined!");
Warning(func, "values already defined!");
for ( i = 0; i < size; i++ )
gridptr->ybounds[i] = ybounds[i];
......
......@@ -1877,7 +1877,7 @@ void streamDefVlist(int streamID, int vlistID)
}
else
{
Warning(func, "vlist allready defined for %s!", streamptr->filename);
Warning(func, "vlist already defined for %s!", streamptr->filename);
}
}
......
......@@ -1021,7 +1021,7 @@ void zaxisDefVct(int zaxisID, int size, const double *vct)
}
else
if ( zaxisptr->vctsize != size )
Warning(func, "VCT was allready defined");
Warning(func, "VCT was already defined");
}
......@@ -1064,7 +1064,7 @@ void zaxisDefLbounds(int zaxisID, double *lbounds)
size = zaxisptr->size;
if ( zaxisptr->lbounds != NULL )
Warning(func, "Lbounds allready defined for zaxisID = %d", zaxisID);
Warning(func, "Lbounds already defined for zaxisID = %d", zaxisID);
zaxisptr->lbounds = (double *) malloc(size*sizeof(double));
memcpy(zaxisptr->lbounds, lbounds, size*sizeof(double));
......@@ -1084,7 +1084,7 @@ void zaxisDefUbounds(int zaxisID, double *ubounds)
size = zaxisptr->size;
if ( zaxisptr->ubounds != NULL )
Warning(func, "Ubounds allready defined for zaxisID = %d", zaxisID);
Warning(func, "Ubounds already defined for zaxisID = %d", zaxisID);
zaxisptr->ubounds = (double *) malloc(size*sizeof(double));
memcpy(zaxisptr->ubounds, ubounds, size*sizeof(double));
......@@ -1104,7 +1104,7 @@ void zaxisDefWeights(int zaxisID, double *weights)
size = zaxisptr->size;
if ( zaxisptr->weights != NULL )
Warning(func, "Weights allready defined for zaxisID = %d", zaxisID);
Warning(func, "Weights already defined for zaxisID = %d", zaxisID);
zaxisptr->weights = (double *) malloc(size*sizeof(double));
memcpy(zaxisptr->weights, weights, size*sizeof(double));
......
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