#!/usr/bin/perl -w
# Dump all flag tables in table file
# Author: P.Sannes, met.no 2010-05-12
use strict;
use Geo::BUFR;
my $table_path = '/usr/local/lib/bufrtables';
my $table = 'B0000000000098013001';
Geo::BUFR->set_tablepath($table_path);
my $bufr = Geo::BUFR->new();
$bufr->load_BDtables($table);
$bufr->load_Ctable($table);
for my $i (1..50000) {
my $desc = sprintf "%06d", $i;
my ($name, $unit) = ($bufr->element_descriptor($desc))[0,1];
next unless defined $unit && $unit =~ /^FLAG TABLE/;
print "$desc $name\n";
print $bufr->dump_codetable($desc, $table)
}