.TH "g2cindex.c" 3 "Version 2.2.0" "NCEPLIBS-g2c" \" -*- nroff -*-
.ad l
.nh
.SH NAME
g2cindex.c \- Write summary output to an index file, as is done by utility grb2index\&.  

.SH SYNOPSIS
.br
.PP
\fC#include 'grib2_int\&.h'\fP
.br
\fC#include <libgen\&.h>\fP
.br
\fC#include <stdarg\&.h>\fP
.br
\fC#include <time\&.h>\fP
.br

.SS "Macros"

.in +1c
.ti -1c
.RI "#define \fBG2C_INDEX_BASENAME_LEN\fP   40"
.br
.RI "Length of the basename in header record 2\&. "
.ti -1c
.RI "#define \fBG2C_INDEX_BITMAP_BYTES\fP   6"
.br
.RI "Length of bitmap section included in the index record\&. "
.ti -1c
.RI "#define \fBG2C_INDEX_DATE_STR_LEN\fP   10"
.br
.RI "Length of date string in index record\&. "
.ti -1c
.RI "#define \fBG2C_INDEX_FIXED_LEN\fP   44"
.br
.RI "Length of beginning of index record\&. "
.ti -1c
.RI "#define \fBG2C_INDEX_FIXED_LEN_2\fP   48"
.br
.RI "Length of beginning of index record for large files\&. "
.ti -1c
.RI "#define \fBG2C_INDEX_HEADER_LEN\fP   81"
.br
.RI "Length of the two header lines at the top of the index file\&. "
.ti -1c
.RI "#define \fBG2C_INDEX_STR1_LEN\fP   7"
.br
.RI "Length of str1 string in index record\&. "
.ti -1c
.RI "#define \fBG2C_INDEX_TIME_STR_LEN\fP   8"
.br
.RI "Length of time string in index record\&. "
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "\fBEXTERN_MUTEX\fP (m)"
.br
.RI "Use externally-defined mutex for thread-safety\&. "
.ti -1c
.RI "int \fBg2c_get_prod_sections\fP (\fBG2C_MESSAGE_INFO_T\fP *msg, int fieldnum, \fBG2C_SECTION_INFO_T\fP **sec3, \fBG2C_SECTION_INFO_T\fP **sec4, \fBG2C_SECTION_INFO_T\fP **sec5, \fBG2C_SECTION_INFO_T\fP **sec6, \fBG2C_SECTION_INFO_T\fP **sec7)"
.br
.RI "Given a pointer to a message, and a field number, return pointers to all relevent section structs for that product\&. "
.ti -1c
.RI "int \fBg2c_open_index\fP (const char *data_file, const char *index_file, int mode, int *g2cid)"
.br
.RI "Open a GRIB2 file with the help of an index file\&. "
.ti -1c
.RI "int \fBg2c_open_index1\fP (const char *index_file)"
.br
.RI "Open a GRIB1 index file and read the contents\&. "
.ti -1c
.RI "int \fBg2c_start_index1_record\fP (FILE *f, int rw_flag, unsigned int *b2_msg, unsigned int *b2_pds, unsigned int *b2_gds, unsigned int *b2_bms, unsigned int *b2_bds, unsigned int *msglen, unsigned char *version, unsigned char *pds_val, unsigned char *gds_val, unsigned char *bms_val, unsigned char *bds_val, unsigned char *pds_val2, unsigned char *pds_val3, unsigned char *gds_val2)"
.br
.RI "Read or write the start of a version 1 index record\&. "
.ti -1c
.RI "int \fBg2c_start_index_record\fP (FILE *f, int rw_flag, int *reclen, int *msg, int *local, int *gds, int *pds, int *drs, int *bms, int *data, size_t *msglen, unsigned char *version, unsigned char *discipline, short *fieldnum)"
.br
.RI "Read or write the start of a version 2 index record\&. "
.ti -1c
.RI "int \fBg2c_start_index_record_lf\fP (FILE *f, int rw_flag, int *reclen, size_t *msg, size_t *local, size_t *gds, size_t *pds, size_t *drs, size_t *bms, size_t *data, size_t *msglen, unsigned char *version, unsigned char *discipline, short *fieldnum)"
.br
.RI "Read or write the start of a version 2 index record\&. "
.ti -1c
.RI "int \fBg2c_write_index\fP (int g2cid, int mode, const char *index_file)"
.br
.RI "Create an index file from a GRIB2 file, just like those created by the grb2index utility\&. "
.ti -1c
.RI "static int \fBread_hdr_rec1\fP (FILE *f, int *ip, int *jp, int *kp, char *date_str, char *time_str)"
.br
.RI "Read the header record apparently named after Steve Lord\&. "
.ti -1c
.RI "static int \fBread_hdr_rec2\fP (FILE *f, int *skipp, int *total_lenp, int *num_recp, char *basename, int *index_version)"
.br
.RI "Read the second header record of an index file\&. "
.in -1c
.SS "Variables"

