28 g2c_get_prod(
int g2cid,
int msg_num,
int prod_num,
int *num_data_points,
float *data)
42 if (msg_num < 0 || prod_num < 0)
56 for (sec4 = msg->
sec; sec4; sec4 = sec4->
next)
65 for (sec3 = sec4; sec3; sec3 = sec3->
prev)
75 for (sec5 = sec4; sec5; sec5 = sec5->
next)
83 for (sec7 = sec5; sec7; sec7 = sec7->
next)
98 if (!(buf = malloc(
sizeof(
char) * sec7->
sec_len)))
int g2c_unpack7(unsigned char *cgrib, int igdsnum, int gds_tmpl_len, long long int *gdstmpl, int idrsnum, int drs_tmpl_len, long long int *drstmpl, int ndpts, float *fld)
This subroutine unpacks Section 7 (Data Section) of a GRIB2 message.
G2C_FILE_INFO_T g2c_file[G2C_MAX_FILES+1]
Global file information.
int g2c_get_prod(int g2cid, int msg_num, int prod_num, int *num_data_points, float *data)
Read the data for a product.
#define G2C_MAX_FILES
Maximum number of open files.
#define G2C_ENOMSG
No GRIB message found.
#define G2C_ENOSECTION
Cannot find section.
#define G2C_EFILE
File I/O error.
#define G2C_ENOMEM
Out of memory.
#define G2C_ERROR
General error code, returned for some test errors.
#define G2C_ENOPRODUCT
Product not found.
#define G2C_EINVAL
Invalid input.
#define G2C_EBADID
Bad ID.
#define G2C_NOERROR
No error.
Header file with internal function prototypes NCEPLIBS-g2c library.
struct g2c_section_info * next
Pointer to next in list.
struct g2c_section_info * sec
List of section metadata.
unsigned short grid_def
Grid definition template number (= N) (See Table 3.1).
struct g2c_section_info * prev
Pointer to previous in list.
unsigned char sec_num
Section number.
unsigned int num_data_points
Number of data points where one or more values are specified in Section 7 when a bit map is present,...
void * sec_info
Pointer to struct specific for section 3, 4, 5, 6, or 7.
unsigned int sec_len
Length of the section (in bytes).
size_t bytes_to_sec
Number of bytes from start of message to this section.
FILE * f
FILE pointer to open file.
int template_len
Number of entries in template.
size_t msg_num
Number of message in file (0-based).
unsigned short data_def
Data representation template number (See Table 5.0).
size_t bytes_to_msg
Number of bytes to skip in the file, to get to this message.
long long int * template
Grid, product, or data template.
struct g2c_message_info * next
Pointer to next in list.
G2C_MESSAGE_INFO_T * msg
Pointer to contianing message.
This is the information about each open file.
This is the information about each message.
Information about Section 3 GRID DEFINITION SECTION.
Information about Section 4 PRODUCT DEFINITION SECTION.
Information about Section 5 DATA REPRESENTATION SECTION.
Information about a section 3 through 7 in a GRIB2 message.