Emoslib is now deprecated

A subroutine which can be called from FORTRAN to retrieve GRIB products from an unblocked binary file. The subroutine is an interface to a set of C routines which handle the binary file as a stream of bytes. The return status code must be checked after calling the subroutine.

Products are delivered one per call to a user array.

The format and arguments for the subroutine are:

      SUBROUTINE PBGRIB( KUNIT, KARRAY, KINLEN, KOUTLEN, KRET)

Input parameters are INTEGERs.

 

PBGRIB input arguments
KUNITIndex of a C file pointer obtained from PBOPEN
KARRAYArray big enough to hold the GRIB product
KINLENSize in BYTES of the array

 

Output parameters are INTEGERs.

 

PBGRIB output arguments
KOUTLENSize in BYTES of the GRIB product read into KARRAY. This may be only part of the product if KARRAY is not sufficient to contain the whole product.
KRET
Status return code:
  0, a GRIB product has been read successfully
 -1, end-of-file was hit before a product was read. (Note that EOF does not
     cause a program fail. This value must be explicitly detected by the
     caller to avoid looping at EOF)
     (Or, possibly, the user buffer is too small to hold even the early
      sections of the product.)
 -2, there has been an error in the file-handling (eg the file contains a
     truncated product)
 -3, the size of KARRAY is not sufficient to contain the whole product