Good morning everyone!
I am writing because I am having a little difficulty decompressing the NEXRAD
data that we get. I have searched your email archives for solutions to the
problem, and actually have fallen upon some solutions. When I adjusted the
recommendations to fit our specific configuration and use of the data.. the
Zlib decompression does not work correctly..
I got this portion of code from one of the solutions I saw in the email
archive..
------------------------------------------------
use Compress::Zlib ;
.
.CODE CODE CODE
.MORE CODE
.
while (length($input) > 0) {
$x = inflateInit() || die ("Can't create inflation stream");
($output, $status) = $x->inflate(\$input);
print OUTFILE $output;
if ($status < 0 || $status > 2) { ### status 0 = ok
decompression status 1 = end of data stream
close OUTFILE;
die ("Data did not decompress correctly. Bad data.");
}
}
---------------------------------------------------
Now, I understand all this perfectly fine.. What happened here is that we
did not have the Compress::Zlib module on our system when I first started
looking at the code. I went out and found the module online, downloaded it,
and got it up on our server. When I went to test this code, I threw in some
print statements to see what the "length of output" and "status" were up to.
Well, to my surprise, the length of output never dropped below zero... and
the status returned 1 everytime except once when it returned -3 (error in the
data stream). Here was my output of the first test run:
--------------------------------------------------
INPUT LENGTH REMAINING: 8408 :STATUS: 1
INPUT LENGTH REMAINING: 6230 :STATUS: 1
INPUT LENGTH REMAINING: 3895 :STATUS: 1
INPUT LENGTH REMAINING: 1546 :STATUS: 1
INPUT LENGTH REMAINING: 4 :STATUS: 1
INPUT LENGTH REMAINING: 4 :STATUS: -3
Data did not decompress correctly. Bad data at ./dcmpcmp.pl line 90.
---------------------------------------------------
And the output of the second test run on different data....
---------------------------------------------------
INPUT LENGTH REMAINING: 22963 :STATUS: 1
INPUT LENGTH REMAINING: 20862 :STATUS: 1
INPUT LENGTH REMAINING: 18744 :STATUS: 1
INPUT LENGTH REMAINING: 17307 :STATUS: 1
INPUT LENGTH REMAINING: 17307 :STATUS: -3
Data did not decompress correctly. Bad data at ./dcmpcmp.pl line 90.
----------------------------------------------------
If anyone has faced this problem, or knows of how to deal with this, I'm all
ears. I appreciate all your help in advance.
Thanks again,
Chaz Braxmeier