NCEPLIBS-bufr  12.1.0
debufr.c File Reference

C language code for debufr utility. More...

#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <libgen.h>
#include <unistd.h>
#include <stdlib.h>
#include "bufr_interface.h"

Go to the source code of this file.

Functions

void fdebufr_f (char *ofile, int lenof, char *tbldir, int lentd, char *tblfil, int lentf, char *prmstg, int lenps, char *basic, char *forcemt, char *cfms)
 Read, decode, and print a verbose output listing of the contents of a BUFR file. More...
 
int main (int argc, char *argv[])
 This program decodes a BUFR file and generates a verbose listing of the contents. More...
 
void prtusage (char *prgnam)
 This function prints program usage information to standard output. More...
 

Detailed Description

C language code for debufr utility.

Author
J. Ator
Date
2009-07-01

Definition in file debufr.c.

Function Documentation

◆ fdebufr_f()

void fdebufr_f ( char *  ofile,
int  lenof,
char *  tbldir,
int  lentd,
char *  tblfil,
int  lentf,
char *  prmstg,
int  lenps,
char *  basic,
char *  forcemt,
char *  cfms 
)

Read, decode, and print a verbose output listing of the contents of a BUFR file.

All arguments are input.

Parameters
ofile- File to contain verbose output listing
lenof- Length of ofile string
tbldir- Directory containing DX and/or master BUFR tables for decoding
lentd- Length of tbldir string
tblfil- File containing DX BUFR table information for decoding
lentf- Length of tblfil string
prmstg- String of up to 20 comma-separated PARAMETER=VALUE pairs to be used for dynamically allocating memory withint the NCEPLIBS-bufr
lenps- Length of prmstg string
basic- Indicates whether to only decode and print the contents of Sections 0-3
forcemt- Indicates whether to ignore embedded DX BUFR tables and force the use of master BUFR tables for decoding
cfms- Indicates whether code and flag table meanings should be read from master BUFR tables and included in the output
Author
J. Ator
Date
2009-07-01

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

This program decodes a BUFR file and generates a verbose listing of the contents.

If a DX BUFR Tables file is specified (using the -f option) or if the specified BUFR file contains an embedded DX BUFR tables message as the first message in the file, then this information is used to decode the data messages in the file. Otherwise, or whenever the -m option is specified, master BUFR tables are read and used to decode the data messages in the file.

Usage


  debufr [-v] [-h] [-b] [-c] [-m] [-o outfile] [-t tabledir] [-f tablefil] [-p prmstg] bufrfile

    where:
      -v        prints version information and exits

      -h        prints program help and usage information and exits

      -b        specifies the "basic" option, meaning that only the
                information in Sections 0-3 will be decoded from each
                BUFR message in the bufrfile, and no attempt will be
                made to decode the data in Section 4

      -c        specifies that code and flag table meanings should not
                be read from master BUFR tables and included in the
                output; otherwise this feature is enabled by default

      -m        specifies that master BUFR tables will be used to
                decode the data messages in the file, regardless of
                whether it contains any embedded DX BUFR table
                messages.  This option can be used to view the actual
                contents of DX BUFR table messages, which otherwise
                would not be printed in the output listing.

      outfile   [path/]name of file to contain verbose output listing.
                The default is "bufrfilename.debufr.out" in the current
                working directory, where bufrfilename is the basename of
                the bufrfile (i.e. bufrfile with any preceding [path/]
                removed).

      tabledir  [path/]name of directory containing tables to be used
                for decoding.  This directory contains the DX BUFR
                tables file to be used (if one was specified
                via the -f option), or it may contain all of the master
                BUFR tables when these are being used to decode a
                file.  If unspecified, the default directory location is
                the defined value of the MASTER_TABLE_DIR macro when the
                utility was built.

      tablefil  file within tabledir containing DX BUFR tables
                to be used for decoding.

      prmstg    string of comma-separated PARAMETER=VALUE pairs, up to a
                maximum of 20.  For each pair, the dynamic allocation
                PARAMETER will be set to VALUE within the underlying
                NCEPLIBS-bufr software, overriding the default value that
                would otherwise be used.  A complete list of parameters
                that can be dynamically sized is included within the
                documentation for NCEPLIBS-bufr function isetprm().

      bufrfile  [path/]name of BUFR file to be decoded
Remarks
  • Fortran logical unit numbers 51, 90, 91, 92 and 93 are reserved for use within this program.
Parameters
argc- argument count.
argv- argument array.
Returns
0 for successs, error code otherwise.
Author
J. Ator
Date
2009-07-01

Definition at line 167 of file debufr.c.

References bvers_f(), ccbfl(), cobfl(), fdebufr_f(), prtusage(), and VERS_STR_LEN.

◆ prtusage()

void prtusage ( char *  prgnam)

This function prints program usage information to standard output.

Parameters
prgnam- [path/]name of program executable.
Author
J. Ator
Date
2009-07-01

Definition at line 48 of file debufr.c.

Referenced by main().