.in +1c
.ti -1c
.RI "\fBG2C_FILE_INFO_T\fP \fBg2c_file\fP [\fBG2C_MAX_FILES\fP+1]"
.br
.RI "Global file information\&. "
.in -1c
.SH "Detailed Description"
.PP 
Write summary output to an index file, as is done by utility grb2index\&. 


.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
10/12/22 
.RE
.PP

.PP
Definition in file \fBg2cindex\&.c\fP\&.
.SH "Macro Definition Documentation"
.PP 
.SS "#define G2C_INDEX_BASENAME_LEN   40"

.PP
Length of the basename in header record 2\&. 
.PP
Definition at line \fB20\fP of file \fBg2cindex\&.c\fP\&.
.SS "#define G2C_INDEX_BITMAP_BYTES   6"

.PP
Length of bitmap section included in the index record\&. 
.PP
Definition at line \fB23\fP of file \fBg2cindex\&.c\fP\&.
.SS "#define G2C_INDEX_DATE_STR_LEN   10"

.PP
Length of date string in index record\&. 
.PP
Definition at line \fB32\fP of file \fBg2cindex\&.c\fP\&.
.SS "#define G2C_INDEX_FIXED_LEN   44"

.PP
Length of beginning of index record\&. 
.PP
Definition at line \fB26\fP of file \fBg2cindex\&.c\fP\&.
.SS "#define G2C_INDEX_FIXED_LEN_2   48"

.PP
Length of beginning of index record for large files\&. 
.PP
Definition at line \fB29\fP of file \fBg2cindex\&.c\fP\&.
.SS "#define G2C_INDEX_HEADER_LEN   81"

.PP
Length of the two header lines at the top of the index file\&. 
.PP
Definition at line \fB17\fP of file \fBg2cindex\&.c\fP\&.
.SS "#define G2C_INDEX_STR1_LEN   7"

.PP
Length of str1 string in index record\&. 
.PP
Definition at line \fB38\fP of file \fBg2cindex\&.c\fP\&.
.SS "#define G2C_INDEX_TIME_STR_LEN   8"

.PP
Length of time string in index record\&. 
.PP
Definition at line \fB35\fP of file \fBg2cindex\&.c\fP\&.
.SH "Function Documentation"
.PP 
.SS "EXTERN_MUTEX (m)"

.PP
Use externally-defined mutex for thread-safety\&. 
.SS "int g2c_get_prod_sections (\fBG2C_MESSAGE_INFO_T\fP * msg, int fieldnum, \fBG2C_SECTION_INFO_T\fP ** sec3, \fBG2C_SECTION_INFO_T\fP ** sec4, \fBG2C_SECTION_INFO_T\fP ** sec5, \fBG2C_SECTION_INFO_T\fP ** sec6, \fBG2C_SECTION_INFO_T\fP ** sec7)"

.PP
Given a pointer to a message, and a field number, return pointers to all relevent section structs for that product\&. Each product is defined in a section 4, and has an associated section 3, 5, 6, and 7\&.
.PP
\fBParameters\fP
.RS 4
\fImsg\fP Pointer to a G2C_MESSAGE_INFO_T with information about the message\&. 
.br
\fIfieldnum\fP The field number (first field in message is 0)\&. 
.br
\fIsec3\fP Pointer that gets a pointer to the G2C_SECTION_INFO_T struct for the section 3 associated with this product\&. 
.br
\fIsec4\fP Pointer that gets a pointer to the G2C_SECTION_INFO_T struct for the section 4 associated with this product\&. 
.br
\fIsec5\fP Pointer that gets a pointer to the G2C_SECTION_INFO_T struct for the section 5 associated with this product\&. 
.br
\fIsec6\fP Pointer that gets a pointer to the G2C_SECTION_INFO_T struct for the section 6 associated with this product\&. NULL is returned if there is no section 6\&. 
.br
\fIsec7\fP Pointer that gets a pointer to the G2C_SECTION_INFO_T struct for the section 7 associated with this product\&.
.RE
.PP
\fBNote\fP
.RS 4
This is an internal function and should not be called by users\&.
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.IP "\(bu" 2
\fBG2C_EINVAL\fP Invalid input\&.
.IP "\(bu" 2
\fBG2C_ENOSECTION\fP Section not found\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
10/27/22 
.RE
.PP

