Skip to content

Get metorological reports in Traditional Alphanumeric Code format from binary BUFR.

License

Notifications You must be signed in to change notification settings

ilblog/bufr2synop

 
 

Repository files navigation

INTRODUCTION
------------

This is a package to make the transition to bufr reports from alphanumeric text easiest as 
possible. The intial commit is contributed from ogimet.com

A lot of software is coded assuming that the primary source of meteorological reports is in 
alphanumeric format. Decode libraries are expecting this. But time is changing, 
meteorological services are migrating to BUFR and other binary formats. A lot of decode software 
have to be changed.

This is a software to get meteorological reports in old alphanumeric format from BUFR files. 
At the moment includes the following reports:

  - FM 12-XIV SYNOP
  - FM 13-XIV SHIP
  - FM 14-XIV SYNOP MOBIL
  - FM 18-XII BUOY
  - FM 35-XI  TEMP
  - FM 36-XI  TEMP SHIP
  - FM 38-XI  TEMP MOBIL
  - FM 71-XII CLIMAT

The software is based in bufrdc library from ECMWF. Before version 0.7 this package should to be 
installed. Since version 0.7, a library for decode a wide subset of BUFR reports has been written 
from scratch. This is a fast and light bufr decoder. Anyway it still uses the bufr tables 
installed by ECMWF packages so it need to be installed. You can grab ECMWF library from 

https://software.ecmwf.int/wiki/display/BUFR/Releases

Follow the instructions to build and install bufrdc library. It is recommended to build bufrdc 
with -DUNDERSCORE option to avoid problems when linked with C libraries. Then, you can use this 
package.

Note that the results from this library is not intended to match at %100 level to original
alphanumeric reports. It cannot. Some variables in alphanumeric code rules can be coded in
several ways, and there is not a regional even national decision about them. As example, the
'hshs' item (table code 1617) for synop FM-12 can be coded using 00-80 range or 90-99 one. 
A numeric value for heigh of base clouds can be coded in two ways. And there some few more
examples.


BUILD
-----

If you uses git repository, first time you clone the code you need to set the autotools files. 
To achieve this just from bufr2synop directory

   make -f Makefile.cvs

After this first task, you have to configure and make to build the package. Also if you get the 
package from a tarball you must do configure and make. From bufr2synop directory

  ./configure

and to build the package

  make

Assume you built the package. you will have four binaries:

- bufr2synop . 
    Main binary to extract alphanumeric reports using ECMWF decode library.
- bufrtorac .
    The same than bufr2ynop but using the own bufrdeco library. It is several times faster  
- bufr_decode . 
    A binary extracted and adapted from ECMWF bufrdc library. Is an example of use for 
    ECMWF bufrdc library
- bufrnoaa
    An utility to extract and select bufr files from NOAA bin archives.
    
And also the libraries :

- libbufrdeco  A light and very fast bufr decode library. It still in beta phase but it can 
               decode all BUFR types needed to get the target TAC reports.   
- libbufr2tac  Used by binaries bufr2synop and bufrtotac to transform a decoded bufr into a 
               TAC (Traditional Alphanumeric Form). Before version 0.7 this library was named 
               bufr2synop. It seems the new name is the right name.


INSTALL
-------

See 'INSTALL' file in this package to get details. If you use default settings, then install 
will install all the files in '/usr/local' directory. So you will need root privileges. As example

  sudo make install

or

  su -c "make install"



AN EXAMPLE OF USE
-----------------

In a working dir we want to get a BUFR archive from NOAA GTS and see the reports we can extract
from it.

1) Get a bufr bin file from NOAA. Is a cyclic directory file, with file names in the form 
sn.NNNN.bin, NNNN varying from 0000 to 0120. We choose first one. Don't worry, the file is also 
included in examples dir. (The file you can download is different for sure, the example in 
package is from Saturday Oct 18 2014).

  wget http://weather.noaa.gov/pub/SL.us008001/DF.bf/DC.intl/sn.0000.bin

2) Then use 'bufrnoaa' to get a lot of files. Every file is a bufr report. We do not want 
all kind of bufr reports, just surface observations (land and oceanographic). We can just do

   bufrnoaa  -f -T SO -S ACIMNSVW -O B -i sn.0000.bin

If we did this with examples 'sn.0000.bin' file we got 171 bufr files selected from 571 in the 
archive sn.0000.bin. Let choose one bufr file '20141018211119_ISIN03_EGRR_182100.bufr' (also 
in examples dir) 

To see the 'emulated' synop reports from this bufr file 

   bufr2synop -i 20141018211119_ISIN03_EGRR_182100.bufr

We will get a list of 58 synops to stdout.

And to see CLIMAT reports, we can try with another bufr file

    bufr2synop -i 20150705121512_ISCD01_LIIB_050000.bufr 

We will get 19 CLIMAT reports, some of them NIL reports.

We can try also to get a traditional TEMP report from examples. Let use the new bufrtotac

   bufrtotac -i 20160402121749_IUSH01_DRRN_021100.bufr

We will get the four parts of a TEMP report.
 
Since version 0.7 we also can do the same using bufrtotac which uses the own bufrdeco library. 
It works with the same arguments than bufr2synop, so 

   bufrtotac -i 20141018211119_ISIN03_EGRR_182100.bufr

and

   bufrtotac -i 20150705121512_ISCD01_LIIB_050000.bufr 

should produce the same output, but a lot faster.

There are some more options for bufrnoaa, bufrtotac and bufr2synop. You can see a list using 

   bufrnoaa -h

   bufrtotac -h 

or

   bufr2synop -h

And you also can read the doc pages at

   http://gbvalor.github.io/bufr2synop
   
   

About

Get metorological reports in Traditional Alphanumeric Code format from binary BUFR.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 98.9%
  • Other 1.1%