Saturday, December 20, 2014

Oh Sure, It Doesn't Look Like Much

... but it took a little effort to parse the text on the California rainfall page into a table with the names of the cities and their percent of normal rainfall totals to date from this year and last. I used PHP Simple DOM Parser to scrape the page and then dealt with the results as a string. It turns out that NOAA didn't make a table of results, the lazy dogs, and instead just used the "pre" HTML tag to create what looks like a table on their page.


CRESCENT CITY9040
EUREKA13136
UKIAH16418
REDDING17031
SACRAMENTO EXEC AIRPORT20536
SACRAMENTO - CSUS1650
SANTA ROSA17318
SAN FRANCISCO20629
SFO INT'L AIRPORT22826
OAKLAND AIRPORT19134
LIVERMORE21152
MOUNTAIN VIEW - MOFFETT26132

Next up - creating a MySQL table and inserting these values into it. Then we'll create a chron job to do it on a daily basis and after that, it's time to look into graphing them.

1 comment:

Trigger Warning said...

If you were a real scientist, you would be using adjusted proxies, not actual rainfall percentages. Tree rings might work, or the seasonally-adjusted number of umbrellas manufactured in China.