.PP
Definition at line \fB317\fP of file \fBg2cindex\&.c\fP\&.
.PP
References \fBG2C_EINVAL\fP, \fBG2C_ENOSECTION\fP, \fBG2C_NOERROR\fP, \fBg2c_section_info::next\fP, \fBg2c_section_info::prev\fP, \fBg2c_message_info::sec\fP, \fBg2c_section_info::sec_info\fP, and \fBg2c_section_info::sec_num\fP\&.
.PP
Referenced by \fBg2c_write_index()\fP\&.
.SS "int g2c_open_index (const char * data_file, const char * index_file, int mode, int * g2cid)"

.PP
Open a GRIB2 file with the help of an index file\&. The index file, generated by the grb2index utility, of the \fBg2c_write_index()\fP function, contains the byte offsets for the sections of each message in the GRIB2 file\&. When a GRIB2 file is opened with an index file, the library does not have to scan the file to locate all metadata\&.
.PP
\fBParameters\fP
.RS 4
\fIdata_file\fP The name of the data file to which the index applies\&. 
.br
\fIindex_file\fP The name that will be given to the index file\&. An existing file will be overwritten\&. 
.br
\fImode\fP Open mode flags\&. 
.br
\fIg2cid\fP Pointer that gets the g2cid for this file\&. Ignored if NULL\&.
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
10/12/22 
.RE
.PP

.PP
Definition at line \fB914\fP of file \fBg2cindex\&.c\fP\&.
.PP
References \fBadd_msg()\fP, \fBadd_section()\fP, \fBg2c_message_info::bytes_to_bms\fP, \fBg2c_message_info::bytes_to_data\fP, \fBg2c_message_info::bytes_to_local\fP, \fBg2c_message_info::bytes_to_msg\fP, \fBg2c_message_info::discipline\fP, \fBg2c_add_file()\fP, \fBG2C_EBADSECTION\fP, \fBG2C_EFILE\fP, \fBG2C_EINVAL\fP, \fBG2C_ENAMETOOLONG\fP, \fBg2c_file\fP, \fBg2c_file_io_ubyte()\fP, \fBg2c_file_io_uint()\fP, \fBG2C_FILE_READ\fP, \fBG2C_INDEX_BASENAME_LEN\fP, \fBG2C_INDEX_DATE_STR_LEN\fP, \fBG2C_INDEX_HEADER_LEN\fP, \fBG2C_INDEX_STR1_LEN\fP, \fBG2C_INDEX_TIME_STR_LEN\fP, \fBg2c_log_section1()\fP, \fBG2C_MAX_NAME\fP, \fBG2C_NOERROR\fP, \fBg2c_rw_section1_metadata()\fP, \fBg2c_start_index_record()\fP, \fBg2c_start_index_record_lf()\fP, \fBLOG\fP, \fBg2c_message_info::master_version\fP, \fBMUTEX_LOCK\fP, and \fBMUTEX_UNLOCK\fP\&.
.PP
Referenced by \fBmain()\fP\&.
.SS "int g2c_open_index1 (const char * index_file)"

.PP
Open a GRIB1 index file and read the contents\&. This function opens the GRIB2 index file and reads its metadata, and opens the accompanying GRIB2 file\&.
.PP
GRIB2 messages in the file are assigned a message ID, starting with 0 for the first message in the file\&.
.PP
Each product within a message is assigned a product ID, starting with 0 for the first product in the message\&.
.PP
Files opened with this function should be closed with a call \fBg2c_close()\fP to release resources\&.
.PP
\fBParameters\fP
.RS 4
\fIindex_file\fP The name that will be given to the index file\&. An existing file will be overwritten\&.
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
10/12/22 
.RE
.PP

