Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
bufr.pm:sortbufrtemp.pl [2015-02-16 14:27:50] pals created |
bufr.pm:sortbufrtemp.pl [2022-05-31 09:29:31] (current) |
||
|---|---|---|---|
| Line 126: | Line 126: | ||
| } | } | ||
| - | | + | |
| - | if ($verbose > 1 && $isub == 1) { | + | if ($descriptors_unexpanded |
| + | if ($verbose > 0 && $isub == 1) { | ||
| print " | print " | ||
| print " contained in bulletin with ahl $ahl" if $ahl; | print " contained in bulletin with ahl $ahl" if $ahl; | ||
| - | print " since unexpanded descriptors did not start with 309052\n"; | + | print " since unexpanded descriptors did not start with 309052 |
| } | } | ||
| next; | next; | ||
| } else { | } else { | ||
| - | if ($verbose > 2) { | + | if ($verbose > 3) { |
| print " | print " | ||
| print " contained in bulletin with ahl $ahl" if $ahl; | print " contained in bulletin with ahl $ahl" if $ahl; | ||
| Line 141: | Line 142: | ||
| my @plevels; # array of references to the 10 data values of | my @plevels; # array of references to the 10 data values of | ||
| # one pressure level | # one pressure level | ||
| - | my $i1 = 29; | + | my $i_eddrf |
| + | my $i1 = $i_eddrf; | ||
| while ($desc-> | while ($desc-> | ||
| my @record = @$data[$i1 .. $i1+9]; | my @record = @$data[$i1 .. $i1+9]; | ||
| if (defined $record[2]) { | if (defined $record[2]) { | ||
| push @plevels, \@record; | push @plevels, \@record; | ||
| - | } elsif ($verbose > 1) { | + | } elsif ($verbose > 2) { |
| - | print " | + | print " |
| . " in subset $isub in Message number $imsg"; | . " in subset $isub in Message number $imsg"; | ||
| print " in $ahl" if $ahl; | print " in $ahl" if $ahl; | ||
| Line 166: | Line 168: | ||
| } | } | ||
| my ($new_data, $new_desc) | my ($new_data, $new_desc) | ||
| - | = get_sorted_data($data, | + | = get_sorted_data($data, |
| $subset_data[$isub] = $new_data; | $subset_data[$isub] = $new_data; | ||
| $subset_desc[$isub] = $new_desc; | $subset_desc[$isub] = $new_desc; | ||
| Line 184: | Line 186: | ||
| ## missing) | ## missing) | ||
| sub get_sorted_data { | sub get_sorted_data { | ||
| - | my ($data, | + | my ($data, |
| my ($new_data, | my ($new_data, | ||
| # Section 4 up to where pressure level data starts is unaltered | # Section 4 up to where pressure level data starts is unaltered | ||
| - | for my $ii (0 .. 27) { | + | for my $ii (0 .. $i_eddrf-2) { |
| $new_desc-> | $new_desc-> | ||
| $new_data-> | $new_data-> | ||
| Line 194: | Line 196: | ||
| # Then handle pressure levels (and eddrf) | # Then handle pressure levels (and eddrf) | ||
| - | $new_desc-> | + | $new_desc-> |
| - | $new_data-> | + | $new_data-> |
| my $eddrf = 0; # extended delayed descriptor replication factor | my $eddrf = 0; # extended delayed descriptor replication factor | ||
| Line 212: | Line 214: | ||
| && same_pos_time(\@prev_plevel, | && same_pos_time(\@prev_plevel, | ||
| # Combine the two levels into 1 | # Combine the two levels into 1 | ||
| - | if ($verbose > 1) { | + | if ($verbose > 2) { |
| print " | print " | ||
| } | } | ||
| Line 240: | Line 242: | ||
| $eddrf++; | $eddrf++; | ||
| - | $new_data-> | + | $new_data-> |
| # Section 4 after pressure level data is unaltered | # Section 4 after pressure level data is unaltered | ||
| Line 275: | Line 277: | ||
| my $ii = 0; | my $ii = 0; | ||
| foreach my $PP (@PP) { | foreach my $PP (@PP) { | ||
| - | return 0 if $PP > $prev_PP; | + | if ($PP > $prev_PP) { |
| + | if ($verbose > 1) { | ||
| + | print "Not sorted after pressure level $prev_PP"; | ||
| + | print " (next level is $PP)\n"; | ||
| + | } | ||
| + | return 0; | ||
| + | } | ||
| if ($PP == $prev_PP) { | if ($PP == $prev_PP) { | ||
| - | | + | if (same_pos_time($plevels-> |
| - | } | + | if ($verbose > 1) { |
| + | print " | ||
| + | } | ||
| + | return 0; | ||
| + | } | ||
| + | } | ||
| $prev_PP = $PP; | $prev_PP = $PP; | ||
| $ii++; | $ii++; | ||
| Line 314: | Line 327: | ||
| Will extract from <bufr file> all BUFR TEMPs (recognized by unexpanded | Will extract from <bufr file> all BUFR TEMPs (recognized by unexpanded | ||
| - | descriptors in section 3 starting with 309052), sorting the pressure | + | descriptors in section 3 starting with 309052 |
| - | levels and merging duplicate pressure levels (having same pressure, | + | pressure |
| - | time and location coordinates) into one single level, printing to | + | pressure, time and location coordinates) into one single level, |
| - | STDOUT unless C< | + | printing to STDOUT unless C< |
| - | pressure will be removed. | + | missing |
| Execute without arguments for Usage, with option C< | Execute without arguments for Usage, with option C< | ||
| Line 333: | Line 346: | ||
| n>=1: prints which BUFR messages were actually altered, | n>=1: prints which BUFR messages were actually altered, | ||
| and which messages were removed because unexpanded | and which messages were removed because unexpanded | ||
| - | descriptors did not start with 309052 | + | descriptors did not start with 309052 |
| - | n>=2: prints which pressure levels were merged, | + | n>=2: prints at which pressure level sorting |
| - | which levels were removed due to missing pressure | + | breaks, or first duplicate level encountered |
| - | n=3: prints which subset, message number and ahl | + | (whichever of these conditions happened |
| + | first) | ||
| + | n>=3: prints which pressure levels were merged, | ||
| + | | ||
| + | | ||
| + | n=4: prints which subset, message number and ahl | ||
| (if exists) is currently processed | (if exists) is currently processed | ||
| Verbose output is sent to STDOUT, so ought to be | Verbose output is sent to STDOUT, so ought to be | ||
| combined with option --outfile | combined with option --outfile | ||
| | | ||
| - | the same as consulting perldoc | + | the same as consulting perldoc |
| Options may be abbreviated, | Options may be abbreviated, | ||