Scroll to navigation

g2_info.c(3) NCEPLIBS-g2c g2_info.c(3)

NAME

g2_info.c - Search through a GRIB2 message and returns the number of gridded fields found in the message and the number (and maximum size) of Local Use Sections.

SYNOPSIS

#include <stdio.h>
#include <stdlib.h>
#include 'grib2.h'

Functions


g2int g2_info (unsigned char *cgrib, g2int *listsec0, g2int *listsec1, g2int *numfields, g2int *numlocal)
This subroutine searches through a GRIB2 message and returns the number of gridded fields found in the message and the number (and maximum size) of Local Use Sections.

Detailed Description

Search through a GRIB2 message and returns the number of gridded fields found in the message and the number (and maximum size) of Local Use Sections.

Author

Stephen Gilbeert

Date

2002-10-28

Definition in file g2_info.c.

Function Documentation

g2int g2_info (unsigned char * cgrib, g2int * listsec0, g2int * listsec1, g2int * numfields, g2int * numlocal)

This subroutine searches through a GRIB2 message and returns the number of gridded fields found in the message and the number (and maximum size) of Local Use Sections. Also various checks are performed to see if the message is a valid GRIB2 message.

Parameters

cgrib Character pointer to the GRIB2 message.
listsec0 pointer to an array containing information decoded from GRIB Indicator Section 0. Must be allocated with >= 3 elements.
  • listsec0[0] Discipline-GRIB Master Table Number (see Code Table 0.0).
  • listsec0[1] GRIB Edition Number (currently 2).
  • listsec0[2] Length of GRIB message.

listsec1 Pointer to an array containing information read from GRIB Identification Section 1. Must be allocated with >= 13 elements.

  • listsec1[0] Id of orginating centre (Common Code Table C-1)
  • listsec1[1] Id of orginating sub-centre (local table)
  • listsec1[2] GRIB Master Tables Version Number (Code Table 1.0)
  • listsec1[3] GRIB Local Tables Version Number
  • listsec1[4] Significance of Reference Time (Code Table 1.1)
  • listsec1[5] Reference Time - Year (4 digits)
  • listsec1[6] Reference Time - Month
  • listsec1[7] Reference Time - Day
  • listsec1[8] Reference Time - Hour
  • listsec1[9] Reference Time - Minute
  • listsec1[10] Reference Time - Second
  • listsec1[11] Production status of data (Code Table 1.2)
  • listsec1[12] Type of processed data (Code Table 1.3)

numfields The number of gridded fields found in the GRIB message. That is, the number of occurences of Sections 4 - 7.
numlocal The number of Local Use Sections ( Section 2 ) found in the GRIB message.

Returns

0 foe success, otherwise:
  • 1 Beginning characters 'GRIB' not found.
  • 2 GRIB message is not Edition 2.
  • 3 Could not find Section 1, where expected.
  • 4 End string '7777' found, but not where expected.
  • 5 End string '7777' not found at end of message.
  • 6 Invalid section number found.

Author

Stephen Gilbeert

Date

2002-10-28

Definition at line 59 of file g2_info.c.

References gbit().

Author

Generated automatically by Doxygen for NCEPLIBS-g2c from the source code.

Tue May 3 2022 Version 1.6.4