Adding descriptors to a template

Asked by Charlie Martin

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:
Last query:
Last reply:
Revision history for this message
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.

Revision history for this message
Charlie Martin (martinc-e) said :
#2

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

Revision history for this message
Yves Pelletier (yves-pelletier) said :
#3

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.