To copy only the SYNOP messages from a file
> bufr_copy -w dataCategory=0 in.bufr out.bufr |
To copy only the non-SYNOP messages from a file
> bufr_copy -w dataCategory!=0 in.bufr out.bufr |
Use the square brackets to insert the value of a key in the name of the output file.
> bufr_copy in.bufr out_[dataCategory].bufr |
To dump BUFR messages into a flat JSON format.
> bufr_dump -jf ../data/bufr/aaen_55.bufr |
To dump BUFR messages into a structured JSON format. Note: This is the default if you omit the -j option
> bufr_dump -js ../data/bufr/aaen_55.bufr |
To dump a Fortran program with instructions to create (encode) the input message.
> bufr_dump -Efortran ../data/bufr/aaen_55.bufr > encode.aaen_55.f90 |
> bufr_compare ../data/bufr/aaen_55.bufr outfile.bufr |
To dump a Python program with instructions to decode the input message.
> bufr_dump -Dpython ../data/bufr/aaen_55.bufr > decode.aaen_55.py |
To dump in a WMO documentation style with hexadecimal octet values (-H).
> bufr_dump -OH ../data/bufr/syno_1.bufr |
To add key type information (-t).
> bufr_dump -OtH ../data/bufr/syno_1.bufr |
The bufr_filter sequentially processes all bufr messages contained in the input files and applies the rules to each 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. First we write a rules_file containing the following statement:
write "../data/split/[bufrHeaderCentre:i]_[dataCategory].bufr[editionNumber]"; |
> mkdir ../data/split > cat ../data/bufr/syno_1.bufr ../data/bufr/goes_87.bufr ../data/bufr/gosat.bufr > ../data/split/multitype.bufr |
</p></li><br /></ol><h2>bufr_get examples</h2><ol><li><p> bufr_get fails if a key is not found. <ac:structured-macro ac:name="code"><ac:plain-text-body><![CDATA[ > bufr_get -p centreName ../data/bufr/syno_1.bufr |
Without options a default list of keys is printed. The default list can be different depending on the type of BUFR message.
> bufr_ls ../data/bufr/syno_multi.bufr |
../data/bufr/syno_multi.bufr |
It is allowed to use wildcards in filenames.
> bufr_ls ../data/bufr/syno_*.bufr |
To list only a specific set of keys use the -p option.
> bufr_ls -p totalLength,bufrHeaderCentre,bufrHeaderSubCentre ../data/bufr/syno_multi.bufr |
To list only a subset of messages use the -w (where option). Only the 12 UTC messages are listed with the following line.
> bufr_ls -w typicalTime="120000" ../data/bufr/syno_*.bufr |
All the non-12 UTC messages are listed as follows:
> bufr_ls -w typicalTime!="120000" ../data/bufr/syno_*.bufr |
To list only the second message from a BUFR file:
> bufr_ls -w count=2 ../data/bufr/syno_multi.bufr |
Set key bufrHeaderCentre in the header and print its value after the change:
> bufr_set -v -p bufrHeaderCentre -s bufrHeaderCentre=222 ../data/bufr/syno_1.bufr out.bufr |