--------------------------------------------------------------- BUFR READ (V1.2) This library module provides utility routines to read the BUFR (Binary Universal Form for the Representation of meteorological data) data file. The idea here is the work in two steps. In a first step the section 3 of the BUFR messages is analyzed and a C language program that can read Section 4 (data) is generated: bufr_read file.buf -x > bufr_read_data.c The user can then customize the generated "bufr_read_data.c" program to meet its needs (display, storage in an array, ...) and compile it. The data in the BUFR message can then be read using bufr_read_data file.buf It is worth noting that a good knowledge of the C programming language is needed to adapt the "bufr_read_data.c" file. AUTHOR : Nicolas Clerbaux -- Royal meteorological Institute Of Belgium -- October 2007 -- March 2011 Bernard Sacré -- Royal meteorological Institute Of Belgium -- August 2010 LICENCE: (C) 31 aout 2010, Nicolas Clerbaux, Bernard Sacré This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ---------------------------------------------------------------- Compilation ------------- gcc bufr_read.c bufr_util.c small_lib.c -lm -o bufr_read gcc bufr_read_data.c bufr_util.c small_lib.c -lm -o bufr_read_data Execution ------------ ./bufr_read FILE -v : display information about the data descriptors present in section3 ./bufr_read FILE -w : write a "BUFR_ReadSection4" routine according to the data descriptors found in Section3 ./bufr_read FILE -x > bufr_read_data.c : same as the -w option but with a previous output of the content of "bufr_read.c" file. This option generates therefore a program that, after compilation, allows to read the data in Section4. ./bufr_read_data FILE : Return values Options of the programs: ------------------------ -1 : process only one BUFR message in the file -skip_first : skip the first BUFR message in the file Limitations: ------------ - All the BUFR messages in the file must have the same structure (same list of data descriptors). - The programs must be execute in the same directory as the tables B (hardcoded as "TABLE_B.TXT") and D (hardcoded as "TABLE_D.TXT"). This is easily modified by the users by changing the defines at the top of "bufr_read.c" . - It's possible that the program run slowly if they are lots of data descriptors. I suggest you to replace the routine of data descriptors doesn't use 'BUFR_GetFieldCompressed()' or 'BUFR_GetField()' by 'BUFR_GetFieldCompressed_Nothing()' or 'BUFR_GetField_Nothing()'. Testing : ------------- The program runs with succes for theses files: YYYYMMDDHHMM_MSG1_MPEF_CLA.bufr h01_v_10_200608291827_DMSP15_34690_rom.buf (with table B : B_HSAF.TXT ) h02_v_12_20071001_2335_noaa18_12192_sva.buf (with table B : B_HSAF.TXT ) h08_20090814_095103_metopa_14629_EUM.buf h08_20110322_113002_metopa_22941_ZAMG.buf (with option -1 and/or -skip_first) L-000-MSG2__-MPEF________-GII______-000001___-201008171500-__ L-000-MSG2__-MPEF________-GIIHD____-000001___-201008171500-__ L-000-MSG2__-MPEF________-RII______-000001___-201008171500-__ L-000-MSG2__-MPEF________-RIIHD____-000001___-201008171330-__ L-000-MSG2__-MPEF________-AMV______-000001___-201007260645-__ SAFNWC_MSG2_ASII_201007071000_BEL_________.IRAMV.buf SAFNWC_MSG2_ASII_201007071000_BEL_________.SAT+NWP.buf SAFNWC_MSG2_ASII_201007071000_BEL_________.SATonly.buf SAFNWC_MSG2_ASII_201007071000_BEL_________.WVAMV.buf SAFNWC_MSG2_ASII_201007071000_EURO________.IRAMV.buf SAFNWC_MSG2_ASII_201007071000_EURO________.SAT+NWP.buf SAFNWC_MSG2_ASII_201007071000_EURO________.SATonly.buf SAFNWC_MSG2_ASII_201007071000_EURO________.WVAMV.buf SAFNWC_MSG2_HRW__201007071000_BEL__________B.buf (with table B : B000_PGE09.TXT ) SAFNWC_MSG2_HRW__201008181100_BEL__________B.buf (with table B : B000_PGE09.TXT ) SAFNWC_MSG2_RDT__201007071000_BEL_________.buf (with table B : B000_PGE11.TXT ) sandettie_200711.bufr Samples/h08_20090814_095103_metopa_14629_EUM.buf Samples/h08_20110322_113002_metopa_22941_ZAMG.buf (with -1) Samples/h08_20110322_113002_metopa_22941_ZAMG.buf (with -skip_first) It seems that they are some problems with theses files: MSG1-SEVI-MSGGIIN-0101-0101-20040630111500.000000000Z-590090.bfr (with table B : B0002541001.TXT_all ) MSG2-SEVI-MSGCSKR-0101-0101-20070622194500.000000000Z-922168.bfr iasi_20091202_064452_metopa_16190_eps_t_300.l1_bufr (Descriptor 340008 not found in table D ) M02-ASCA-ASCSMR02-NA-1.0-20080614133000.000000000Z-933528.bfr (with table B : B0000000000000014000.TXT ) Exemple of use --------------- For exemple, I have a file 'nothing.bufr' what I want to read. First step, I check the informations of Section 3: ./bufr_read nothing.bufr -v If the output is correct, I print the routine 'BUFR_ReadSection4' to visualize the data descriptors found in Section3: ./bufr_read nothing.bufr -w (This second step is optionnal) Third Step, I generate 'bufr_read_data.c': ./bufr_read nothing.bufr -x > bufr_read_data.c Next, I select data descriptors what I want and I compile this new file: gcc bufr_read_data.c bufr_util.c small_lib.c -lm -o bufr_read_data End Step, I read data what I have selected in the previous step: ./bufr_read_data nothing.bufr