You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 29 Next »

DESCRIPTION

Apply the rules defined in rules_file to each BUFR message in the BUFR files provided as arguments.

USAGE

bufr_filter [options] rules_file file file ...

OPTIONS


-f

Force. Force the execution not to fail on error.


-o output_grib_file

Output grib is written to output_grib_file. If an output grib file is required and -o is not used, the output grib is written to filtered.out


-V

Version.


-g

Copy GTS header.


-7

Does not fail when the message has wrong length


-v

Verbose.

bufr_filter examples

  1. The bufr_filter processes sequentially all bufr messages contained in the input files and applies the rules to each one of them. Input messages can be written to the output by using the "write" statement. The write statement can be parameterised so that output is sent to multiple files depending on key values used in the output file name.


  2. Header information can be accessed witout unpacking the data. This rules_file:

    print "[bufrHeaderCentre] [bufrHeaderSubCentre] [masterTablesVersionNumber] [localTablesVersionNumber] [numberOfSubsets]";
    
    will result in the the follwing output:
    > bufr_filter rules_file ../data/bufr/syno_multi.bufr
    98 0 13 1 1
    98 0 13 1 1
    98 0 13 1 1
    


  3. To print values from the data section the messages have to be unpacked. This rules_file:

    set unpack=1;
    print "block=[blockNumber] station=[stationNumber] lat=[latitude] lon=[longitude] t2=[airTemperatureAt2M]";
    
    will print out some data values from the specified SYNOP BUFR messages.
    > bufr_filter rules_file ../data/bufr/syno_multi.bufr
    block=1 station=1 lat=70.93 lon=-8.67 t2=274.5
    block=1 station=3 lat=77 lon=15.5 t2=268.4
    block=1 station=7 lat=78.92 lon=11.93 t2=268.5
    


  4. The bufr_filter allows defining new keys with the transient keyword. We will further develop the previous example by creating a new key to combinethe block number and the station number into the full WMO station id: transient key: \

    set unpack=1;
    transient statid=1000*blockNumber+stationNumber;
    print "statid=[statid] lat=[latitude] lon=[longitude] t2=[airTemperatureAt2M]";
    
    The result is:
    > bufr_filter rules_file ../data/bufr/syno_multi.bufr
    block=1 station=1 lat=70.93 lon=-8.67 t2=274.5
    block=1 station=3 lat=77 lon=15.5 t2=268.4
    block=1 station=7 lat=78.92 lon=11.93 t2=268.5
    


  5. To access the attributes belonging to the keys use the -> operator. The example below prints the attributes of key "pressure" from a SYNOP BUFR message. \

    
    
    The result is:
    > bufr_filter rules_file ../data/bufr/syno_1.bufr
    pressure=100910 Pa
    pressure->code=010004
    pressure->scale=-1
    pressure->reference=0
    pressure->width=14
    pressure->percentConfidence=74 %
    pressure->percentConfidence->code=033007
    pressure->percentConfidence->scale=0
    pressure->percentConfidence->reference=0
    pressure->percentConfidence->width=7
    


  • No labels