Interrogating the Skies: Data Analytics for the Weather Enthusiast

Editor’s note: This post is part of a continuing series demonstrating the ubiquity of Wavefront to ingest and analyze metrics from practically anywhere. With the rise of IoT in our personal lives, there are many fun ways to experience the power of Wavefront quickly. From there, it’s easy to see how it can help you on the job, specifically if your responsibilities include improving the performance of complex, multi-layered systems, such as cloud-native, web-scale environments.

Last year, California’s fire season duration was one of the longest ever recorded, while just recently, it was snowing in Louisiana. We’re all witnessing rapid changes in climate patterns now in front of our eyes. Wouldn’t it be nice if you can observe and track the weather right around you? With the many microclimates in SF Bay Area, having a personal weather report can be rather useful.

Recently, I discovered “Personal Weather Station” devices that let you monitor and report your own hyperlocal weather. These devices gather various forms of meteorological data and report it to popular weather websites such as Wunderground. Wunderground creates its weather forecasts by gathering data from this huge network of personal weather stations. You can also do the same. By sending this data directly to the Wavefront analytics platform in the cloud, you can easily observe and analyze your local weather patterns. And even try forecasting your own weather.

Additionally, Wunderground lets anyone get an API key and make 500 API calls a day for free! Anyone can request all types of weather data from anywhere in the world in JSON format, but for the purposes of this post, we’ll focus on getting weather data purely from your own personal weather station.

Each circle on this map of San Francisco represents a connected personal weather station.

The particular weather station that I purchased was the Ambient Weather WS-2902. It comes with the weather station hardware, and a tablet-like device that wirelessly connects to your home internet and automatically reports to AmbientWeather.com and other weather sites that you can choose from (such as Wunderground.com). The main purpose of the tablet is to display the current weather statistics. The tablet’s connection to your home internet and the weather sites can all be configured through the phone app that included. Setup is relatively easy. You’ll also get a handful of set charts from the Wunderground and Ambient Weather apps, but who wants to use those limited charts when you could have the data analyzed and visualized in Wavefront?

With the cloud-hosted, Wavefront metrics-driven analytics platform, you get high granularity in your metrics data without losing any data points over time, as there is no time limit on data retention. Users can also apply mathematical functions to correlate and find trends and compare with previous days/months/years. Everything is ultimately customizable so you can create your own dashboards, set alerts, and automate actions by what’s happening in the skies around you in real-time.

For example, we can gather the total inches of rain in any month. Then, we can create alerts when certain conditions are met, another benefit for getting the data into Wavefront. If I have a crawl space that tends to flood, I can have Wavefront alert me when my PWS measures over 2 inches of rain so I remember to turn on the sump pump (or better yet, turn it on automatically).

Moreover, Wavefront’s API is completely open, so you can easily integrate it with other smart home objects or applications. For example, if the UV index is high, we can make Wavefront talk to our automated blinds and close them to keep the house cool.

It is easy to get data from Wunderground into Wavefront. Just use the following lines of code (in Python) as an example:

f=urllib2.urlopen(‘http://api.wunderground.com/api//conditions/q/pws:.json’)
= f.read()
parsed_json = json.loads(json_string)
temp_f = parsed_json[‘current_observation’][‘temp_f’]

#the following line sends to a wavefront proxy (socket open on 2878)
sock.sendall(‘weather.temp_f ‘ + str(temp_f) + ‘ source=’ + sourceName + ‘\n’)

Here is a dashboard below that I created in about 30 minutes. Some of the charts simply track the raw metrics that my personal weather station generated, while others, I pre-processed using some Wavefront analytic functions (any Wavefront query can be easily converted into a chart on a dashboard).

Got your own weather station? See if you can spot any local weather trends – try sending your data to Wavefront. We offer a free trial. Let me know how you like it. I can be reached at @durrenshen on Twitter.

About the Authors

Durren Shen

Sr. Staff Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *