Adding descriptors to a template

Asked by Charlie Martin on 2016-01-21

B/C 25.11 "Other additional data" specifies that the sequence <3 09 052> can be supplemented by additional additional parameters, which are listed in Annex II. This annex contains a list of optional descriptors.

How would I use libECBUFR to append descriptors to a template?

Thanks,
Charlie

Question information

Language:
English Edit question
Status:
Solved
For:
libECBUFR Edit question
Assignee:
No assignee Edit question
Solved by:
Charlie Martin
Solved:
2016-01-22
Last query:
2016-01-22
Last reply:
2016-01-22
cpb (chris-beauregard) said : #1

You create a LibECBUFR template with 309052 followed by the additional descriptors.

309052 is immutable; you can't alter anything within it (without altering Table D, but then you're incompatible with everyone else). So you append descriptors after 309052 in the message.

In other words:

   BUFR_Template *tmpl = NULL;
   BufrDescValue bdv;
   tmpl = bufr_create_template( NULL, 0, tables, 4 );

   bufr_init_DescValue( &bdv );

   bdv.descriptor = 309052;
   bufr_template_add_DescValue( tmpl, &bdv, 1 );
   bdv.descriptor = 1081;
   bufr_template_add_DescValue( tmpl, &bdv, 1 );
   bdv.descriptor = 1082;
   bufr_template_add_DescValue( tmpl, &bdv, 1 );
   bdv.descriptor = 2191;
   bufr_template_add_DescValue( tmpl, &bdv, 1 );

   bufr_finalize_template( tmpl );

Or you can create an array of BufrDescValue's and add them all in a single bufr_template_add_DescValue(), depending on how you want to represent things in your code.

Charlie Martin (martinc-e) said : #2

Thanks, that seems to answer my question. I'll give it a try.

I have to add an important element of information:

The class of the additional parameters matters greatly. Most of the B/C25 Annex II parameters are from Classes 01 and 02, which belong to the so-called coordinate classes. These must imperatively be PREPENDED (do not append) in order to conform to the BUFR data description syntax. See regulation 94.5.3.3.

Descriptor 0 25 061 can be safely prepended as well, but could be appended instead.