rivers/getrainfall.pl

23 lines
460 B
Perl
Raw Permalink Normal View History

2016-03-25 07:07:50 +00:00
#!/usr/bin/env perl -w
# Reformat data from Metoffice for use in GNUPlot
# curl http://www.metoffice.gov.uk/hadobs/hadukp/data/daily/HadSEEP_daily_qc.txt | perl getrainfall.pl
use strict;
<>; <>; <>; # swallow first three lines
while(<>) {
chomp;
s/^\s*//;
my ($year, $month, @data) = split (/\s+/);
next unless $year >= 2014;
my $day = 1;
foreach(@data) {
next if $_ < 0;
printf("%04d-%02d-%02d %s\n", $year, $month, $day, $_);
$day++;
}
}