Norwegian Service Centre for Climate Modelling -> Format Conversion Tools -> gribtonc
 
 

 

     

NAME

gribtonc - GRIB to netCDF decoder

SYNOPSIS

gribtonc [-l logpath] [-v] [-t timeout] [-e errpath] [-g tabfile] [-q qspecs] [CDL_path] netCDF_path

DESCRIPTION

This program decodes GRIB products (embedded in WMO product envelopes) on the NWS High-Resolution Data Service (HRS) feed, writing the decoded products into a single netCDF output file, specified by netCDF_path. In case the output netCDF file does not already exist, the CDL_path must be supplied to specify the structure for the desired netCDF file, which gribtonc creates. GRIB products are converted to the units specified for the appropriate netCDF variable, if this differs from the units used for the GRIB parameter. A set of CDL files for all the model outputs appearing on the HRS data stream is provided with gribtonc for use in decoding HRS GRIB data.

gribtonc can run as a subprocess of the LDM pqact(1) program, receiving a stream of GRIB products from standard input and decoding them as they arrive. gribtonc can also be used as a standalone decoder, decoding products on its standard input into netCDF form, as specified by netCDF_file GRIB products that do not conform to the specified file structure (e.g. they are defined on a different grid or contain a grid parameter not included in the specified netCDF file) are skipped.

To use gribtonc from the LDM pqact(1) program requires adding entries to the pqact configuration file that invoke gribtonc on appropriate HRS products. The PIPE action should be used in pattern-action entries. The form of such an entry is:

HRS pattern

PIPE gribtonc-executable

gribtonc-options

cdl-file netcdf-file

where pattern is a regular expression pattern matching product identifiers of products that are to be decoded and written to the output file netcdf-file.

Any directories that do not exist in netcdf-file will be created as needed, so date components, for example, may be part of the output file path, specified by using matched parts of the regular expression pattern. In case the output netcdf-file does not already exist, it will be created from the CDL specification in the file specified by cdl-file.

The path of the executable for gribtonc must be specified as the first argument to the PIPE command, and should be either an absolute path name or in a directory in the executable search path of pqact.

An example pqact.conf entry for decoding GRIB products from the ETA model as they appear on the HRS data stream is:

# ETA model on Lambert conformal grid to yymmddhh_eta.nc
HRS ^Y.Q... KWBC
(..)(..).*/mETA PIPE /usr/local/ldm/decoders/gribtonc
etc/eta.cdl data/GRIB/(1:yy)(1:mm)12_eta.nc

Since gribtonc reads GRIB products from its standard input, it may be invoked independently of pqact(1) by using I/O redirection.

OPTIONS

-l logpath

Log file pathname. The program uses Unidata's ulog(3) package to write error and log messages. The default is to write to the syslogd(8) daemon. If this option is specified, however, then messages will be written to the file logpath unless that pathname is "-", in which case all messages will be written to standard error.

-v

Verbose logging. Informative messages (level LOG_INFO) are logged, including a line for each GRIB product decoded. By default, only messages of severity LOG_NOTICE and greater are logged.

-t timeout

Timeout in seconds (default is 600). If there has been no input available on stdin for the duration of the specified timeout, the program exits gracefully.

-e errpath

If a GRIB product cannot be decoded, perhaps because it is truncated or otherwise corrupted, it is appended to this file.

-g tabfile

Use grib-netcdf translation defined in this file. The format of this file is described in gribtocdl(1).

-q qspecs

Specification for how to expand so-called quasi-regular or thinned grids into rectangular grids. This argument is a comma-delimited text string that specifies the method of interpolation used (currently lin for linear or cub for cubic), and the latitude and longitude increments in degrees for the resulting grid (e.g. dlat=2.5,dlon=5.0).

CDL_path

The path name of a file to be used as a template for the netCDF file, if the netCDF file specified as output does not exist. If the netCDF output file does exist, this argument is ignored. A path name relative to the directory specified by the LDM_ETCDIR environment variable may be used, but you must make sure this environment variable is defined in
gribtonc

netCDF_path

The path name of the netCDF output file. This may be specified as an absolute path name or (more typically) relative to the directory from which gribtonc is invoked. Directories that do not exist in the path name of the output file will be created as needed.

EXAMPLE

The command

gribtonc -v -l- -q "lin,dlat=2.5,dlon=5.0" avn-x.cdl avn-x.nc < avn-x.wmo


will decode the products in avn-x.wmo into the netCDF file avn-x.nc, creating the latter file if it does not already exist from the ASCII CDL template file avn-x.cdl. If the data contain quasi-regular grids, they will be expanded to full regular grids on a 2.5 by 5.0 degree grid before being written into the output file.

SEE ALSO

gribdump(1), gribtocdl(1), netcdf(3), pqact(1), udunits(3), ulog(3)

DIAGNOSTICS

Error messages and log messages are written to the log file.


 

Send comments to webmaster