NCEPLIBS-bufr  11.7.0
 All Data Structures Files Functions Variables Pages
ufbtab.f File Reference

Read one or more data values from every data subset in a BUFR file. More...

Go to the source code of this file.

Functions/Subroutines

subroutine ufbtab (LUNIN, TAB, I1, I2, IRET, STR)
 This subroutine reads through every data subset in a BUFR file and returns one or more specified data values from each subset. More...
 

Detailed Description

Read one or more data values from every data subset in a BUFR file.

Definition in file ufbtab.f.

Function/Subroutine Documentation

subroutine ufbtab (   LUNIN,
real*8, dimension(i1,i2)  TAB,
  I1,
  I2,
  IRET,
character*(*)  STR 
)

This subroutine reads through every data subset in a BUFR file and returns one or more specified data values from each subset.

This provides a useful way to scan the ranges of one or more specified data values across an entire BUFR file.

Author
J. Woollen
Date
1994-01-06
Parameters
[in]LUNIN– integer: Absolute value is Fortran logical unit number for BUFR file
[out]TAB– real*8(*,*): Data values
[in]I1– integer: Actual first dimension of TAB as allocated within the calling program
[in]I2– integer: Actual second dimension of TAB as allocated within the calling program
[out]IRET– integer: Number of data subsets in BUFR file
[in]STR– character*(*): String of blank-separated Table B mnemonics, in one-to-one correspondence with the number of data values that will be read from each data subset within the first dimension of TAB (see DX BUFR Tables for further information about Table B mnemonics)

It is the user's responsibility to ensure that TAB is dimensioned sufficiently large enough to accommodate the number of data values that are to be read from the BUFR file. Specifically, each row of TAB will contain the data values read from a different data subset, so the value I2 must be at least as large as the total number of data subsets in the BUFR file.

If logical unit ABS(LUNIN) has already been opened via a previous call to subroutine openbf(), then this subroutine will save the current file position, rewind the file to the beginning, read through the entire file, and then restore it to its previous file position. Otherwise, if logical unit ABS(LUNIN) has not already been opened via a previous call to subroutine openbf(), then this subroutine will open it via an internal call to subroutine openbf(), read through the entire file, and then close it via an internal call to subroutine closbf().

Remarks
  • If LUNIN < 0, the number of data subsets in the BUFR file will still be returned in IRET; however, STR will be ignored, and all of the values returned in TAB will contain the current placeholder value for "missing" data.
  • If any of the Table B mnemonics in STR are replicated within the data subset definition for the BUFR file, then this subroutine will only return the value corresponding to the first occurrence of each such mnemonic (counting from the beginning of the data subset definition) within the corresponding row of TAB.

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
2000-09-19 J. Woollen Maximum length increased from 10,000 to 20,000 bytes
2002-05-14 J. Woollen Removed old Cray compiler directives
2003-11-04 D. Keyser Modified to not abort when there are more than I2 data subsets, but instead just process first I2 subsets and print a diagnostic
2003-11-04 D. Keyser Increased MAXJL from 15000 to 16000; modified to use rewnbf(); upgraded to allow reading from a file that has already been opened via openbf()
2004-08-09 J. Ator Maximum message length increased from 20,000 to 50,000 bytes
2005-09-16 J. Woollen upgraded to work for compressed BUFR messages, and to allow for LUNIN < 0 option
2006-04-14 J. Ator Add declaration for CREF
2007-01-19 J. Ator Replaced call to parseq with call to parstr()
2009-04-21 J. Ator Use errwrt()
2009-12-01 J. Ator Fix bug for compressed character strings which are identical across all subsets in a single messagE
2010-05-07 J. Ator When calling ireadmg(), treat read error as EOF condition
2012-03-02 J. Ator Use function ups()
2012-09-15 J. Woollen Modified for C/I/O/BUFR interface; added IO type 'INX' to enable open and close for C file without closing FORTRAN file
2014-11-20 J. Ator Ensure openbf() has been called at least once before calling status()
2014-12-10 J. Ator Use modules instead of COMMON blocks
2016-12-19 J. Woollen Fix bug to prevent inventory overflow

Definition at line 80 of file ufbtab.f.

References bort(), closbf(), errwrt(), ireadmg(), ireadsb(), mesgbc(), nmsub(), openbf(), parstr(), rewnbf(), status(), string(), upb(), upbb(), upc(), ups(), and usrtpl().