.PP
Definition at line \fB812\fP of file \fBg2cindex\&.c\fP\&.
.PP
References \fBG2C_EFILE\fP, \fBG2C_EINVAL\fP, \fBG2C_FILE_READ\fP, \fBG2C_INDEX1_BDS_VAL_LEN\fP, \fBG2C_INDEX1_BMS_VAL_LEN\fP, \fBG2C_INDEX1_GDS_VAL_LEN\fP, \fBG2C_INDEX1_PDS_VAL_LEN\fP, \fBG2C_INDEX_BASENAME_LEN\fP, \fBG2C_INDEX_DATE_STR_LEN\fP, \fBG2C_INDEX_HEADER_LEN\fP, \fBG2C_INDEX_TIME_STR_LEN\fP, \fBG2C_NOERROR\fP, \fBg2c_start_index1_record()\fP, \fBLOG\fP, \fBMUTEX_LOCK\fP, \fBMUTEX_UNLOCK\fP, \fBread_hdr_rec1()\fP, and \fBread_hdr_rec2()\fP\&.
.SS "int g2c_start_index1_record (FILE * f, int rw_flag, unsigned int * b2_msg, unsigned int * b2_pds, unsigned int * b2_gds, unsigned int * b2_bms, unsigned int * b2_bds, unsigned int * msglen, unsigned char * version, unsigned char * pds_val, unsigned char * gds_val, unsigned char * bms_val, unsigned char * bds_val, unsigned char * pds_val2, unsigned char * pds_val3, unsigned char * gds_val2)"

.PP
Read or write the start of a version 1 index record\&. For more detail on version 1 of the index format, see the \fCgrbindex\fP documentation in the \fCNCEPLIBS-grib_util\fP\&.
.PP
\fBParameters\fP
.RS 4
\fIf\fP FILE * to open index file\&. 
.br
\fIrw_flag\fP True if function should write, false if it should read\&. 
.br
\fIb2_msg\fP Pointer that gets the bytes to skip in file before msg\&. 
.br
\fIb2_pds\fP Pointer that gets bytes to skip in message before pds\&. 
.br
\fIb2_gds\fP Pointer that gets bytes to skip in message before gds (0 if no gds)\&. 
.br
\fIb2_bms\fP Pointer that gets bytes to skip in message before bms (0 if no bms)\&. 
.br
\fIb2_bds\fP Pointer that gets bytes to skip in message before bds\&. 
.br
\fImsglen\fP Pointer that gets bytes total in the message\&. 
.br
\fIversion\fP Pointer that gets grib version number (always 1 for this function)\&. 
.br
\fIpds_val\fP Pointer that gets an arry of 27 bytes of the product definition section (pds)\&. 
.br
\fIgds_val\fP Pointer that gets an arry of 41 bytes of the gds\&. 
.br
\fIbms_val\fP Pointer that gets an arry of 5 bytes of the bms\&. 
.br
\fIbds_val\fP Pointer that gets an arry of 10 bytes, bytes 41-100 of the bds\&. 
.br
\fIpds_val2\fP Pointer that gets an arry of 59 bytes 41-100 of the pds\&. Ignored if null\&. 
.br
\fIpds_val3\fP Pointer that gets an arry of 11 bytes 29-40 of the pds\&. Ignored if null\&. 
.br
\fIgds_val2\fP Pointer that gets an arry of 135 bytes 43-178 of the gds\&. Ignored if null\&.
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.IP "\(bu" 2
\fBG2C_EINVAL\fP Invalid input\&.
.IP "\(bu" 2
\fBG2C_EFILE\fP File I/O error\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 9/11/23 
.RE
.PP

.PP
Definition at line \fB238\fP of file \fBg2cindex\&.c\fP\&.
.PP
References \fBG2C_EFILE\fP, \fBG2C_EINVAL\fP, \fBg2c_file_io_ubyte()\fP, \fBg2c_file_io_uint()\fP, \fBG2C_INDEX1_BDS_VAL_LEN\fP, \fBG2C_INDEX1_BMS_VAL_LEN\fP, \fBG2C_INDEX1_GDS_VAL_LEN\fP, \fBG2C_INDEX1_PDS_VAL_LEN\fP, and \fBG2C_NOERROR\fP\&.
.PP
Referenced by \fBg2c_open_index1()\fP\&.
.SS "int g2c_start_index_record (FILE * f, int rw_flag, int * reclen, int * msg, int * local, int * gds, int * pds, int * drs, int * bms, int * data, size_t * msglen, unsigned char * version, unsigned char * discipline, short * fieldnum)"

