| View previous topic :: View next topic |
| Author |
Message |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Fri May 05, 2006 11:40 pm Post subject: |
|
|
| DragnLord wrote: | downgrade if you want to, new script has been posted for a while (before your post about "us" user errors)
3.6-b has no problems with Aussie requests. |
erm, what part of this was difficult to understand?
A corrected script was posted after rosc2112 brought up the problems in Oz. |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Sat May 06, 2006 12:09 am Post subject: |
|
|
| rosc2112 wrote: | | Alchera wrote: |
NSW, VIC, ACT, SA, NT, QLD, WA & TAS (all States as we're a Federation).
|
Well, that doesn't tell me what cities are in which State.
| Alchera wrote: |
Anyway, I am endeavouring to downgrade this script to a version that actually once worked! Last version to function correctly was weather3.5.9-a. |
This version works, just have to remove the extra States/Regions for the moment. Or learn Oz geography I guess  |
Okies: Sydney NSW, Melbourne VIC, Adelaide SA, Perth WA, Darwin NT, Brisbane QLD & Canberra ACT.  _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Sun May 07, 2006 5:38 am Post subject: diff file to add barometer |
|
|
Hi, DL, sorry if posting here is annoying. Perhaps you could set up a forum on your site for posts. I've not had any luck catching you on your irc server =)
This is a bit too long to dump in a channel anyway I think. I had a user request barometer and dewpoint stats so I attempted to add them to the script.
I managed to get the barometer reading into it, but for some reason, I'm not getting the dew point. I don't know why, since I'm using the same basic code to grab it, but the regexp is not finding it at all in the $wzout (I didn't dump the contents of $wzout to my log, I probably should. I assumed that 'Dew Point:' would be in there, since that segment is between 'Humidity:' and 'Wind:' in the raw html output).
Anyway, here's the diff file to add the barometer, and the segment for dew point:
| Code: |
--- /home/geetob/work/weather3.6-a.tcl Fri May 5 02:37:45 2006
+++ /home/geetob/scripts/weather.tcl Sun May 7 03:05:24 2006
@@ -848,2 +845,4 @@
## wdir wind direction
+## pressure barometer
+## dewpt dew point
@@ -874,2 +873,4 @@
set wfntemp ""
+ set pressure ""
+ set dewpt ""
@@ -996,2 +997,28 @@
}
+ if {$dewpt == "" && [regexp Dew.Point: $wzout]} {
+ putcmdlog "hmm"
+ for {set j 0} {$j <= 5} {incr j} {
+ set wzout [gets $wzsock]
+ if {[regexp <b> $wzout]} {
+ regexp {b>(.*?)</b>} $wzout match dewpt
+ regsub -all {<([^<])*>} $dewpt {} dewpt
+ break
+ }
+ }
+ putcmdlog "dew $dewpt"
+ continue
+ }
+
+ if {$pressure == "" && [regexp Pressure: $wzout]} {
+ for {set j 0} {$j <=10} {incr j} {
+ set wzout [gets $wzsock]
+ if {[regexp <b> $wzout]} {
+ regexp {b>(.*?)</b>} $wzout match pressure
+ regsub -all {<([^<])*>} $pressure {} pressure
+ lappend pressure2 $pressure
+ }
+ }
+ continue
+ }
+
if {$hindex == "" && [regexp {Heat Index} $wzout]} {
@@ -1181,2 +1209,11 @@
}
+ if {[regexp {[0-9]} $pressure2] == 0} {
+ set pressure "\002Barometer:\002 NR"
+ set noreport "(No Report)"
+ } else {
+ set baro1 [lindex $pressure2 0]
+ set baro2 [lindex $pressure2 1]
+ set baro [format "\002Barometer:\002 %sin/%shPa" $baro1 $baro2]
+ }
+
if {$wind == ""} {
@@ -1230,2 +1267,3 @@
$::wz_outmeth "$outtarg : \002Conditions:\002 $cond \002Wind:\002 $outwind"
+ $::wz_outmeth "$outtarg : $baro"
}
|
I'm also going to try to add the record highs/lows, and moonrise/moonset data. I'll post that if I'm successful  |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Mon May 08, 2006 5:39 am Post subject: another diff, add observed at, moonrise/moonset |
|
|
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: |
--- /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: |
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
|
|
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Mon May 08, 2006 7:52 am Post subject: |
|
|
I'm sure you will have a lot of fun maintaining your script.  |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
|
| Back to top |
|
 |
