NCEPLIBS-g2  3.4.8
gribinfo.F90 File Reference

Find the number of Local Use Sections and gridded fields in a GRIB2 message, and the maximum sizes of template arrays. More...

Go to the source code of this file.

Functions/Subroutines

subroutine gribinfo (cgrib, lcgrib, listsec0, listsec1, numlocal, numfields, maxvals, ierr)
 Find the number of Local Use Sections and gridded fields in a GRIB2 message, and the maximum sizes of template arrays. More...
 

Detailed Description

Find the number of Local Use Sections and gridded fields in a GRIB2 message, and the maximum sizes of template arrays.

Author
Stephen Gilbert
Date
2000-05-25

Definition in file gribinfo.F90.

Function/Subroutine Documentation

◆ gribinfo()

subroutine gribinfo ( character(len = 1), dimension(lcgrib), intent(in)  cgrib,
integer, intent(in)  lcgrib,
integer, dimension(3), intent(out)  listsec0,
integer, dimension(13), intent(out)  listsec1,
integer, intent(out)  numlocal,
integer, intent(out)  numfields,
integer, dimension(7), intent(out)  maxvals,
integer, intent(out)  ierr 
)

Find the number of Local Use Sections and gridded fields in a GRIB2 message, and the maximum sizes of template arrays.

This subroutine also performs various checks to see if the message is a valid GRIB2 message. Also, a list of safe array dimensions is returned for use in allocating return arrays from routines getlocal(), gettemplates(), and getfields().

Array maxvals contains the maximum possible number of values that will be returned in argument arrays for routines getlocal(), gettemplates() and getfields(). Users can use this info to determine if their arrays are dimensioned large enough for the data that may be returned from the above routines, or to dynamically allocate arrays with a reasonable size.

This function is similar to gb_info(), but returns more information.

Note
The actual number of values in these arrays will likely be less than the values calculated by this routine.
Parameters
[in]cgribCharacter that contains the GRIB2 message.
[in]lcgribLength (in bytes) of array cgrib.
[out]listsec0Contains information needed for GRIB Indicator Section 0. Must be dimensioned >= 2.
  • listsec0(1) Discipline-GRIB Master Table Number (Code Table 0.0).
  • listsec0(2) GRIB Edition Number (currently 2)
  • listsec0(3) Length of GRIB message.
[out]listsec1Contains information needed for GRIB Identification Section 1. Must be dimensioned >= 13.
  • listsec1(1) Id of orginating centre (Table 0).
  • listsec1(2) Id of orginating sub-centre (Table C).
  • listsec1(3) GRIB Master Tables Version Number (Table 1.0).
  • listsec1(4) GRIB Local Tables Version Number (Table 1.1).
  • listsec1(5) Significance of Reference Time (Table 1.2)
  • listsec1(6) Reference Time - Year (4 digits)
  • listsec1(7) Reference Time - Month
  • listsec1(8) Reference Time - Day
  • listsec1(9) Reference Time - Hour
  • listsec1(10) Reference Time - Minute
  • listsec1(11) Reference Time - Second
  • listsec1(12) Production status of data (Table 1.3).
  • listsec1(13) Type of processed data (Table 1.4).
[out]numlocalThe number of Local Use Sections (Section 2) found in the GRIB message.
[out]numfieldsThe number of gridded fieldse found in the GRIB message.
[out]maxvalsThe maximum number of elements that could be returned in various arrays from this GRIB2 message.
[out]ierrError return code.
  • 0 no error.
  • 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.
Author
Stephen Gilbert
Date
2000-05-25

Definition at line 78 of file gribinfo.F90.

References g2_gbytec().