41 g2int iofst, lencurr, len, ilen, isecnum;
43 unsigned char seven = 0x37;
63 gbit(cgrib, &ilen, iofst, 32);
65 gbit(cgrib, &isecnum, iofst, 8);
76 printf(
"g2_gribend: Section byte counts don''t add to total.\n");
77 printf(
"g2_gribend: Sum of section byte counts = %d\n", (
int)len);
78 printf(
"g2_gribend: Total byte count in Section 0 = %d\n", (
int)lencurr);
86 printf(
"g2_gribend: Section 8 can only be added after Section 7.\n");
87 printf(
"g2_gribend: Section %ld was the last found in given GRIB message.\n", isecnum);
92 cgrib[lencurr] = seven;
93 cgrib[lencurr + 1] = seven;
94 cgrib[lencurr + 2] = seven;
95 cgrib[lencurr + 3] = seven;
98 lengrib = lencurr + 4;
99 sbit(cgrib, &lengrib, 96, 32);
g2int g2_gribend(unsigned char *cgrib)
Finalize a GRIB2 message after all grids and fields have been added.
void gbit(unsigned char *in, g2int *iout, g2int iskip, g2int nbits)
Get arbitrary size values from a packed bit string, right justifying each value in the unpacked iout ...
void sbit(unsigned char *out, g2int *in, g2int iskip, g2int nbits)
Store arbitrary size values into a packed bit string, taking the low order bits from each value in th...
#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...