.PP
Read or write the start of a version 2 index record\&. 
.PP
\fBParameters\fP
.RS 4
\fIf\fP FILE * to open index file\&. 
.br
\fIrw_flag\fP True if function should write, false if it should read\&. 
.br
\fIreclen\fP Pointer to reclen\&. 
.br
\fImsg\fP Pointer to msg\&. 
.br
\fIlocal\fP Pointer to local\&. 
.br
\fIgds\fP Pointer to gds\&. 
.br
\fIpds\fP Pointer to pds\&. 
.br
\fIdrs\fP Pointer to drs\&. 
.br
\fIbms\fP Pointer to bms\&. 
.br
\fIdata\fP Pointer to data\&. 
.br
\fImsglen\fP Pointer to msglen\&. 
.br
\fIversion\fP Pointer to version\&. 
.br
\fIdiscipline\fP Pointer to discipline\&. 
.br
\fIfieldnum\fP Pointer to fieldnum, 0- based\&. (It is 1-based in the index file\&.)
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.IP "\(bu" 2
\fBG2C_EINVAL\fP Invalid input\&.
.IP "\(bu" 2
\fBG2C_EFILE\fP File I/O error\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 10/26/22 
.RE
.PP

.PP
Definition at line \fB70\fP of file \fBg2cindex\&.c\fP\&.
.PP
References \fBG2C_EINVAL\fP, \fBg2c_file_io_short()\fP, \fBg2c_file_io_ubyte()\fP, \fBg2c_file_io_uint()\fP, \fBg2c_file_io_ulonglong()\fP, \fBG2C_NOERROR\fP, and \fBLOG\fP\&.
.PP
Referenced by \fBg2c_open_index()\fP, and \fBg2c_write_index()\fP\&.
.SS "int g2c_start_index_record_lf (FILE * f, int rw_flag, int * reclen, size_t * msg, size_t * local, size_t * gds, size_t * pds, size_t * drs, size_t * bms, size_t * data, size_t * msglen, unsigned char * version, unsigned char * discipline, short * fieldnum)"

.PP
Read or write the start of a version 2 index record\&. 
.PP
\fBParameters\fP
.RS 4
\fIf\fP FILE pointer to open index file\&. 
.br
\fIrw_flag\fP True if function should write, false if it should read\&. 
.br
\fIreclen\fP Pointer to reclen, the length of the index record in bytes\&. 
.br
\fImsg\fP Pointer to bytes to skip in file to reach msg\&. 
.br
\fIlocal\fP Pointer to bytes to skip in message to reach local\&. 
.br
\fIgds\fP Pointer to bytes to skip in message to reach gds\&. 
.br
\fIpds\fP Pointer to bytes to skip in message to reach pds\&. 
.br
\fIdrs\fP Pointer to bytes to skip in message to reach drs\&. 
.br
\fIbms\fP Pointer to bytes to skip in message to reach bms\&. 
.br
\fIdata\fP Pointer to bytes to skip in message to reach data\&. 
.br
\fImsglen\fP Pointer to msglen\&. 
.br
\fIversion\fP Pointer to version\&. 
.br
\fIdiscipline\fP Pointer to discipline\&. 
.br
\fIfieldnum\fP Pointer to fieldnum, 0- based\&. (It is 1-based in the index file\&.)
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.IP "\(bu" 2
\fBG2C_EINVAL\fP Invalid input\&.
.IP "\(bu" 2
\fBG2C_EFILE\fP File I/O error\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 10/26/22 
.RE
.PP

.PP
Definition at line \fB151\fP of file \fBg2cindex\&.c\fP\&.
.PP
References \fBG2C_EINVAL\fP, \fBg2c_file_io_short()\fP, \fBg2c_file_io_ubyte()\fP, \fBg2c_file_io_uint()\fP, \fBg2c_file_io_ulonglong()\fP, \fBG2C_NOERROR\fP, and \fBLOG\fP\&.
.PP
Referenced by \fBg2c_open_index()\fP, and \fBg2c_write_index()\fP\&.
.SS "int g2c_write_index (int g2cid, int mode, const char * index_file)"

