Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weather #55

Open
auscompgeek opened this issue Oct 6, 2013 · 10 comments
Open

weather #55

auscompgeek opened this issue Oct 6, 2013 · 10 comments

Comments

@auscompgeek
Copy link
Contributor

Suggestions:

Here's a whole list of weather APIs (filtered to JSON format).

@auscompgeek
Copy link
Contributor Author

@keepcalm444 could you please share with us how you grab BoM data?

@auscompgeek
Copy link
Contributor Author

Just for reference, this is how another bot behaves when you ask it for weather:

<auscompgeek> `bom sydney olympic park nsw
<notabot> Current Weather Conditions supplied by http://www.bom.gov.au for Sydney Olympic Park, NSW (As of 12:04pm):
<notabot> Temp: 18.1'C (64.58'F), App: 14.9'C, Humidity: 64%, Wind: Moderate breeze, Dir: SE, Sp: 19 Gu: 26 km/h, Min: 15.2'C at 01:10am Max: 20.3'C at 10:48am

@fourkbomb
Copy link
Contributor

here's a gist (it's a php script, found in action here)

stationList is only for NSW though. If it's needed I can generate a few for other states.

@auscompgeek
Copy link
Contributor Author

Here's a Whirlpool thread about the BoM API.

@auscompgeek
Copy link
Contributor Author

Here's a Gist for generating the list of stations (and the actual lists themselves in INI format (yay)) for all the states, because the BoM has some screwed up stuff going on.

@cyphar
Copy link
Contributor

cyphar commented Nov 16, 2013

Does it come with a JSON api? Or do we have to do some type of html scraping? @keepcalm444, can you comment? From what @auscompgeek posted, it looks like you're doing scraping using regex. I point you all to: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags.

@ackwell
Copy link
Owner

ackwell commented Nov 16, 2013

A fair chunk of the scraping is done via Regex for speed reasons (at least legacy speed reasons, I'm a bit out of touch with the codebase right now).
In the python2 version, originally all scraping was being run straight through BeautifulSoup, however on low-power machines like RasPi, it was causing lags of up to a second. Regex was significantly faster.

@cyphar
Copy link
Contributor

cyphar commented Nov 16, 2013

Fair 'nuff. I would like to see some legitimate speed tests (probably with some form of memory profiling too) to see whether or not this is still true with the current codebase (and with py3k). Also, we should do some CProfiler or perf profiling before coming to a decision like that.

@ackwell
Copy link
Owner

ackwell commented Nov 16, 2013

Yeah I really have no idea. Maybe after exams :3

@auscompgeek
Copy link
Contributor Author

@cyphar The BoM has a JSON API (sorta) for weather data, however, you need the IDs of each weather station to do this. I'm not sure whether there's an API to grab weather station IDs.

Yes, I used regex to scrape HTML to generate the ID list. See the 2nd top-voted answer to the Stack Overflow thread you linked to. And yeah, what ackwell said.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants