The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

SYNOPSIS

bufrencode.pl --data <data file> --metadata <metadata file>
    [--outfile <file to print encoded BUFR message to>]
    [--strict_checking n]
    [--tablepath <path to BUFR tables>]
    [--verbose n]
    [--help]

DESCRIPTION

Encode a BUFR message, reading data and metadata from files. The resulting BUFR message will be printed to STDOUT unless option --outfile is set.

Execute without arguments for Usage, with option --help for some additional info. See also "https://wiki.met.no/bufr.pm/start" for examples of use.

OPTIONS

--outfile <filename>  Will print the encoded BUFR message to <filename>
                      instead of STDOUT

--strict_checking n   n=0 Disable strict checking of BUFR format
                      n=1 Issue warning if (recoverable) error in
                          BUFR format
                      n=2 (default) Croak if (recoverable) error in BUFR format.
                          Nothing more in this message will be encoded.

--verbose n           Set verbose level to n, 0<=n<=3 (default 0).
                      Verbose output is sent to STDOUT, so ought to
                      be combined with option --outfile

--tablepath <path to BUFR tables>
                      If used, will set path to BUFR tables. If not set,
                      will fetch tables from the environment variable
                      BUFR_TABLES, or if this is not set: will use
                      DEFAULT_TABLE_PATH hard coded in source code.

--help                Display Usage and explain the options. Almost
                      the same as consulting perldoc bufrencode.pl

Required options

--metadata <metadata file>

For the metadata file, use this as a prototype and change the values as desired:

BUFR_EDITION  4
MASTER_TABLE  0
CENTRE  88
SUBCENTRE  0
UPDATE_SEQUENCE_NUMBER  0
OPTIONAL_SECTION  0
DATA_CATEGORY  0
INT_DATA_SUBCATEGORY  2
LOC_DATA_SUBCATEGORY  255
MASTER_TABLE_VERSION  14
LOCAL_TABLE_VERSION  0
YEAR  2008
MONTH  9
DAY  1
HOUR  6
MINUTE  0
SECOND  0
OBSERVED_DATA  1
COMPRESSED_DATA  0
DESCRIPTORS_UNEXPANDED  308004 012005 002002

For BUFR edition < 4, replace the lines INT_DATA_SUBCATEGORY, LOC_DATA_SUBCATEGORY, YEAR and SECOND with new lines DATA_SUBCATEGORY and YEAR_OF_CENTURY (the order of lines doesn't matter).

--data <data file>

For the data file, use the same format as would result if you did run on the generated BUFR message

bufrread.pl <bufr file> --data_only | cut -c -31

or if you use bufrread.pl with --width n, replace 31 with n+16. For example, the file might begin with

1  001195          Newport
2  005002            51.55
3  006002            -2.99
4  004001             2008
...

Every time a new line starting with the number 1 is met, a new subset will be generated in the BUFR message. Lines not starting with a number are ignored.

For missing values, use 'missing' or stop the line after the BUFR descriptor.

Associated values should use BUFR descriptor 999999, and operator descriptors 22[2345]000 and 23[2567]000 should not have a value, neither should this line be numbered, e.g.

160  011002          missing
     222000
161  031002              160
162  031031                0
...

To encode a NIL subset, all delayed replication factors should be nonzero, and all other values set to missing except for the descriptors defining the station.

Options may be abbreviated, e.g. --h or -h for --help

AUTHOR

Pål Sannes <pal.sannes@met.no>

COPYRIGHT

Copyright (C) 2010 met.no

1 POD Error

The following errors were encountered while parsing the POD:

Around line 303:

Non-ASCII character seen before =encoding in 'Pål'. Assuming CP1252