.PP
Create an index file from a GRIB2 file, just like those created by the grb2index utility\&. The index file starts with two header records:
.IP "1." 4
81-byte header with 'gb2ix1' in columns 42-47\&.
.IP "2." 4
81-byte header with number of bytes to skip before index records, total length in bytes of the index records, number of index records, and grib file basename written in format ('ix1form:',3i10,2x,a40)\&.
.PP
.PP
Each following index record corresponds to a grib message and has the internal format:
.IP "\(bu" 2
byte 001 - 004 length of index record
.IP "\(bu" 2
byte 005 - 008 bytes to skip in data file before grib message
.IP "\(bu" 2
byte 009 - 012 bytes to skip in message before lus (local use) (0, if none)\&.
.IP "\(bu" 2
byte 013 - 016 bytes to skip in message before gds
.IP "\(bu" 2
byte 017 - 020 bytes to skip in message before pds
.IP "\(bu" 2
byte 021 - 024 bytes to skip in message before drs
.IP "\(bu" 2
byte 025 - 028 bytes to skip in message before bms
.IP "\(bu" 2
byte 029 - 032 bytes to skip in message before data section
.IP "\(bu" 2
byte 033 - 040 bytes total in the message
.IP "\(bu" 2
byte 041 - 041 grib version number (currently 2)
.IP "\(bu" 2
byte 042 - 042 message discipline
.IP "\(bu" 2
byte 043 - 044 field number within grib2 message (1-based)
.IP "\(bu" 2
byte 045 - ii identification section (ids)
.IP "\(bu" 2
byte ii+1- jj grid definition section (gds)
.IP "\(bu" 2
byte jj+1- kk product definition section (pds)
.IP "\(bu" 2
byte kk+1- ll the data representation section (drs)
.IP "\(bu" 2
byte ll+1-ll+6 first 6 bytes of the bit map section (bms)
.PP
.PP
\fBParameters\fP
.RS 4
\fIg2cid\fP File it for an open GRIB2 file, as returned by \fBg2c_open()\fP\&. 
.br
\fImode\fP Mode flags\&. Set \fBG2C_NOCLOBBER\fP to avoid overwriting and existing file\&. 
.br
\fIindex_file\fP The name that will be given to the index file\&. An existing file will be overwritten\&.
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
10/12/22 
.RE
.PP

.PP
Definition at line \fB431\fP of file \fBg2cindex\&.c\fP\&.
.PP
References \fBg2c_message_info::bytes_in_msg\fP, \fBg2c_message_info::bytes_to_local\fP, \fBg2c_message_info::bytes_to_msg\fP, \fBg2c_section_info::bytes_to_sec\fP, \fBg2c_message_info::discipline\fP, \fBg2c_file_info::f\fP, \fBg2c_message_info::file\fP, \fBG2C_EBADID\fP, \fBG2C_EFILE\fP, \fBG2C_EINVAL\fP, \fBg2c_file\fP, \fBg2c_file_io_ubyte()\fP, \fBg2c_file_io_uint()\fP, \fBG2C_FILE_WRITE\fP, \fBg2c_get_prod_sections()\fP, \fBG2C_INDEX_BASENAME_LEN\fP, \fBG2C_INDEX_BITMAP_BYTES\fP, \fBG2C_INDEX_FIXED_LEN\fP, \fBG2C_INDEX_FIXED_LEN_2\fP, \fBG2C_INDEX_HEADER_LEN\fP, \fBG2C_LARGE_FILE_INDEX\fP, \fBG2C_MAX_FILES\fP, \fBG2C_NOCLOBBER\fP, \fBG2C_NOERROR\fP, \fBg2c_rw_section1_metadata()\fP, \fBg2c_rw_section3_metadata()\fP, \fBg2c_rw_section4_metadata()\fP, \fBg2c_rw_section5_metadata()\fP, \fBg2c_start_index_record()\fP, \fBg2c_start_index_record_lf()\fP, \fBLOG\fP, \fBg2c_message_info::master_version\fP, \fBMUTEX_LOCK\fP, \fBMUTEX_UNLOCK\fP, \fBg2c_message_info::next\fP, \fBg2c_message_info::num_fields\fP, \fBONE_BYTE\fP, \fBg2c_message_info::sec1_len\fP, and \fBg2c_section_info::sec_len\fP\&.
.PP
Referenced by \fBmain()\fP\&.
.SS "static int read_hdr_rec1 (FILE * f, int * ip, int * jp, int * kp, char * date_str, char * time_str)\fC [static]\fP"

