Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
bufr.pm:mergebufrtemp.pl [2015-02-04 15:58:56] pals created |
bufr.pm:mergebufrtemp.pl [2015-02-11 12:27:16] pals |
||
---|---|---|---|
Line 123: | Line 123: | ||
my $eddrf = 0; # extended delayed descriptor replication factor | my $eddrf = 0; # extended delayed descriptor replication factor | ||
my ($ii, | my ($ii, | ||
- | while (1) { | + | while ($desc1-> |
- | last if ($desc1-> | + | |
- | | + | |
if ($desc1-> | if ($desc1-> | ||
- | # No more pressure levels in message 1, so fetch from message 2 | + | |
- | | + | |
$i2 += 10; | $i2 += 10; | ||
} elsif ($desc2-> | } elsif ($desc2-> | ||
- | # No more pressure levels in message 2, so fetch from message 1 | + | |
- | | + | |
$i1 += 10; | $i1 += 10; | ||
} elsif ($data1-> | } elsif ($data1-> | ||
Line 149: | Line 148: | ||
$i2 += 10; | $i2 += 10; | ||
} elsif ($data1-> | } elsif ($data1-> | ||
- | # pick the highest pressure, i.e. data1 | + | |
- | | + | |
$i1 += 10; | $i1 += 10; | ||
} else { | } else { | ||
- | # pick the highest pressure, i.e. data2 | + | |
- | | + | |
$i2 += 10; | $i2 += 10; | ||
} | } | ||
Line 174: | Line 173: | ||
$data-> | $data-> | ||
while ($nws1 > 0 || $nws2 > 0) { | while ($nws1 > 0 || $nws2 > 0) { | ||
- | splice(@$desc, $ii, 7, @windshear_level_desc); | + | push(@$desc, @windshear_level_desc); |
if ($nws1 == 0) { | if ($nws1 == 0) { | ||
- | | + | |
- | | + | |
$i2 += 7; | $i2 += 7; | ||
$nws2--; | $nws2--; | ||
} elsif ($nws2 == 0) { | } elsif ($nws2 == 0) { | ||
- | | + | |
- | | + | |
$i1 += 7; | $i1 += 7; | ||
$nws1--; | $nws1--; | ||
Line 188: | Line 187: | ||
# see no reason why data1 should differ from data2 here, | # see no reason why data1 should differ from data2 here, | ||
# so we use data1 | # so we use data1 | ||
- | | + | |
$i1 += 7; | $i1 += 7; | ||
$i2 += 7; | $i2 += 7; | ||
$nws2--; | $nws2--; | ||
} elsif ($data1-> | } elsif ($data1-> | ||
- | | + | |
- | | + | |
$i1 += 7; | $i1 += 7; | ||
$nws1--; | $nws1--; | ||
} else { | } else { | ||
- | | + | |
- | | + | |
$i2 += 7; | $i2 += 7; | ||
$nws2--; | $nws2--; | ||
Line 226: | Line 225: | ||
sub combine_evss { | sub combine_evss { | ||
my ($evss1, | my ($evss1, | ||
- | my $binary1 = pack " | + | |
- | my $binary2 = pack " | + | my $binary1 = pack " |
- | my $binary = $binary1 | $binary2; # bitwise or | + | my $binary2 = pack " |
- | return unpack " | + | my $binary = $binary1 | $binary2; # bitwise or |
+ | return unpack " | ||
+ | } elsif (defined($evss1)) { | ||
+ | return $evss1; | ||
+ | } else { | ||
+ | return $evss2; | ||
+ | } | ||
} | } | ||
Line 245: | Line 250: | ||
Will merge (the first) BUFR message in <bufr file 1> with (the first) | Will merge (the first) BUFR message in <bufr file 1> with (the first) | ||
BUFR message in <bufr file 2> into one single BUFR message, printing | BUFR message in <bufr file 2> into one single BUFR message, printing | ||
- | to STDOUT | + | to STDOUT unless C< |
assumed to be single subset BUFR TEMPs utilizing TM305092 (this is | assumed to be single subset BUFR TEMPs utilizing TM305092 (this is | ||
checked) containing data for the same station and termin (this is not | checked) containing data for the same station and termin (this is not | ||
Line 265: | Line 270: | ||
the same as consulting perldoc mergebufrtemp.pl | the same as consulting perldoc mergebufrtemp.pl | ||
- | Options may be abbreviated, | + | Options may be abbreviated, |
To avoid having to use the C< | To avoid having to use the C< |