popmonkey Voice
Joined: 29 Apr 2006 Posts: 6
|
Posted: Mon May 15, 2006 8:33 pm Post subject: |
|
|
how does one query for a city that consists of more than one word.
example: le mans fr
i tried:
| Code: |
.wz le mans fr
.wz le+mans fr
.wz le%20mans fr
.wz "le mans" fr
.wz 'le mans' fr
.wz le\ mans fr
|
etc. etc. etc.
looking at the code it looks like you split on space so multi word cities are broken up incorrectly. wunderground's query uses standard url encoding. |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Mon May 15, 2006 11:19 pm Post subject: |
|
|
I bet you didn't bother to check the website.
| Code: | | http://www.wunderground.com/cgi-bin/findweather/getForecast?query=le+mans |
wunderground.com has no reported current conditions for that location; go bug them about it, not me
The script works fine, there is no information available from the website which means no output to give.
Edit:
add to procedure wz_socket to get the "no report" output (will be added to future version) |
|
| Back to top |
|
 |
popmonkey Voice
Joined: 29 Apr 2006 Posts: 6
|
|
| Back to top |
|
 |
popmonkey Voice
Joined: 29 Apr 2006 Posts: 6
|
Posted: Tue May 16, 2006 6:51 pm Post subject: |
|
|
3.6-b works. 3.5.9-b did not.
i didn't see anything in the change history that said anything other than country codes had changed.
ok, happy now. thanks. |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Tue May 16, 2006 6:55 pm Post subject: |
|
|
| popmonkey wrote: | http://www.wunderground.com/cgi-bin/findweather/getForecast?query=le+mans works just fine.
as does http://www.wunderground.com/global/stations/07235.html
but for some reason the script isn't reading the data. i straced eggdrop and you do convert to the latter so it seems to be a page parsing issue if anything.
i'll grab the latest version of the script and try again. |
I see no current weather condition information on either of those pages for the script to grab.
Since the webpage has to show the conditions for the script to grab them, it returns nothing.
Refer your complaints to wunderground.com. |
|
| Back to top |
|
 |
popmonkey Voice
Joined: 29 Apr 2006 Posts: 6
|
Posted: Tue May 16, 2006 7:02 pm Post subject: |
|
|
there's forecast information but .wzf doesn't work
(btw, i noticed you updated the script to include the outupd "" already, thanks) |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Tue May 16, 2006 8:02 pm Post subject: |
|
|
| without current weather conditions, the script doesn't have what it needs to locate the forecast info |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Tue May 23, 2006 9:08 am Post subject: couple of bugs |
|
|
Found a couple of bugs, can't figure out how to fix em.
In the section where '-u' is checked for valid syntax, it does not return the error msg as it should.
| Code: |
set wz_tunit $wz_unit
if {[regexp -- {(-u )([imc])} $location match yoo wz_tunit]} {
set wz_tunit_reset 1
if {[regexp {[imc]} $wz_tunit] == 0} {
puthelp "NOTICE $nick :Proper syntax for units is $::wzbind -u <imc> <city,state|zip> <country> ... ^BI^Bmperial, ^BM^Betric, or ^BC^Bombined.
return 0
}
regsub -- {-u [imc] ?} $location {} location
}
|
Another is, for some reason, sun and moon data is not returned for foreign countries, even though looking at the source html for their pages shows the same html format as for US locations. The only apparent difference is where its at on the page.
And, for the precipitation code, it doesn't close the socket on some of the errors/returns. |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Tue May 23, 2006 9:34 am Post subject: |
|
|
What version are you using?
I have not been able to reproduce those with the current version.
Perhaps some more information, such as what locations do not show sun and/or moon data.
What locations cause socket errors with precipitation?
The biggest question, why haven't you reported the bugs through the proper method? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|