ECMWF Com Intro training course - 2004 BUFR decoding BUFR decoding Dominique Lucas – Milan Dragosavac User Support – Meteorological Application
Mar 27, 2015
ECMWF 1 Com Intro training course - 2004 BUFR decoding
BUFR decoding
Dominique Lucas – Milan Dragosavac
User Support – Meteorological Application
ECMWF 2 Com Intro training course - 2004 BUFR decoding
Content
BUFR data format
BUFR software
BUFR tool
Practical example
ECMWF 3 Com Intro training course - 2004 BUFR decoding
What is BUFR
Binary representation of meteorological data or Binary Universal Form for data Representation
Continuous bit stream made of sequence of octets.
Table driven code
Self descriptive code
Machine independent
Compression available for improved transmission speed
ECMWF 4 Com Intro training course - 2004 BUFR decoding
BUFR FORMAT
Indicator section
Identification section
Optional section
Data description section
Data section
End section
All sections are padded with “0”s if needed to occupy even number of octets.
ECMWF 5 Com Intro training course - 2004 BUFR decoding
Section 0 - Indication section
Octet number Meaning
1 - 4 BUFR four letters in CCITT IA5
5 - 7 Total length of bufr message inbytes
8 Bufr Edition number
ECMWF 6 Com Intro training course - 2004 BUFR decoding
Section 1 - Identification section
Octet number Meaning
1 – 3 Length of section
4 BUFR master table
5 Originating sub-centre
6 Originating centre
7 Update sequence number
8 Presence of section 2 flag
9 Data category ( Table A)
ECMWF 7 Com Intro training course - 2004 BUFR decoding
Section 1 - Identification section
Octet number Meaning
10 Data sub-category
11 Version number of Master tablesused
12 Version number of local table used
13 Year of century
14 Month
15 Day
16 Hour
ECMWF 8 Com Intro training course - 2004 BUFR decoding
Section 1 - Identification section
Octet number Meaning
17 Minute
18- Reserved for local use by ADP Centres
ADP: Automated Data Processing
ECMWF 9 Com Intro training course - 2004 BUFR decoding
Section 2 - Optional section
Octet number Meaning
1 - 3 Length of section
4 Set to zero
5- Reserved for local ADP centre
ECMWF 10 Com Intro training course - 2004 BUFR decoding
Section 3 - Data description section
Octet number Meaning
1 - 3 Length of section
4 Set to zero (reserved)
5 - 6 Number of data subsets
7 Flag ( compression)
8 - Collection of data descriptors
ECMWF 11 Com Intro training course - 2004 BUFR decoding
Section 3 - Data descriptors
F type
X category
Y entry
2 bits 6 bits 8 bits
F = 0 Element Descriptor – Bufr table BF = 1 Replication descriptor
X = number of descriptors to repeat
Y = number of times the descriptors are repeatedF = 2 Operator Descriptor – Bufr table CF = 3 Sequence Descriptor – Bufr table D
ECMWF 12 Com Intro training course - 2004 BUFR decoding
Section 4 - Data section
Octet number Meaning
1 - 3 Length of section 4
4 Set to zero ( reserved )
5- Binary data as defined by sequencedescriptors
ECMWF 13 Com Intro training course - 2004 BUFR decoding
Section 5 - End section
Octet number Meaning
1 - 4 7777 Coded according to CCITTIA5
ECMWF 14 Com Intro training course - 2004 BUFR decoding
BUFR Tables
Table A - Data category
Table B - Classification of elements
Table C - Data descriptor operators
Table D - List of common sequences
ECMWF 15 Com Intro training course - 2004 BUFR decoding
Table A - Data category
Used in the Section 1 (element 9) of the BUFR message
Example:
Code figure Meaning
0 Surface data - land
1 Surface data – sea
2 Vertical soundings (not satellite)…
31 Oceanographic data
ECMWF 16 Com Intro training course - 2004 BUFR decoding
Table B - Classification of elements
Element Name Unit Scale Reference #bits
005001 Latitude (high accuracy) Degree 5 -9000000 25
007003 Geopotential m**2/s**2 -1 -400 17
002019 Satellite instruments Code table 0 0 11
008001 Vertical sounding signifi Flag Table 0 0 7
001006 Aircraft flight number CCITTIA5 0 0 64
(obs. * 10**scale – Reference) is encoded into #bits bits
For coded or flagged values, the element descriptor indicates the number of
the table discribing the codes/flags.
0 - Table B entry
05 - Location (horizontal 1) class
01 - Identification
08 - Significance qualifiers
ECMWF 17 Com Intro training course - 2004 BUFR decoding
Table C - Data Descriptor operators
201yyy - Change data width
202yyy - Change scale
203yyy - Change reference value
222000 - Quality information
ECMWF 18 Com Intro training course - 2004 BUFR decoding
Table D - List of common sequence
Table D can contain sequences of table B entries, Table D entries and Operators. It is not needed but saves a lot of space.
301027 301001 WMO block and station002011 Radiosonde type
002012 Radiosonde computational method 301011 Date
301012Time
301022 Lat/Long and station height
ECMWF 19 Com Intro training course - 2004 BUFR decoding
Bufr software
PBIO routines
PBOPEN - open bufr file for read/write
PBBUFR - read bufr message
PBWRITE - write bufr message
ECMWF 20 Com Intro training course - 2004 BUFR decoding
BUFR decoding
CALL BUFREX ( kbufl, kbuff, ksup, ksec0, ksec1, ksec2, ksec3, ksec4,
kelem, cnames, cunits, kvals, values, cvals, kerr )
Input arguments
kbufl - length of bufr message in words
kbuff - array containing bufr message
kelem - expected number of expanded elements
kvals - size of values array
ECMWF 21 Com Intro training course - 2004 BUFR decoding
BUFR decoding
Output arguments
ksup - array containing supplementary information
ksec[0-4] - array containing section [0-4] information
cnames - character array containing element names
cunits - character array containing element units
values - real array containing element values
cvals - character array containing char. elem. Values
kerr - return code
ECMWF 22 Com Intro training course - 2004 BUFR decoding
BUFR decoding
To access character strings from cvals array
index = values(1)/1000
string = cvals(index)
value(1) = index * 1000 + length
To access i-th element in multi subset message from values array
index = i +(nsub-1) * kelem
ECMWF 23 Com Intro training course - 2004 BUFR decoding
BUFR Tables
BUFR Edition 3 naming convention
Bwwwxxxyyzz, Cwwwxxxyyzz, Dwwwxxxyyzz
B - Bufr table BC - Bufr
table C code and flag tables D - Bufr table D
www - Originating subcentrexxx - Originating centre
yy - Version number of master table used zz - Version number of local table used
ECMWF 24 Com Intro training course - 2004 BUFR decoding
Where to find more about BUFR
WMO manual on Codes, Volume I, International Codes, Part B-Binary Codes, WMO No.306, FM-94-IX Ext BUFR
BUFR User Guide and Reference Manual, Ecmwf 2004
http://www.ecmwf.int/publications/technical_notes/
Guide to WMO Table Driven Code Forms
http://www.wmo.ch/web/www/WDM/Guides/BUFR-CREX-guide.html
ECMWF 25 Com Intro training course - 2004 BUFR decoding
BUFR tool
BUFR profiler available from /home/ma/emos/bin/sgimips/xbdc
ECMWF 26 Com Intro training course - 2004 BUFR decoding
Practical examples
On ecgate, take a copy of ~trx/bufr_decode/Retrieve_decode_bufr.cmd
Run (interactively or in batch mode) “Retrieve_decode_bufr.cmd” to decode one synop observation.
Use ~emos/bin/rs6000/xbdc on ecgate to display the content of the bufr message in ~trx/bufr_decode/obs
Try to adapt Retrieve_decode_bufr.cmd to write part of the observation data out to a file. An example job is available in ~trx/bufr_decode/ Retrieve_extract_bufr.cmd