28 unsigned char G = 0x47;
29 unsigned char R = 0x52;
30 unsigned char I = 0x49;
31 unsigned char B = 0x42;
32 unsigned char seven = 0x37;
34 assert(cgrib && lencurr);
37 if (cgrib[0] != G || cgrib[1] != R || cgrib[2] != I || cgrib[3] != B)
40 printf(
"GRIB not found in given message. A call to routine g2_create() "
41 "is required to to initialize GRIB messge.\n");
46 gbit(cgrib, lencurr, 96, 32);
49 if (cgrib[*lencurr - 4] == seven && cgrib[*lencurr - 3] == seven &&
50 cgrib[*lencurr - 2] == seven && cgrib[*lencurr - 1] == seven)
53 printf(
"GRIB message already complete. Cannot add new section.\n");
81g2_log(
int severity,
const char *fmt, ...)
89 if (severity > g2_log_level)
95 fprintf(f,
"ERROR: ");
96 for (t = 0; t < severity; t++)
101 vfprintf(f, fmt, argp);
133 g2_log_level = new_level;
135 LOG((1,
"log_level changed to %d", g2_log_level));
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 ...
#define G2C_ENOTGRIB
GRIB header not found.
#define G2C_EMSGCOMPLETE
GRIB message already complete.
int64_t g2int
Long integer type.
#define G2C_NOERROR
No error.
Header file with internal function prototypes NCEPLIBS-g2c library.
#define LOG(e)
Ignore logging to stdout.
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...
int g2c_set_log_level(int new_level)
Use this to set the global log level.