Ticket #3811: ENVCANParser.pm.patch

File ENVCANParser.pm.patch, 737 bytes (added by Joe Ripley <vitaminjoe@…>, 18 years ago)

Add wind gust speed parsing.

  • ENVCANParser.pm

    old new  
    119119                        $_[0] =~ /.?(\w+) (\d+) km\/h/;
    120120                        $results{'wind_dir'} = $directions{$1};
    121121                        $results{'wind_speed'} = $2;
    122                         $results{'wind_spdgst'} = $2;
     122
     123            if ($_[0] =~ /gust (\d+) km\/h/m) {
     124                        $results{'wind_gust'}   = $1;
     125            } else {
     126                $results{'wind_gust'} = 0;
     127            }
    123128                }
    124129       
    125130                $scratch = 0;
     
    201206        my ($data, @types) = @_;
    202207
    203208        # Initialize results hash
    204         foreach my $type (@types) { $results{$type} = ""; }
     209        foreach my $type (@types) { $results{$type} = "NA"; }
    205210
    206211        my $p = HTML::Parser->new(api_version => 3);
    207212        $p->unbroken_text(1);