The -set_byte option set the values of selected
octets/bytes in the current grib message. For example if you want to
set octet 20 and 21 (byte in WMO speak) of section 4 to zero and one,
you would use -set_byte 4 20 0:1. The first
argument is the section number. The second is the byte (octet) number starting
from 1 (consistent with WMO documentation) and the third a colon
separated list of values.
After you have altered the grib message, you can save the
message by either -grib or
the -grib_out. You need to use
the latter option if the grid values were altered because the
data section needs to be updated.
-set_byte SECTION OCTET_LOCATION I-1:I-2:..:I-N
SECTION=0 .. 7
OCTET_LOCATION = 1..N
I = integer between 0 and 255
$ wgrib2 f.grb2
$ wgrib2 f.grb2 -set_byte 0 7 3
In the above example, the dicipline is changed to 3.