Step-by-step guide

This can be done by using the grib_set command.

You can use the "setBitsPerValue" key as in:

% grib_set -s setBitsPerValue=17 in.grib out.grib

or use the "repack" (-r) option with the "bitsPerValue" key:

% grib_set -r -s bitsPerValue=17 in.grib out.grib


In these commands, we first decode the data values, then change the bitsPerValue key and then repack (i.e., encode those values back in).

It is advisable to check the field values after such a change, for example by printing and comparing the statistics before and after:

% grib_ls -n statistics in.grib
% grib_ls -n statistics out.grib

Of course you can also use grib_compare.