NCEPLIBS-g2  3.4.7
getgb2rp.F90 File Reference

Extract a grib message from a file given the index of the requested field. More...

Go to the source code of this file.

Functions/Subroutines

subroutine getgb2rp (lugb, cindex, extract, gribm, leng, iret)
 Extract a grib message from a file given the index of the requested field. More...
 

Detailed Description

Extract a grib message from a file given the index of the requested field.

Author
Stephen Gilbert
Date
2003-12-31

Definition in file getgb2rp.F90.

Function/Subroutine Documentation

◆ getgb2rp()

subroutine getgb2rp ( integer, intent(in)  lugb,
character(len = 1), dimension(*), intent(in)  cindex,
logical, intent(in)  extract,
character(len = 1), dimension(:), pointer  gribm,
integer, intent(out)  leng,
integer, intent(out)  iret 
)

Extract a grib message from a file given the index of the requested field.

The GRIB message returned can contain only the requested field (extract=.true.), or the complete GRIB message originally containing the desired field can be returned (extract=.false.) even if other fields were included in the GRIB message.

If the GRIB field is not found, then the return code will be nonzero.

Note
For files greater than 2 GB, this subroutine will only work if the message is within the first 2 GB of the file.
Parameters
[in]lugbinteger unit of the unblocked grib data file. file must be opened with baopen() or baopenr() before calling this routine.
[in]cindexIndex record of the grib field (see docunentation of subroutine ixgb2() for description of an index record.)
[in]extractLogical value indicating whether to return a GRIB2 message with just the requested field, or the entire GRIB2 message containing the requested field.
  • .true. = return grib2 message containing only the requested field.
  • .false. = return entire grib2 message containing the requested field.
[out]gribmReturned grib message.
[out]lengLength of returned grib message in bytes.
[out]iretReturn code:
  • 0 No error.
  • 97 Error reading grib file.
Author
Stephen Gilbert
Date
2003-12-31

Definition at line 38 of file getgb2rp.F90.

References g2_gbytec(), and g2_sbytec().

Referenced by getgb2p().