NCEPLIBS-bufr 11.7.1
|
Connect a new system file to the BUFRLIB software for reading or writing BUFR messages. More...
Go to the source code of this file.
Functions/Subroutines | |
subroutine | openbf (LUNIT, IO, LUNDX) |
This subroutine connects a new file to the BUFRLIB software for input or output operations. More... | |
Connect a new system file to the BUFRLIB software for reading or writing BUFR messages.
Definition in file openbf.f.
subroutine openbf | ( | LUNIT, | |
character*(*) | IO, | ||
LUNDX | |||
) |
This subroutine connects a new file to the BUFRLIB software for input or output operations.
[in] | LUNIT | – integer: Fortran logical unit number for BUFR file (unless IO is set to 'FIRST' or 'QUIET', in which case this is a dummy argument) |
[in] | IO | – character*(*): flag indicating how LUNIT is to be used by the software:
|
[in] | LUNDX | – integer:
|
The logical unit numbers LUNIT and LUNDX must already be associated with actual filenames on the local system, typically via a Fortran "OPEN" statement. Multiple logical units can be connected to the BUFRLIB software at any one time.
The argument IO is a character string describing how the file connected to LUNIT will be used, e.g. 'IN' is used to access an existing file of BUFR messages for input (i.e. reading/decoding BUFR), and 'OUT' is used to access a new file for output (i.e. writing/encoding BUFR). An option 'APX' is also available which behaves like 'OUT', except that output is then appended to an existing BUFR file rather than creating a new one from scratch, and there are also some additional options 'NUL' and 'NODX' which can likewise be used instead of 'OUT' for some very special cases as needed. There's also an option 'SEC3' which can be used in place of 'IN' for certain cases when the user is attempting to read BUFR messages whose content and descriptor layout are unknown in advance. However, all of these additional options are basically just variations of 'IN' or 'OUT', again depending on whether the intent is to read or write BUFR messages from the file connected to LUNIT. The only exceptions are when IO = 'FIRST' or 'QUIET'. When IO = 'FIRST', the subroutine simply checks whether it has already been called from within the application program and, if not, goes ahead and initializes the library without actually connecting any files in LUNIT or LUNDX. Alternatively, when IO = 'QUIET', the subroutine simply sets or resets the internal print verbosity switch to the value of input argument LUNDX, overriding its previous value and/or its internal default value of 0.
The third and final call argument LUNDX identifies the logical unit which contains the definition of the DX BUFR tables to be associated with unit LUNIT. Except when IO = 'SEC3', every BUFR file that is linked to the BUFRLIB software must have a DX BUFR tables file associated with it, and these tables may be defined within a separate ASCII text file (see Description and Format of DX BUFR Tables for more info.) or, in the case of an existing BUFR file, may be embedded within the first few BUFR messages of the file itself, and in which case the user can denote this to the subroutine by setting LUNDX to the same value as LUBFR.
Program history log:
Date | Programmer | Comments |
---|---|---|
1994-01-06 | J. Woollen | Original author |
1998-07-08 | J. Woollen | Replaced call to Cray library routine ABORT with call to new internal routine bort() |
1999-11-18 | J. Woollen | The number of BUFR files which can be opened at one time increased from 10 to 32 |
2003-11-04 | J. Ator | Added IO='NUL' option to prevent later writing to BUFR file in LUNIT; added documentation |
2003-11-04 | S. Bender | Added remarks and routine interdependencies |
2003-11-04 | D. Keyser | Unified/portable for WRF; added documentation; outputs more complete diagnostic info when routine terminates abnormally |
2004-08-18 | J. Ator | Added SAVE for IFIRST flag and IO="NODX" option |
2005-11-29 | J. Ator | Added COMMON /MSGFMT/ and ichkstr() call |
2009-03-23 | J. Ator | Added IO='SEC3' option; removed call to posapn; clarified comments; use errwrt() |
2010-05-11 | J. Ator | Added COMMON /STCODE/ |
2012-06-18 | J. Ator | Added IO='INUL' option |
2012-09-15 | J. Woollen | Modified for C/I/O/BUFR interface; use INQUIRE to obtain filename; use openrb(), openwb() and openab(); add IO types 'INX' and 'FIRST' |
2014-11-07 | J. Ator | Allow dynamic allocation of certain arrays |
2015-03-03 | J. Ator | Use MODA_IFOPBF instead of IFIRST |
Definition at line 138 of file openbf.f.
References arallocc(), arallocf(), bfrini(), bort(), dxinit(), errwrt(), modv_ifopbf::ifopbf, modv_nfiles::nfiles, openab(), openrb(), openwb(), posapx(), readdx(), status(), wrdlen(), writdx(), and wtstat().
Referenced by copybf(), datebf(), dumpbf(), fdebufr(), getbmiss(), igetmxby(), mesgbc(), mesgbf(), bufr_c_interface_mod::openbf_c(), pkvs01(), rdmgsb(), setblock(), setbmiss(), split_by_subset(), ufbinx(), ufbmem(), ufbmex(), and ufbtab().