NCEPLIBS-g2  3.5.0
g2get.F90 File Reference

Get information from a GRIB2 message. More...

Go to the source code of this file.

Functions/Subroutines

subroutine gb_info (cgrib, lcgrib, listsec0, listsec1, numfields, numlocal, maxlocal, ierr)
 Find the number of gridded fields and Local Use Sections in a GRIB2 message. More...
 
subroutine getdim (csec3, lcsec3, width, height, iscan)
 Return the dimensions and scanning mode of a grid definition packed in the Grid Definition Section. More...
 
subroutine getfield (cgrib, lcgrib, ifldnum, igds, igdstmpl, igdslen, ideflist, idefnum, ipdsnum, ipdstmpl, ipdslen, coordlist, numcoord, ndpts, idrsnum, idrstmpl, idrslen, ibmap, bmap, fld, ierr)
 Return the Grid Definition, Product Definition, Bit-map (if applicable), and the unpacked data for a data field. More...
 
subroutine getlocal (cgrib, lcgrib, localnum, csec2, lcsec2, ierr)
 Return the contents of Section 2 (Local Use) from a GRIB2 message. More...
 
subroutine getpoly (csec3, lcsec3, jj, kk, mm)
 Return the J, K, and M pentagonal resolution parameters specified in a GRIB2 Grid Definition Section used spherical harmonic coefficients using GDT 5.50 through 5.53. More...
 
subroutine gettemplates (cgrib, lcgrib, ifldnum, igds, igdstmpl, igdslen, ideflist, idefnum, ipdsnum, ipdstmpl, ipdslen, coordlist, numcoord, ierr)
 Return the Grid Definition and Product Definition for a data field. More...
 
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...
 
subroutine unpack3 (cgrib, lcgrib, iofst, igds, igdstmpl, mapgridlen, ideflist, idefnum, ierr)
 This subroutine unpacks Section 3 (Grid Definition Section) starting at octet 6 of that Section. More...
 
subroutine unpack4 (cgrib, lcgrib, iofst, ipdsnum, ipdstmpl, mappdslen, coordlist, numcoord, ierr)
 This subroutine unpacks Section 4 (Product Definition Section) starting at octet 6 of that Section. More...
 
subroutine unpack5 (cgrib, lcgrib, iofst, ndpts, idrsnum, idrstmpl, mapdrslen, ierr)
 This subroutine unpacks Section 5 (Data Representation Section) starting at octet 6 of that Section. More...
 
subroutine unpack6 (cgrib, lcgrib, iofst, ngpts, ibmap, bmap, ierr)
 This subroutine unpacks Section 6 (Bit-Map Section) starting at octet 6 of that Section. More...
 

Detailed Description

Get information from a GRIB2 message.

Author
Edward Hartnett
Date
Mar 6, 2024

Definition in file g2get.F90.

Function/Subroutine Documentation

◆ gb_info()

subroutine gb_info ( 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)  numfields,
integer, intent(out)  numlocal,
integer, intent(out)  maxlocal,
integer, intent(out)  ierr 
)

Find the number of gridded fields and Local Use Sections in a GRIB2 message.

Also various checks are performed to see if the message is a valid GRIB2 message.

This function is similar to gribinfo(), but returns less information.

Parameters
[in]cgribCharacter array that contains the GRIB2 message.
[in]lcgribLength (in bytes) of GRIB message in array cgrib.
[out]listsec0Contains information decoded from GRIB Indicator Section 0. Must be dimensioned >= 2.
  • listsec0(1) Discipline-GRIB Master Table Number (see Code Table - 0.0)
  • listsec0(2) GRIB Edition Number (currently 2)
  • listsec0(3) Length of GRIB message
[out]listsec1Contains information read from GRIB Identification Section 1. Must be dimensioned >= 13.
  • listsec1(1) Id of orginating centre (Common Code Table C-1)
  • listsec1(2) Id of orginating sub-centre (local table)
  • listsec1(3) GRIB Master Tables Version Number (Code Table 1.0)
  • listsec1(4) GRIB Local Tables Version Number
  • listsec1(5) Significance of Reference Time (Code Table 1.1)
  • 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 (Code Table 1.2)
  • listsec1(13) Type of processed data (Code Table 1.3)
