In this version of ecCodes some limited encoding features of the data section are available. An example showing how to encode data from a text file is provided here.

The only function needed to encode BUFR data is codes_set which is provided in all the available languages and in the bufr_filter.

It is very simple as an example to decode a BUFR message, change something and re-encode it. The following file of bufr_filter instruction can be used to decode a synop message, change the airTemperature and encode it again:

filter_instructions_file
# unpack data section
set unpack=1;

# print value of airTemperature
print "airTemperature=[airTemperature]";

# set new value for airTemperature
set airTemperature=299.5;
 
# print new value of airTemperature 
print "airTemperature=[airTemperature]";

# pack data section
set pack=1;

# write BUFR message on output file
write;

The filter instructions can be run on a synop message as:

bufr_filter -o out.bufr filter_instructions_file in.bufr

where in.bufr is an input synop message and out.bufr is the output message.

There are two main limitations in the encoding features provided in this version.

  1. Unfortunately in this version is not possible to set a key using the "by rank" (like "#2#airTemperature") or "by condition" (like "/beamIdentifier=2/backscatter") syntax. The full array of values has to be given in the correct order to set all the variables in the structure at once.
  2. It is not possible to set the delayedReplications and therefore is not possible to change the number of replicated elements in a complex data structure.

We are aware that this are strong limitations and we are working to implement these features as soon as possible in the next 0.13.0 release.