Go to the documentation of this file.
43 g2int j, k, lensec2, iofst, ibeg, lencurr, ilen, len, istart;
64 gbit(cgrib, &ilen, iofst, 32);
66 gbit(cgrib, &isecnum, iofst, 8);
77 printf(
"g2_addlocal: Section byte counts don't add to total.\n");
78 printf(
"g2_addlocal: Sum of section byte counts = %ld\n", len);
79 printf(
"g2_addlocal: Total byte count in Section 0 = %ld\n", lencurr);
85 if (isecnum != 1 && isecnum != 7)
87 printf(
"g2_addlocal: Section 2 can only be added after Section 1 or Section 7.\n");
88 printf(
"g2_addlocal: Section %ld was the last found in given GRIB message.\n", isecnum);
95 sbit(cgrib, &two, iofst, 8);
98 for (j = istart; j < istart + lcsec2; j++)
99 cgrib[j] = csec2[k++];
103 lensec2 = lcsec2 + 5;
104 sbit(cgrib, &lensec2, ibeg, 32);
108 sbit(cgrib, &lencurr, 96, 32);
#define G2_BAD_SEC
Previous Section was unexpected.
Header file with internal function prototypes NCEPLIBS-g2c library.
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...
int64_t g2int
Long integer type.
g2int g2_addlocal(unsigned char *cgrib, unsigned char *csec2, g2int lcsec2)
This routine adds a Local Use Section (Section 2) to a GRIB2 message.
#define G2_BAD_SEC_COUNTS
Sum of Section byte counts doesn't add to total byte count.
#define G2_ADD_MSG_COMPLETE
GRIB message already complete.
#define G2C_MSG_COMPLETE
GRIB message already complete.
#define G2_ADD_MSG_INIT
GRIB message was not initialized - call g2_create() first.
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 G2C_NOT_GRIB
GRIB header not found.
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...