grib_api: grib_convert

- Main Page
- Modules
- Files
- Related Pages
- Examples

# grib_convert

## DESCRIPTION

It converts grib messages applying the rules from a conversion_rules file. The rules are of the type "keyname = value;" and if blocks are allowed as if ( keyname1 == value1 || keyname2 != value2 && keyname3 == value3 ) { keyname4 = value4; }

## USAGE

grib_convert [options] conversion_rules grib_file grib_file ... output_grib_file

## OPTIONS

-f
Force. Force the execution not to fail on error.
-M
Multi-grib support off. Turn off support for multiple fields in single grib message
-g
Copy GTS header.
-G
GRIBEX compatibility mode.
-V
Version.
-7
Does not fail when the message has wrong length
-v
Verbose.

## grib_convert examples

The following grib_convert rules convert all the grib messages contained in the input files in grib edition 2 and if a 2 metre temperature is found also the keys contained in the culy bracket are changed.

    editionNumber = 2;
    if( indicatorOfParameter == 11 && indicatorOfTypeOfLevel == 105)
    {
        productDefinitionTemplateNumber = 1;
        typeOfFirstFixedSurface         = 103;
        scaleFactorOfFirstFixedSurface  = 0;
        scaledValueOfFirstFixedSurface  = 2;
    }