All pastes #728399 Raw Edit

Untitled

public text v1 · immutable
·published 2007-10-06 23:05 UTC
rendered paste body
#!/usr/bin/env perl

use strict;
use warnings;
my ($in,@array,$i,@foo,$lat,$lon);
$in=0;

#       &obs;
        &fcst;

sub obs {
        while(<>){
                if (/^OBS ASH CLOUD/) {
                        $in=1;
                }
                elsif (/^\n/) {
                        $in=0;
                }

                chomp;
                if($in) {
                        $_=~ s/-//g;
                        $_=~ s/N//g;
                        $_=~ s/S/-/g;
                        $_=~ s/E//g;
                        $_=~ s/W/-/g;
                        @array=split(/\s+/);
                        push(@foo, @array);
                }
        }

        shift (@foo);
        shift (@foo);
        shift (@foo);
        shift (@foo);
        pop (@foo);
        pop (@foo);
        pop (@foo);
        pop (@foo);

        #$_ /= 100 for @foo;

        for ($i = 0; $i <= $#foo; $i=$i+2) {
                $lat=$foo[$i]/100;
                $lon=$foo[$i+1]/100;
                print "$lat ";
                print "$lon\n";
        }
}

sub fcst {
        while(<>){
                if (/^FCST ASH CLOUD \+6H/) {
                        $in=1;
                }
                elsif (/^\n/) {
                        $in=0;
                }

                chomp;
                if($in) {
                        $_=~ s/-//g;
                        $_=~ s/N//g;
                        $_=~ s/S/-/g;
                        $_=~ s/E//g;
                        $_=~ s/W/-/g;
                        @array=split(/\s+/);
                        push(@foo, @array);
                }
        }

        shift (@foo);
        shift (@foo);
        shift (@foo);
        shift (@foo);
        shift (@foo);
        shift (@foo);

        #$_ /= 100 for @foo;

        for ($i = 0; $i <= $#foo; $i=$i+2) {
                $lat=$foo[$i]/100;
                $lon=$foo[$i+1]/100;
                print "$lat ";
                print "$lon\n";
        }
}