Emoslib is now deprecated

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

There are a number of subroutines which can be called from FORTRAN to handle GRIB and BUFR products in an unblocked binary file. These routines skip over any padding bytes between products such as those present in data files retrieved from the ECMWF Mars archives.

Debug output can be triggered from the PB routines using the environment variable PBIO_DEBUG (set to 1,2,..).

PBOPENTo open a file for processing with calls to PB subroutines. (This supplies an index into an internal table which contains a C file pointer which must be given as an input argument to other routines)
PBGRIBTo read a GRIB product
PBBUFRTo read a BUFR product
PBPSEUTo read a BUDG/TIDE/DIAG product
PBSIZETo give the size of a following GRIB or BUFR product
PBCLOSETo close a file
PBFLUSHTo flush data written to a file

File handling subroutines

There are routines which provide FORTRAN-callable methods for file handling; it is not normally necessary to use these routines for reading BUFR or GRIB products.

PBSEEKTo position a file
PBREADTo read a given number of bytes from a file
PBREAD2To read a given number of bytes from a file (different behaviour from PBREAD on end-of-file)
PBWRITETo write a given number of bytes to a file
PBTELLTo tell the current byte offset in a file.

These subroutines are written in C and use standard C library functions for file handling (fopen, fclose, fseek, fread and fwrite).

C functions

There are three C functions to handle unblocked binary files.

readgribTo read GRIB products
readbufrTo read BUFR products
readnextTo read any mixture of GRIB and BUFR products.

These functions are written in C and use C standard library functions for file handling (fopen, fclose, fseek, fread and fwrite).

Libraries.

The library defined by the environment variable EMOSLIB contains the routines. The library name follows the normal UNIX convention and can be specified in the compile/link command using the usual method, for example:

    f77 -o program program.F $EMOSLIB
or
    cc -o program program.c $EMOSLIB
  • No labels