|
NCEPLIBS-g2
3.4.7
|
Find and extract a GRIB2 message from a file. More...
Go to the source code of this file.
Functions/Subroutines | |
| subroutine | getgb2p (lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, extract, k, gribm, leng, iret) |
| Find and extract a GRIB2 message from a file. More... | |
| subroutine getgb2p | ( | integer, intent(in) | lugb, |
| integer, intent(in) | lugi, | ||
| integer, intent(in) | j, | ||
| integer, intent(in) | jdisc, | ||
| integer, dimension(*) | jids, | ||
| integer, intent(in) | jpdtn, | ||
| integer, dimension(*) | jpdt, | ||
| integer, intent(in) | jgdtn, | ||
| integer, dimension(*) | jgdt, | ||
| logical, intent(in) | extract, | ||
| integer, intent(out) | k, | ||
| character(len = 1), dimension(:), pointer | gribm, | ||
| integer, intent(out) | leng, | ||
| integer, intent(out) | iret | ||
| ) |
Find and extract a GRIB2 message from a file.
This subroutine reads a GRIB index file (or optionally the GRIB file itself) to get the index buffer (i.e. table of contents) for the GRIB file. It finds in the index buffer a reference to the GRIB field requested.
The GRIB field request specifies the number of fields to skip and the unpacked identification section, grid definition template and product defintion section parameters. (A requested parameter of -9999 means to allow any value of this parameter to be found.)
If the requested GRIB field is found, then it is read from the GRIB file and unpacked. If the GRIB field is not found, then the return code will be nonzero.
The derived type grib_mod::gribfield contains allocated memory that must be freed by the caller with subroutine gf_free().
| [in] | lugb | Unit of the unblocked GRIB data file. The file must have been opened with baopen() or baopenr() before calling this routine. |
| [in] | lugi | Unit of the unblocked GRIB index file. If nonzero, file must have been opened with baopen() or baopenr() before calling this subroutine. Set to 0 to get index buffer from the GRIB file. |
| [in] | j | Number of fields to skip (set to 0 to search from beginning). |
| [in] | jdisc | GRIB2 discipline number of requested field. See GRIB2 - TABLE 0.0 - DISCIPLINE. Use -1 to accept any discipline. |
| [in] | jids | Array of values in the identification section. (Set to -9999 for wildcard.)
|
| [in] | jpdtn | Product Definition Template (PDT) number (n) (if = -1, don't bother matching PDT - accept any) |
| [in] | jpdt | Array of values defining the Product Definition Template of the field for which to search (=-9999 for wildcard). |
| [in] | jgdtn | Grid Definition Template (GDT) number (if = -1, don't bother matching GDT - accept any). |
| [in] | jgdt | array of values defining the Grid Definition Template of the field for which to search (=-9999 for wildcard). |
| [in] | extract | value indicating whether to return a GRIB2 message with just the requested field, or the entire GRIB2 message containing the requested field.
|
| [out] | k | field number unpacked. |
| [out] | gribm | returned GRIB message. |
| [out] | leng | length of returned GRIB message in bytes. |
| [out] | iret | integer return code
|
Definition at line 92 of file getgb2p.F90.
References getg2i(), getg2ir(), getgb2rp(), getgb2s(), and gf_free().