[out]numfieldsThe number of gridded fieldse found in the GRIB message.
[out]numlocalThe number of Local Use Sections (Section 2) found in the GRIB message.
[out]maxlocalThe size of the largest Local Use Section (Section 2). Can be used to ensure that the return array passed to subroutine getlocal is dimensioned large enough.
[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.
  • 6 Invalid section number found.
Author
Stephen Gilbert
Date
2000-05-25

Definition at line 52 of file g2get.F90.

References g2_gbytec(), g2_gbytec1(), g2_gbytec81(), g2logging::g2_log(), and g2logging::g2_log_msg.

◆ getdim()

subroutine getdim ( character(len=1), dimension(*), intent(in)  csec3,
integer, intent(in)  lcsec3,
integer, intent(out)  width,
integer, intent(out)  height,
integer, intent(out)  iscan 
)

Return the dimensions and scanning mode of a grid definition packed in the Grid Definition Section.

Parameters
[in]csec3Character array that contains the packed GRIB2 GDS.
[in]lcsec3Length (in octets) of section 3.
[out]widthx (or i) dimension of the grid.
[out]heighty (or j) dimension of the grid.
[out]iscanScanning mode (see Code Table 3.4).
Note
Returns width and height set to zero, if grid template not recognized.
Author
Stephen Gilbert
Date
2002-12-11

Definition at line 1191 of file g2get.F90.

References gf_unpack3().

Referenced by addfield().

◆ getfield()

subroutine getfield ( character(len = 1), dimension(lcgrib), intent(in)  cgrib,
integer, intent(in)  lcgrib,
integer, intent(in)  ifldnum,
integer, dimension(*), intent(out)  igds,
integer, dimension(*), intent(out)  igdstmpl,
integer, intent(out)  igdslen,
integer, dimension(*), intent(out)  ideflist,
integer, intent(out)  idefnum,
integer, intent(out)  ipdsnum,
integer, dimension(*), intent(out)  ipdstmpl,
integer, intent(out)  ipdslen,
real, dimension(*), intent(out)  coordlist,
integer, intent(out)  numcoord,
integer, intent(out)  ndpts,
integer, intent(out)  idrsnum,
integer, dimension(*), intent(out)  idrstmpl,
integer, intent(out)  idrslen,
integer, intent(out)  ibmap,
logical*1, dimension(*), intent(out)  bmap,
real, dimension(*), intent(out)  fld,
integer, intent(out)  ierr 
)

Return the Grid Definition, Product Definition, Bit-map (if applicable), and the unpacked data for a data field.

Since there can be multiple data fields packed into a GRIB2 message, the calling routine indicates which field is being requested with the ifldnum argument.

Note
Note that subroutine gribinfo() can be used to first determine how many data fields exist in a given GRIB message.
Parameters
[in]cgribCharacter array that contains the GRIB2 message.
[in]lcgribLength (in bytes) of GRIB message array cgrib.
[in]ifldnumSpecifies which field in the GRIB2 message to return.
[out]igdsContains information read from the appropriate GRIB Grid Definition Section 3 for the field being returned. Must be dimensioned >= 5.
  • igds(1) Source of grid definition (see Code Table 3.0).
  • igds(2) Number of grid points in the defined grid.
  • igds(3) Number of octets needed for each additional grid points definition. Used to define number of points in each row (or column) for non-regular grids. = 0, if using regular grid.
  • igds(4) Interpretation of list for optional points definition (Code Table 3.11).
  • igds(5) Grid Definition Template Number (Code Table 3.1).
[out]igdstmplContains the data values for the specified Grid Definition Template (NN=igds(5)). Each element of this integer array contains an entry (in the order specified) of Grid Defintion Template 3.NN. A safe dimension for this array can be obtained in advance from maxvals(2), which is returned from subroutine gribinfo().
[out]igdslenNumber of elements in igdstmpl. i.e. number of entries in Grid Defintion Template 3.NN (NN=igds(5)).
[out]ideflist(Used if igds(3) .ne. 0) This array contains the number of grid points contained in each row (or column). (part of Section 3) A safe dimension for this array can be obtained in advance from maxvals(3), which is returned from subroutine gribinfo().
[out]idefnum(Used if igds(3) .ne. 0) The number of entries in array ideflist - i.e. number of rows (or columns) for which optional grid points are defined.
[out]ipdsnumProduct Definition Template Number (see Code Table 4.0).
[out]ipdstmplContains the data values for the specified Product Definition Template (N=ipdsnum). Each element of this integer array contains an entry (in the order specified) of Product Defintion Template 4.N. A safe dimension for this array can be obtained in advance from maxvals(4), which is returned from subroutine gribinfo().
[out]ipdslenNumber of elements in ipdstmpl - i.e. number of entries in Product Defintion Template 4.N (N=ipdsnum).
[out]coordlistArray containg floating point values intended to document the vertical discretisation associated to model data on hybrid coordinate vertical levels (part of Section 4). The dimension of this array can be obtained in advance from maxvals(5), which is returned from subroutine gribinfo().
[out]numcoordnumber of values in array coordlist.
[out]ndptsNumber of data points unpacked and returned.
[out]idrsnumData Representation Template Number (see Code Table 5.0).
[out]idrstmplContains the data values for the specified Data Representation Template (N=idrsnum). Each element of this integer array contains an entry (in the order specified) of Product Defintion Template 5.N A safe dimension for this array can be obtained in advance from maxvals(6), which is returned from subroutine gribinfo().
[out]idrslenNumber of elements in idrstmpl. i.e. number of entries in Data Representation Template specified by idrsnum.
[out]ibmapBitmap indicator (see Code Table 6.0).
  • 0 bitmap applies and is included in Section 6.
  • 1-253 Predefined bitmap applies.
  • 254 Previously defined bitmap applies to this field.
  • 255 Bit map does not apply to this product.
[out]bmapLogical*1 array containing decoded bitmap (if ibmap=0). The dimension of this array can be obtained in advance from maxvals(7), which is returned from subroutine gribinfo().
[out]fldArray of ndpts unpacked data points. A safe dimension for this array can be obtained in advance from maxvals(7), which is returned from subroutine gribinfo().
[out]ierrError return code.
  • 0 no error.
  • 1 Beginning characters "GRIB" not found.
  • 2 GRIB message is not Edition 2.
  • 3 The data field request number was not positive.
  • 4 End string "7777" found, but not where expected.
  • 6 GRIB message did not contain the requested number of data fields.
  • 7 End string "7777" not found at end of message.
  • 9 Data Representation Template 5.NN not yet implemented.
  • 10 Error unpacking Section 3.
  • 11 Error unpacking Section 4.
  • 12 Error unpacking Section 5.
  • 13 Error unpacking Section 6.
  • 14 Error unpacking Section 7.
Author
Stephen Gilbert
Date
2000-05-26

Definition at line 543 of file g2get.F90.

References comunpack(), g2_gbytec(), g2_gbytec1(), g2_gbytec81(), jpcunpack(), pngunpack(), rdieee(), simunpack(), unpack3(), unpack4(), unpack5(), and unpack6().

◆ getlocal()

subroutine getlocal ( character(len = 1), dimension(lcgrib), intent(in)  cgrib,
integer, intent(in)  lcgrib,
integer, intent(in)  localnum,
character(len = 1), dimension(*), intent(out)  csec2,
integer, intent(out)  lcsec2,
integer, intent(out)  ierr 
)

Return the contents of Section 2 (Local Use) from a GRIB2 message.

Since there can be multiple occurrences of Section 2 within a GRIB message, the calling routine indicates which occurrence is being requested with the localnum argument.

Note
Note that subroutine gb_info() can be used to first determine how many Local Use sections exist in a given GRIB message.
Parameters
[in]cgribCharacter array that contains the GRIB2 message.
[in]lcgribLength (in bytes) of GRIB message array cgrib.
[in]localnumThe nth occurrence of Section 2 requested.
[out]csec2Character array containing information read from Section 2. The dimension of this array can be obtained in advance from argument maxlocal, which is returned from subroutine gb_info().
[out]lcsec2Number of bytes of character array csec2 read from Section 2.
[out]ierrError return code.
  • 0 no error.
  • 1 Beginning characters "GRIB" not found.
  • 2 GRIB message is not Edition 2.
  • 3 The data field request number was not positive.
  • 4 End string "7777" found, but not where expected.
  • 5 End string "7777" not found at end of message.
  • 6 GRIB message did not contain the requested number of data fields.
Author
Stephen Gilbert
Date
2000-05-25

Definition at line 1292 of file g2get.F90.

References g2_gbytec(), and g2_gbytec1().

◆ getpoly()

subroutine getpoly ( character(len = 1), dimension(*), intent(in)  csec3,
integer, intent(in)  lcsec3,
integer, intent(out)  jj,
integer, intent(out)  kk,
integer, intent(out)  mm 
)

Return the J, K, and M pentagonal resolution parameters specified in a GRIB2 Grid Definition Section used spherical harmonic coefficients using GDT 5.50 through 5.53.

Parameters
[in]csec3Character array containing the packed GRIB2 GDS
[in]lcsec3Length (in octets) of section 3
[out]JJ=J pentagonal resolution parameter
[out]KK=K pentagonal resolution parameter
[out]MM=M pentagonal resolution parameter
Note
Returns JJ, KK, and MM set to zero, if grid template not recognized.
Author
Stephen Gilbert
Date
2002-12-11

Definition at line 1418 of file g2get.F90.

References gf_unpack3().

Referenced by addfield().

◆ gettemplates()

subroutine gettemplates ( character(len = 1), dimension(lcgrib), intent(in)  cgrib,
integer, intent(in)  lcgrib,
integer, intent(in)  ifldnum,
integer, dimension(*), intent(out)  igds,
integer, dimension(*), intent(out)  igdstmpl,
integer  igdslen,
integer, dimension(*), intent(out)  ideflist,
integer, intent(out)  idefnum,
integer, intent(out)  ipdsnum,
integer, dimension(*), intent(out)  ipdstmpl,
integer  ipdslen,
real, dimension(*), intent(out)  coordlist,
integer, intent(out)  numcoord,
integer, intent(out)  ierr 
)

Return the Grid Definition and Product Definition for a data field.

Since there can be multiple data fields packed into a GRIB2 message, the calling routine indicates which field is being requested with the ifldnum argument.

Note
Note that subroutine gribinfo() can be used to first determine how many data fields exist in a given GRIB message.
Parameters
[in]cgribCharacter array that contains the GRIB2 message
[in]lcgribLength (in bytes) of GRIB message array cgrib.
[in]ifldnumSpecifies which field in the GRIB2 message to return.
[out]igdsContains information read from the appropriate GRIB Grid Definition Section 3 for the field being returned. Must be dimensioned >= 5.
  • igds(1) Source of grid definition (see Code Table 3.0)
  • igds(2) Number of grid points in the defined grid.
  • igds(3) Number of octets needed for each additional grid points definition. Used to define number of points in each row (or column) for non-regular grids. = 0, if using regular grid.
  • igds(4) Interpretation of list for optional points definition. (Code Table 3.11)
  • igds(5) Grid Definition Template Number (Code Table 3.1)
[out]igdstmplContains the data values for the specified Grid Definition Template (NN=igds(5)). Each element of this integer array contains an entry (in the order specified) of Grid Defintion Template 3.NN.
[out]igdslenNumber of elements in igdstmpl. i.e. number of entries in Data Representation Template 5.N (N=idrsnum).
[out]ideflist(Used if igds(3) .ne. 0) This array contains the number of grid points contained in each row (or column). (part of Section 3).
[out]idefnum(Used if igds(3) .ne. 0) The number of entries in array ideflist. i.e. number of rows (or columns) for which optional grid points are defined.
[out]ipdsnumProduct Definition Template Number (see Code Table 4.0).
[out]ipdstmplContains the data values for the specified Product Definition Template (N=ipdsnum). Each element of this integer array contains an entry (in the order specified) of Product Defintion Template 4.N. A safe dimension for this array can be obtained in advance from maxvals(4), which is returned from subroutine gribinfo().
[out]ipdslenNumber of elements in ipdstmpl. i.e. number of entries in Product Defintion Template 4.N (N=ipdsnum).
[out]coordlistArray containg floating point values intended to document the vertical discretisation associated to model data on hybrid coordinate vertical levels. (part of Section 4) The dimension of this array can be obtained in advance from maxvals(5), which is returned from subroutine gribinfo().
[out]numcoordnumber of values in array coordlist.
[out]ierrError return code.
  • 0 no error.
  • 1 Beginning characters "GRIB" not found.
  • 2 GRIB message is not Edition 2.
  • 3 The data field request number was not positive.
  • 4 End string "7777" found, but not where expected.
  • 5 End string "7777" not found at end of message.
  • 6 GRIB message did not contain the requested number of data fields.
  • 7 End string "7777" not found at end of message.
  • 9 Data Representation Template 5.NN not yet implemented.
  • 10 Error unpacking Section 3.
  • 11 Error unpacking Section 4.
  • 12 Error unpacking Section 5.
  • 13 Error unpacking Section 6.
  • 14 Error unpacking Section 7.
Author
Stephen Gilbert
Date
2000-05-26

Definition at line 1528 of file g2get.F90.

References g2_gbytec1(), unpack3(), and unpack4().

◆ 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 282 of file g2get.F90.

References g2_gbytec(), g2_gbytec1(), and g2_gbytec81().

◆ unpack3()

subroutine unpack3 ( character(len = 1), dimension(lcgrib), intent(in)  cgrib,
integer, intent(in)  lcgrib,
integer, intent(inout)  iofst,
integer, dimension(*), intent(out)  igds,
integer, dimension(*), intent(out)  igdstmpl,
integer  mapgridlen,
integer, dimension(*), intent(out)  ideflist,
integer, intent(out)  idefnum,
integer, intent(out)  ierr 
)

This subroutine unpacks Section 3 (Grid Definition Section) starting at octet 6 of that Section.

Parameters
[in]cgribCharacter array that contains the GRIB2 message.
[in]lcgribLength (in bytes) of GRIB message array cgrib.
[in,out]iofstBit offset of the beginning (in) or the end (out) of Section 3.
[out]igdsContains information read from the appropriate GRIB Grid Definition Section 3 for the field being returned. Must be dimensioned >= 5.
  • igds(1) Source of grid definition (see Code Table - 3.0)
  • igds(2) Number of grid points in the defined grid.
  • igds(3) Number of octets needed for each additional grid points definition. Used to define number of points in each row (or column) for non-regular grids. = 0, if using regular grid.
  • igds(4) Interpretation of list for optional points definition. (Code Table 3.11).
  • igds(5) Grid Definition Template Number (Code Table 3.1).
[out]igdstmplContains the data values for the specified Grid Definition Template (NN=igds(5)). Each element of this integer array contains an entry (in the order specified) of Grid Defintion Template 3.NN.
[out]mapgridlenNumber of elements in igdstmpl - i.e. number of entries in Grid Defintion Template 3.NN (NN=igds(5)).
[out]ideflist(Used if igds(3) .ne. 0). This array contains the number of grid points contained in each row (or column) (part of Section 3).
[out]idefnum(Used if igds(3) .ne. 0). The number of entries in array ideflist - i.e. number of rows (or columns) for which optional grid points are defined.
[out]ierrError return code.
  • 0 no error.
  • 5 "GRIB" message contains an undefined Grid Definition Template.
Author
Stephen Gilbert
Date
2000-05-26

Definition at line 811 of file g2get.F90.

References gridtemplates::extgridtemplate(), g2_gbytec1(), g2_gbytesc(), and gridtemplates::getgridtemplate().

Referenced by getfield(), and gettemplates().

◆ unpack4()

subroutine unpack4 ( character(len = 1), dimension(lcgrib), intent(in)  cgrib,
integer, intent(in)  lcgrib,
integer, intent(inout)  iofst,
integer, intent(out)  ipdsnum,
integer, dimension(*), intent(out)  ipdstmpl,
integer  mappdslen,
real, dimension(*), intent(out)  coordlist,
integer, intent(out)  numcoord,
integer, intent(out)  ierr 
)

This subroutine unpacks Section 4 (Product Definition Section) starting at octet 6 of that Section.

Parameters
[in]cgribCharacter array that contains the GRIB2 message.
[in]lcgribLength (in bytes) of GRIB message array cgrib.
[in,out]iofstBit offset of the beginning (in) or the end (out) of Section 4.
[out]ipdsnumProduct Definition Template Number (see Code Table 4.0).
[out]ipdstmplContains the data values for the specified Product Definition Template (N=ipdsnum). Each element of this integer array contains an entry (in the order specified) of Product Defintion Template 4.N.
[out]mappdslenNumber of elements in ipdstmpl. i.e. number of entries in Product Defintion Template 4.N (N=ipdsnum).
[out]coordlist-Array containg floating point values intended to document the vertical discretisation associated to model data on hybrid coordinate vertical levels (part of Section 4).
[out]numcoordnumber of values in array coordlist.
[out]ierrError return code.
  • 0 no error.
  • 5 GRIB message contains an undefined Product Definition Template.
Author
Stephen Gilbert
Date
2000-05-26

Definition at line 936 of file g2get.F90.

References pdstemplates::extpdstemplate(), g2_gbytec1(), g2_gbytescr(), pdstemplates::getpdstemplate(), and rdieee().

Referenced by getfield(), and gettemplates().

◆ unpack5()

subroutine unpack5 ( character(len = 1), dimension(lcgrib), intent(in)  cgrib,
integer, intent(in)  lcgrib,
integer, intent(inout)  iofst,
integer, intent(out)  ndpts,
integer, intent(out)  idrsnum,
integer, dimension(*), intent(out)  idrstmpl,
integer  mapdrslen,
integer, intent(out)  ierr 
)

This subroutine unpacks Section 5 (Data Representation Section) starting at octet 6 of that Section.

Parameters
[in]cgribCharacter array that contains the GRIB2 message.
[in]lcgribLength (in bytes) of GRIB message array cgrib.
[in,out]iofstBit offset of the beginning (in) or the end(out) of Section 5.
[out]ndptsNumber of data points unpacked and returned.
[out]idrsnumData Representation Template Number (see Code Table 5.0)
[out]idrstmplContains the data values for the specified Data Representation Template (N = idrsnum). Each element of this integer array contains an entry (in the order specified) of Data Representation Template 5.N.
[out]mapdrslenNumber of elements in idrstmpl. i.e. number of entries in Data Representation Template 5.N (N = idrsnum).
[out]ierrError return code.
  • 0 no error.
  • 7 GRIB message contains an undefined Data Representation Template.
Author
Stephen Gilbert
Date
2000-05-26

Definition at line 1043 of file g2get.F90.

References drstemplates::extdrstemplate(), g2_gbytec1(), and drstemplates::getdrstemplate().

Referenced by getfield().

◆ unpack6()

subroutine unpack6 ( character(len = 1), dimension(lcgrib), intent(in)  cgrib,
integer, intent(in)  lcgrib,
integer, intent(inout)  iofst,
integer, intent(in)  ngpts,
integer, intent(out)  ibmap,
logical*1, dimension(ngpts), intent(out)  bmap,
integer, intent(out)  ierr 
)

This subroutine unpacks Section 6 (Bit-Map Section) starting at octet 6 of that Section.

Parameters
[in]cgribCharacter array that contains the GRIB2 message.
[in]lcgribLength (in bytes) of GRIB message array cgrib.
[in,out]iofstBit offset of the beginning (in) or the end (out) of Section 6.
[in]ngptsNumber of grid points specified in the bit-map.
[out]ibmapBitmap indicator (see Code Table 6.0).
  • 0 bitmap applies and is included in Section 6.
  • 1-253 Predefined bitmap applies.
  • 254 Previously defined bitmap applies to this field.
  • 255 Bit map does not apply to this product.
[out]bmapLogical*1 array containing decoded bitmap (if ibmap = 0).
[out]ierrError return code.
  • 0 no error.
  • 4 Unrecognized pre-defined bit-map.
Author
Stephen Gilbert
Date
2000-05-26

Definition at line 1137 of file g2get.F90.

References g2_gbytec1(), and g2_gbytesc().

Referenced by getfield().