NCEPLIBS-g2  3.4.7
getg2ir.F90 File Reference

Generate an index record for a message in a GRIB2 file. More...

Go to the source code of this file.

Functions/Subroutines

subroutine getg2ir (LUGB, MSK1, MSK2, MNUM, CBUF, NLEN, NNUM, NMESS, IRET)
 Generate an index record for a message in a GRIB2 file. More...
 

Detailed Description

Generate an index record for a message in a GRIB2 file.

Author
Mark Iredell
Date
1995-10-31

Definition in file getg2ir.F90.

Function/Subroutine Documentation

◆ getg2ir()

subroutine getg2ir ( integer, intent(in)  LUGB,
integer, intent(in)  MSK1,
integer, intent(in)  MSK2,
integer, intent(in)  MNUM,
character(len = 1), dimension(:), pointer  CBUF,
integer, intent(out)  NLEN,
integer, intent(out)  NNUM,
integer, intent(out)  NMESS,
integer, intent(out)  IRET 
)

Generate an index record for a message in a GRIB2 file.

The index record contains byte offsets to the message, it's length, and byte offsets within the message to each section. The index file record format is documented in subroutine ixgb2().

Note
Subprogram can be called from a multiprocessing environment. Do not engage the same logical unit from more than one processor.
Parameters
[in]lugbUnit of the unblocked GRIB file. Must be opened by baopen() or baopenr().
[in]msk1Number of bytes to search for first message.
[in]msk2Number of bytes to search for other messages.
[in]mnumNumber of GRIB messages to skip (usually 0).
[out]cbufPointer to a buffer that will get the index records. If any memory is associated with cbuf when this subroutine is called, cbuf will be nullified in the subroutine. Initially cbuf will get an allocation of 5000 bytes. realloc() will be used to increase the size if necessary. Users must free memory that cbuf points to when cbuf is no longer needed.
[out]nlenTotal length of index record buffer in bytes.
[out]nnumNumber of index records, zero if no GRIB messages are found.
[out]nmessLast GRIB message in file successfully processed
[out]iretReturn code.
  • 0 No error.
  • 1 Not enough memory available to hold full index buffer.
  • 2 Not enough memory to allocate initial index buffer.
  • 3 Error deallocating memory.
Author
Mark Iredell
Date
1995-10-31

Definition at line 37 of file getg2ir.F90.

References ixgb2(), and skgb().

Referenced by getgb2p(), and getidx().