zahniser.net :: software

— etc —

 

— HyperList —

Hierarchical to-do lists

— hsiloP —

Calculator program

— Hexie —

Hex editor

— Mirth —

Read daily comics

— Strange —

Chaotic attractors

 

 

 

contact email:

michael at zahniser dot net

etc :: weatherscrape

Download: weatherscrape.cpp (should compile on any platform. Requires libcurl).

Better Than Botox! Skin Treatments. Sign Up For Our Credit Card! Find Your High School Classmates! Dancing CG People Advertising Low-Rate Mortgages! These are just a few of the many good reasons not to venture out into the wide world of the internet with an ordinary browser.

Enter weatherscrape, yet another product of my infatuation with webscraping (Mirth was the first). Why waste time surfing the internet (and wading through ridiculous amounts of advertising) just to retrieve a 10-day forecast comprising about 300 bytes of information? From the comfort of your shell, just type "$weatherscrape 02140 | tableprint" (replacing 02140 with your zip code, and using tableprint to format the output), and you get all the information you want with none of the cruft:

20080524  Partly Cloudy       67  48  20  
20080525  Sunny               71  53  20  
20080526  Mostly Cloudy       75  59  20  
20080527  Scattered T-Storms  75  50  40  
20080528  Showers             67  49  40  
20080529  Sunny               69  50  20  
20080530  Partly Cloudy       71  51  0   
20080531  Cloudy              71  51  20  
20080601  Showers             68  50  40  
20080602  Sunny               70  51  20  
  

I use GeekTool to display this table on my desktop. It's much more convenient than using the Dashboard on my Mac. In fact, recently I've chosen to disable the Dashboard completely. I've also configured launchd to append the output of weatherscrape to a log file every day. My plan is to collect data for several months, and then analyze it to see how accurate weather.com's predictions are. My suspicion is that they are not much more accurate than simply picking a predicition at random.

(If you want to know how to set up launchd on the Mac to run a program every day, see this example.)

Using g++, compile weatherscrape with the -lcurl option. Or if you prefer the more generic solution, you can supply g++ with the output of "curl-config --cflags --libs". If you're not on Mac OS X, libcurl may not be built in and you'll need to download and compile it.