I ended up dumping the data to the log just to see what's going on about why I can't grab the Dew Point: data, it's apparently not even in the html output, I'm not sure what to change to get that segment, tried a few different things to get more data, but not having any luck. Same for the record lows/highs, its not in the $wzout data. I'm not very well versed on the socket code yet.
But on the good news side, I did get the Observed at, Moonrise and Moonset data into the script's output (yay
I added the "observed at" because weather data for a particular locale is usually from miles away at a nearby station, so I thought it would be useful to know where the data is coming from.
And so, here's another diff file which is in addition to the one above to add the humidity and attempted dewpoint data:
Code: Select all
--- /home/geetob/work/done/in-use/weather.tcl Mon May 8 03:47:26 2006
+++ ./weather.tcl Mon May 8 05:24:04 2006
@@ -847,2 +847,5 @@
## dewpt dew point
+## observed location of weather observations
+## moonrise moonrise
+## moonset moonset
@@ -875,2 +878,5 @@
set dewpt ""
+ set observed ""
+ set moonrise ""
+ set moonset ""
@@ -1022,3 +1026,12 @@
}
-
+ if {$observed == "" && [regexp {Observed At:} $wzout]} {
+ for {set j 0} {$j <=3} {incr j} {
+ set wzout [gets $wzsock]
+ if {[regexp {<td class} $wzout]} {
+ regexp {<td class.*>(.*?)</td>} $wzout match observed
+ regsub -all {<([^<])*>} $observed {} observed
+ }
+ }
+ continue
+ }
@@ -1086,2 +1097,12 @@
## Full Moon?
+ set i 0
+ while {[regexp {>Moon</td>} $wzout] == 0 && $i < 400} {
+ incr i
+ set wzout [gets $wzsock]
+ }
+ set wzout [gets $wzsock]
+ regexp {>(.*?)</td} $wzout match moonrise
+ set wzout [gets $wzsock]
+ regexp {>(.*?)</td} $wzout match moonset
+
@@ -1182,3 +1206,3 @@
if {$updtime != ""} {
- set outupd "\002Updated:\002"
+ set outupd "\002Observed at:\002"
}
@@ -1254,3 +1278,3 @@
}
- $::wz_outmeth "$outtarg : \002$city\002 -- $localtime $outupd $updtime"
+ $::wz_outmeth "$outtarg : \002$city\002 -- $localtime $outupd $observed $updtime"
if {$get_sr_f} {
@@ -1262,2 +1286,3 @@
$::wz_outmeth "$outtarg : The moon $phase."
+ $::wz_outmeth "$outtarg : \002Moonrise:\002 $moonrise \002Moonset:\002 $moonset"
set get_mn_f 0
This is how it looks:
Code: Select all
Somers Point, New Jersey -- 5:35 AM EDT Observed at: Atlantic City, New Jersey 4:54 AM EDT
Temp: 52F/11C Humidity: 67%
Conditions: Overcast Wind: (NE) 7mph/11kmh
Barometer: 30.10in/1019hPa
Moon data:
West Pittston, Pennsylvania -- 5:36 AM EDT Observed at: Avoca, Pennsylvania 4:54 AM EDT
The moon is Waxing Gibbous, 78% of moon illuminated.
Moonrise: 3:42 PM EDT Moonset: 3:43 AM EDT