Can convert FM-71(GTS Format) to BUFR Using libecbufr library

Asked by kihwan kim on 2013-06-26

I'm suppose to convert FM-71(GTS Format) to BUFR.
So, I would like to use libecbufr library.
Is it possible to use libecbufr library for converting GTS Format to BUFR?
If it is possible, can I know the way to use libecbufr library and get Sample source code?

Question information

Language:
English Edit question
Status:
Answered
For:
libECBUFR Edit question
Assignee:
No assignee Edit question
Last query:
2013-06-26
Last reply:
2013-06-26

Hello Kihwan,

There is currently no ready-made software application in libecbufr to convert FM-71 CLIMAT to BUFR CLIMAT messages. It could be done: such an application could be written with libecbufr. However, the Meteorological Service of Canada has no plans to do so. The main reason for this is that Canada's migration plan is to create the BUFR SYNOP, TEMP and CLIMAT from raw data. We are not converting existing Traditional Alphanumeric Bulletins to BUFR.

But let me try to help you out. One way to get started would be to use the bufr_encoder and bufr_decoder utilities.

With libecbufr installed, try the following commands (assuming you use bash):

$ echo $BUFR_TABLES

if nothing happens, then type

$ export BUFR_TABLES=/usr/share/libecbufr

you only need to do this once in this session.

$ bufr_encoder -sequence 307073 -outbufr 307073.bufr

This created a BUFR file called 307073.bufr, which has the structure of CLIMAT but contains only "missing" values.

$ bufr_decoder -inbufr 307073.bufr

This gave you a human-readable display of the BUFR file, just to be sure we have a valid BUFR file. Next, we will create the ascii data file that you can populate with actual values.

$bufr_decoder -inbufr 307073.bufr -dump -otemplate 307073_template.txt -output 307073_data.txt

This gave you a file 307073_data.txt that you can edit and then re-encode into BUFR. So what you could do is parse your FM-71 to extract data values, then populate 307073_data.txt with these values (replacing "MSNG" as required) and then encode into BUFR. The command to re-encode is:

$bufr_encoder -datafile 307073_data.txt -template 307073_template.txt -outbufr 307073.bufr

This gives you a file 307073.bufr encoded from your ascii data file with updated values.

This whole approach is not as clean as writing a dedicated program with libecbufr library calls, but it can get the job done.

I hope this helped.

kihwan kim (src-kimkh) said : #2

Thank you for helping me.
I will try your advise and then mention the result.
I hope that your advise will be helped too.

Can you help with this problem?

Provide an answer of your own, or ask kihwan kim for more information if necessary.

To post a message you must log in.