# HG changeset patch # User Matti Hamalainen # Date 1446408285 -7200 # Node ID f7793ef7c925bac9ac8d5f059e5163fe5fa3f1d1 # Parent 9f64f54c2fb3190daa9df25d0d2c88a9bfa8d31e fetch_weather: Improve debugging. diff -r 9f64f54c2fb3 -r f7793ef7c925 fetch_weather.pl --- a/fetch_weather.pl Thu Oct 29 15:51:17 2015 +0200 +++ b/fetch_weather.pl Sun Nov 01 22:04:45 2015 +0200 @@ -284,6 +284,7 @@ else { my $data = $xml->{"soap:Body"}{"RoadWeatherResponse"}; + print STDERR "Checking Tiehallinto response from ".$uri."\n" if (opt_get_int("debug") > 0); # Check if we need to update the static meta data my $meta_file = opt_get("tiehallinto_static_meta"); @@ -332,11 +333,13 @@ # Parse XML and combine with the station meta data if (defined($data->{"roadweatherdata"})) { + my $nrecords = 0; foreach my $wdata (@{$data->{"roadweatherdata"}{"roadweather"}}) { my $wid = $wdata->{"stationid"}; if (defined($meta_data->{$wid})) { + $nrecords++; $weatherdata->{$meta_data->{$wid}[3]} = [ 1, @@ -348,6 +351,7 @@ ]; } } + print STDERR $nrecords." records from Tiehallinto.\n" if (opt_get_int("debug") > 0); } else { @@ -421,11 +425,14 @@ if ($floc->{"gml:pos"} =~ /^\s*([\+\-]?\d+\.\d*)\s+([\+\-]?\d+\.\d*)\s*$/) { my ($flat, $flong) = ($1, $2); + my $nrecords = 0; + # Should use a hash - foreach my $flol (@farray) { if ($flol->{"lat"} == $flat && $flol->{"long"} == $flong) { + $nrecords++; $weatherdata->{$floc->{"gml:name"}} = [ 1, @@ -438,6 +445,7 @@ ]; } } + print STDERR $nrecords." records from FMI.\n" if (opt_get_int("debug") > 0); } } } else {