.PP
Read the header record apparently named after Steve Lord\&. This function reads the first of two 81-byte header records of an index file\&.
.PP
\fBParameters\fP
.RS 4
\fIf\fP Pointer to open FILE\&. 
.br
\fIip\fP Pointer that gets i value\&. Ignored if NULL\&. 
.br
\fIjp\fP Pointer that gets j value\&. Ignored if NULL\&. 
.br
\fIkp\fP Pointer that gets k value\&. Ignored if NULL\&. 
.br
\fIdate_str\fP Pointer to char array of size \fBG2C_INDEX_DATE_STR_LEN\fP + 1 which will get the date string from the header\&. Ignored if NULL\&. 
.br
\fItime_str\fP Pointer to char array of size \fBG2C_INDEX_TIME_STR_LEN\fP + 1 which will get the time string from the header\&. Ignored if NULL\&.
.RE
.PP
\fBReturns\fP
.RS 4
0 for success, error code otherwise\&.
.RE
.PP
\fBAuthor\fP
.RS 4
Edward Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
9/10/23 
.RE
.PP

.PP
Definition at line \fB684\fP of file \fBg2cindex\&.c\fP\&.
.PP
References \fBG2C_EFILE\fP, \fBG2C_INDEX_DATE_STR_LEN\fP, \fBG2C_INDEX_HEADER_LEN\fP, \fBG2C_INDEX_STR1_LEN\fP, \fBG2C_INDEX_TIME_STR_LEN\fP, \fBG2C_NOERROR\fP, and \fBLOG\fP\&.
.PP
Referenced by \fBg2c_open_index1()\fP\&.
.SS "static int read_hdr_rec2 (FILE * f, int * skipp, int * total_lenp, int * num_recp, char * basename, int * index_version)\fC [static]\fP"

.PP
Read the second header record of an index file\&. This function reads the second of two 81-byte header records of an index file\&.
.PP
\fBParameters\fP
.RS 4
\fIf\fP Pointer to open FILE\&. 
.br
\fIskipp\fP Pointer that gets number of bytes to skip before index records\&. Ignored if NULL\&. 
.br
\fItotal_lenp\fP Pointer that gets number of bytes in each index record\&. Ignored if NULL\&. 
.br
\fInum_recp\fP Pointer that gets number of index records in the file\&. Ignored if NULL\&. 
.br
\fIbasename\fP Pointer to char array of size \fBG2C_INDEX_BASENAME_LEN\fP + 1 which will get the basename string from the second header record\&. Ignored if NULL\&. 
.br
\fIindex_version\fP The version of the index, 1 for legacy, 2 to allow for > 2 GB GRIB2 files\&.
.RE
.PP
\fBReturns\fP
.RS 4
0 for success, error code otherwise\&.
.RE
.PP
\fBAuthor\fP
.RS 4
Edward Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
9/10/23 
.RE
.PP

.PP
Definition at line \fB753\fP of file \fBg2cindex\&.c\fP\&.
.PP
References \fBG2C_EFILE\fP, \fBG2C_INDEX_BASENAME_LEN\fP, \fBG2C_INDEX_HEADER_LEN\fP, and \fBG2C_NOERROR\fP\&.
.PP
Referenced by \fBg2c_open_index1()\fP\&.
.SH "Variable Documentation"
.PP 
.SS "\fBG2C_FILE_INFO_T\fP g2c_file[\fBG2C_MAX_FILES\fP+1]\fC [extern]\fP"

.PP
Global file information\&. 
.PP
Definition at line \fB10\fP of file \fBg2cfile\&.c\fP\&.
.PP
Referenced by \fBg2c_open_index()\fP, and \fBg2c_write_index()\fP\&.
.SH "Author"
.PP 
Generated automatically by Doxygen for NCEPLIBS-g2c from the source code\&.
