1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## /tmp/weather.pl.patch.dpatch by <jari.aalto@cante.net>
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Fix Perl warnings, array subscript, test directory
9
diff --git a/Src/weather.pl b/Src/weather.pl
10
index 27a4f88..247e02c 100755
14
#Thibaut Colar: http://www.colar.net/
17
-#The Weather data can be retrieved through http of ftp.
18
-#Http is faster, however this might get broken if NOAA change their webpage layout
19
+#The Weather data can be retrived through http of ftp.
20
+#Http is faster, however this might get broken if NOAA change theyr webpage layout
21
#in wich case you should choose ftp.
22
$mode="http"; # html || ftp
25
########################################
27
########################################
28
-($station,$tmpfolder)=@ARGV;
31
+($station,$tmpfolder, $debug)=@ARGV;
33
$html="http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc=${station}";
34
$ftp="ftp://weather.noaa.gov/data/observations/metar/stations/${station}.TXT";
35
@@ -28,7 +25,7 @@ if($mode eq "ftp")
37
$file="${tmpfolder}/${station}_dat";
43
while((! ($line=~m/START BODY OF TEXT HERE/)) && !eof(DATA))
44
@@ -51,7 +48,7 @@ exit(0);
48
-($crap,$time)=split(/\ /,$line);
49
+(undef,$time)=split(/\ /,$line);
50
($hour,$minute)=split(/:/,$time);
53
@@ -72,45 +69,45 @@ close DATA;
55
@args=split(/\ /,$line);
67
if(($station eq 'METAR') or ($station eq 'SPECI'))
69
- $station=@args[$i+1];
70
+ $station=$args[$i+1];
84
-$visibility=@args[$i];
85
+$visibility=$args[$i];
87
if( ! ($visibility=~m/SM/ || ($visibility eq "CAVOK")) )
89
#print "Visibility fraction\n";
90
$i++; # visibility with fractions, ignoring
96
#print "Visibility feet\n";
97
$i++; # visibility in feet, ignoring
104
-while((! (@args[$i]=~/\//)) && ($i<@args))
105
+while((! ($args[$i]=~/\//)) && ($i<@args))
109
@@ -119,7 +116,7 @@ while((! (@args[$i]=~/\//)) && ($i<@args))
117
if($curent=~/^CAVOK/)
118
@@ -130,7 +127,7 @@ while((! (@args[$i]=~/\//)) && ($i<@args))
121
$clouds.="VV,".substr($curent,2,3).";";
122
- $wasNotCloud="yes";
123
+ # $wasNotCloud="yes";
125
if(($curent=~/^CLR/) or ($curent=~/^SCK/) or ($curent=~/^FEW/) or ($curent=~/^SCT/) or ($curent=~/^BKN/) or ($curent=~/^OVC/))
127
@@ -183,7 +180,7 @@ if(($wasCloud ne "yes"))
131
-($temp,$dew)=split(/\//,@args[$i]);
132
+($temp,$dew)=split(/\//,$args[$i]);
135
$dir=substr($wind,0,3);
136
@@ -242,32 +239,37 @@ if($dew eq "")
139
#check for ok temperature
140
-open(GREP, "grep Temp $tmpfolder/${station} | ");
142
-$templine=~m/^Temp:(.*)$/;
144
+if ( -d "$tmpfolder/$station" )
147
- if($temp>-50 && $temp<150)
149
- if($lasttemp>-50 && $lasttemp<150)
151
- if($temp>-2 && $temp<2)
153
- if($lasttemp>7 || $lasttemp<-7)
166
+ open(GREP, "grep Temp $tmpfolder/${station} | ");
169
+ $templine=~m/^Temp:(.*)$/;
172
+ if($temp>-50 && $temp<150)
174
+ if($lasttemp>-50 && $lasttemp<150)
176
+ if($temp>-2 && $temp<2)
178
+ if($lasttemp>7 || $lasttemp<-7)
196
#print "$$station\n";
197
if(length($station)==4)