Skip to content

Instantly share code, notes, and snippets.

@perlpilot
Created March 9, 2012 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perlpilot/2007874 to your computer and use it in GitHub Desktop.
Save perlpilot/2007874 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
# count the valid data points per series
my %count;
for $*IN.lines -> $line {
next if $line ~~ /^ '#'/;
my ($stnid,$date,$ser, @vals) = $line.words;
for @vals {
%count{$stnid} //= {};
%count{$stnid}{$ser}++ unless $_ eq any(<NA RM>);
}
}
for %count.keys -> $stnid {
for %count{$stnid}.kv -> $ser, $count {
say "$stnid $ser $count";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment