A subroutine which can be called from FORTRAN to retrieve BUFR 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 PBBUFR( KUNIT, KARRAY, KINLEN, KOUTLEN, KRET)
Input parameters are INTEGERs.
KUNIT | Index of a C file pointer obtained from PBOPEN |
KARRAY | Array big enough to hold the product |
KINLEN | Size in BYTES of the array |
Output parameters are INTEGERs.
KOUTLEN | Size in BYTES of the 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 BUFR product has been read successfully -1, end-of-file is hit before a product is 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 |