39 g2int iofst, lencurr, len, ilen, isecnum;
41 unsigned char seven = 0x37;
61 gbit(cgrib, &ilen, iofst, 32);
63 gbit(cgrib, &isecnum, iofst, 8);
74 printf(
"g2_gribend: Section byte counts don''t add to total.\n");
75 printf(
"g2_gribend: Sum of section byte counts = %d\n", (
int)len);
76 printf(
"g2_gribend: Total byte count in Section 0 = %d\n", (
int)lencurr);
84 printf(
"g2_gribend: Section 8 can only be added after Section 7.\n");
85 printf(
"g2_gribend: Section %ld was the last found in given GRIB message.\n", isecnum);
90 cgrib[lencurr] = seven;
91 cgrib[lencurr + 1] = seven;
92 cgrib[lencurr + 2] = seven;
93 cgrib[lencurr + 3] = seven;
96 lengrib = lencurr + 4;
97 sbit(cgrib, &lengrib, 96, 32);
g2int g2_gribend(unsigned char *cgrib)
This routine finalizes a GRIB2 message after all grids and fields have been added.
void gbit(unsigned char *in, g2int *iout, g2int iskip, g2int nbits)
Get bits - unpack bits: Extract arbitrary size values from a packed bit string, right justifying each...
void sbit(unsigned char *out, g2int *in, g2int iskip, g2int nbits)
Store bits - put arbitrary size values into a packed bit string, taking the low order bits from each ...
#define G2_BAD_SEC_COUNTS
Sum of Section byte counts doesn't add to total byte count.
#define G2_BAD_SEC
Previous Section was unexpected.
#define G2_ADD_MSG_COMPLETE
GRIB message already complete.
#define G2_ADD_MSG_INIT
GRIB message was not initialized - call g2_create() first.
#define G2C_ENOTGRIB
GRIB header not found.
#define G2C_EMSGCOMPLETE
GRIB message already complete.
int64_t g2int
Long integer type.
Header file with internal function prototypes NCEPLIBS-g2c library.
int g2c_check_msg(unsigned char *cgrib, g2int *lencurr, int verbose)
Check for 'GRIB' at the beginning of a GRIB message, and check to see if the message is already termi...