Read a GRIB2 index file and return its contents.
More...
Go to the source code of this file.
|
| subroutine | getg2i (LUGI, CBUF, NLEN, NNUM, IRET) |
| | Read a GRIB2 index file and return its contents. More...
|
| |
Read a GRIB2 index file and return its contents.
- Author
- Mark Iredell
- Date
- 1995-10-31
Definition in file getg2i.F90.
◆ getg2i()
| subroutine getg2i |
( |
integer, intent(in) |
LUGI, |
|
|
character(len=1), dimension(:), pointer |
CBUF, |
|
|
integer, intent(out) |
NLEN, |
|
|
integer, intent(out) |
NNUM, |
|
|
integer, intent(out) |
IRET |
|
) |
| |
Read a GRIB2 index file and return its contents.
The index file may be generated by the grb2index utility of the NCEPLIBS-grib_util project.
The index file has two header records:
- an 81-byte header with 'GB2IX1' in columns 42-47
- an 81-byte header with number of bytes to skip before index records, total length in bytes of the index records, number of index records, and GRIB file basename written in format ('IX1FORM:',3i10,2x,a40).
Each record in the index table contains the following fields. All integers are in big-endian format in the file.
- byte 001 - 004 length of index record
- byte 005 - 008 bytes to skip in data file before grib message
- byte 009 - 012 bytes to skip in message before lus (local use) set = 0, if no local section.
- byte 013 - 016 bytes to skip in message before gds
- byte 017 - 020 bytes to skip in message before pds
- byte 021 - 024 bytes to skip in message before drs
- byte 025 - 028 bytes to skip in message before bms
- byte 029 - 032 bytes to skip in message before data section
- byte 033 - 040 bytes total in the message
- byte 041 - 041 grib version number (currently 2)
- byte 042 - 042 message discipline
- byte 043 - 044 field number within grib2 message
- byte 045 - ii identification section (ids)
- byte ii+1- jj grid definition section (gds)
- byte jj+1- kk product definition section (pds)
- byte kk+1- ll the data representation section (drs)
- byte ll+1-ll+6 first 6 bytes of the bit map section (bms)
- Note
- Subprogram can be called from a multiprocessing environment. Do not engage the same logical unit from more than one processor.
- Parameters
-
| [in] | lugi | Integer unit of the unblocked GRIB index file. Must be opened by baopen() or baopenr(). |
| [out] | cbuf | Pointer to a buffer that will get the index records. Memory will be allocated within this function, so callers must free the memory that cbuf points to, using deallocate(cbuf) when cbuf is no longer needed. |
| [out] | nlen | Total length of all index records. |
| [out] | nnum | Number of index records. |
| [out] | iret | Return code.
- 0 No error.
- 2 not enough memory to hold index buffer
- 3 error reading index file buffer
- 4 error reading index file header
|
- Author
- Mark Iredell
- Date
- 2000-05-26
Definition at line 58 of file getg2i.F90.
Referenced by getgb2p(), and getidx().