bufr.pm:dump_flag_tables.pl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
bufr.pm:dump_flag_tables.pl [2010-06-01 12:31:08]
pals removed
bufr.pm:dump_flag_tables.pl [2022-05-31 09:29:31] (current)
Line 1: Line 1:
-<code>+<code perl>
 #!/usr/bin/perl -w #!/usr/bin/perl -w
  
-# Dump all flag tables in table file+# Dump all flag tables in table file
 +# Flag tables not found is printed to STDERR.
 # Author: P.Sannes, met.no 2010-05-12 # Author: P.Sannes, met.no 2010-05-12
  
Line 9: Line 10:
  
 my $table_path = '/usr/local/lib/bufrtables'; my $table_path = '/usr/local/lib/bufrtables';
-my $table = 'B0000000000098013001';+my $Btable = 'B0000000000000014000.TXT'; 
 +my $Ctable = 'C0000000000000014000.TXT';
  
 Geo::BUFR->set_tablepath($table_path); Geo::BUFR->set_tablepath($table_path);
Line 15: Line 17:
 my $bufr = Geo::BUFR->new(); my $bufr = Geo::BUFR->new();
  
-$bufr->load_BDtables($table); +$bufr->load_BDtables($Btable); 
-$bufr->load_Ctable($table);+$bufr->load_Ctable($Ctable);
  
-for my $i (1..50000) {+for my $i (1..48000) {
     my $desc = sprintf "%06d", $i;     my $desc = sprintf "%06d", $i;
     my ($name, $unit) = ($bufr->element_descriptor($desc))[0,1];     my ($name, $unit) = ($bufr->element_descriptor($desc))[0,1];
-    next unless defined $unit && $unit =~ /^FLAG TABLE/; +    next unless defined $unit && $unit =~ /^FLAG( )?TABLE/; 
-    print "$desc $name\n"; +    my $dump = $bufr->dump_codetable($desc, $Ctable); 
-    print $bufr->dump_codetable($desc, $table)+    if ($dump) { 
 +        print "$desc $name\n"; 
 +        print $dump; 
 +    } elsif ($desc%1000 < 192
 +        # Don't care about local tables missing 
 +        print STDERR "Flag table $desc is missing in $Ctable\n"; 
 +    }
 } }
 </code> </code>
  • bufr.pm/dump_flag_tables.pl.1275395468.txt.gz
  • Last modified: 2022-05-31 09:23:11
  • (external edit)