NCEPLIBS-g2  3.4.5
getg2ir.f File Reference

This subroutine read a GRIB file and return its index content. More...

Go to the source code of this file.

Functions/Subroutines

subroutine getg2ir (LUGB, MSK1, MSK2, MNUM, CBUF, NLEN, NNUM, NMESS, IRET)
 This subroutine read a GRIB file and return its index content. More...
 

Detailed Description

This subroutine read a GRIB file and return its index content.

Author
Mark Iredell
Date
1995-10-31

Definition in file getg2ir.f.

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 
)

This subroutine read a GRIB file and return its index content.

the index buffer returned contains index records with the internal format:

  • 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 use section in grib2 message.
  • 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)

Program history log:

  • 1995-10-31 mark iredell
  • 1996-10-31 mark iredell augmented optional definitions to byte 320
  • 2002-01-02 stephen gilbert modified from getgir to create grib2 indexes
Parameters
[in]lugbinteger unit of the unblocked grib file
[in]msk1integer number of bytes to search for first message
[in]msk2integer number of bytes to search for other messages
[in]mnuminteger number of grib messages to skip (usually 0) output arguments:
[out]cbufcharacter*1 pointer to a buffer that contains index records. users should free memory that cbuf points to, using deallocate(cbuf) when cbuf is no longer needed.
[out]nleninteger total length of index record buffer in bytes
[out]nnuminteger number of index records, =0 if no grib messages are found)
[out]nmesslast grib message in file successfully processed
[out]iretinteger return code
  • 0 all ok
  • 1 not enough memory available to hold full index buffer
  • 2 not enough memory to allocate initial index buffer

subprograms called:

  • skgb seek next grib message
  • ixgb2 make index record
Note
subprogram can be called from a multiprocessing environment. do not engage the same logical unit from more than one processor.
Author
Mark Iredell
Date
1995-10-31

Definition at line 60 of file getg2ir.f.