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

Compare with Current View Page History

« Previous Version 16 Next »

bufr_copy examples

  1. To copy only the SYNOP messages from a file

    >  bufr_copy -w dataCategory=0 in.bufr out.bufr
    


  2. To copy only the non-SYNOP messages from a file

    >  bufr_copy -w dataCategory!=0 in.bufr out.bufr
    


  3. 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 
    


bufr_dump examples

  1. To dump BUFR messages into a flat JSON format.

    > bufr_dump -jf ../data/bufr/aaen_55.bufr
    


  2. 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
    


  3. 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
    
    Now compile and run 'encode.aaen_55.f90'. This will create a new BUFR file called 'outfile.bufr'. Check this is the the same as the input.
    > bufr_compare ../data/bufr/aaen_55.bufr outfile.bufr
    


  4. To dump a Python program with instructions to decode the input message.

    > bufr_dump -Dpython ../data/bufr/aaen_55.bufr > decode.aaen_55.py
    
    Examine the generated Python script 'decode.aaen_55.py'. You will see how to access each of the BUFR keys


  5. To dump in a WMO documentation style with hexadecimal octet values (-H).

    > bufr_dump -OH ../data/bufr/syno_1.bufr
    


  6. To add key type information (-t).

    > bufr_dump -OtH ../data/bufr/syno_1.bufr
    


bufr_filter examples

  1. 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]";
    
    Then we create the BUFR file multitype.bufr from three others:
    > mkdir ../data/split 
    > cat ../data/bufr/syno_1.bufr ../data/bufr/goes_87.bufr ../data/bufr/gosat.bufr > ../data/split/multitype.bufr 
    
    Applying this rules_file to the "../data/split/multitype.bufr" bufr file we obtain several files in the ../data/split directory containing messages split according to their key values
    </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
    


bufr_ls examples

  1. 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 
    
    The result is:
     
    ../data/bufr/syno_multi.bufr
    


  2. It is allowed to use wildcards in filenames.

     
    >  bufr_ls ../data/bufr/syno_*.bufr 
    


  3. To list only a specific set of keys use the -p option.

     
    >  bufr_ls -p totalLength,bufrHeaderCentre,bufrHeaderSubCentre ../data/bufr/syno_multi.bufr 
    


  4. 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
    


  5. All the non-12 UTC messages are listed as follows:

     
    >   bufr_ls -w typicalTime!="120000" ../data/bufr/syno_*.bufr
    


  6. To list only the second message from a BUFR file:

     
    >  bufr_ls -w count=2 ../data/bufr/syno_multi.bufr
    


bufr_set examples

  1. 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 
    


  • No labels