Wednesday, March 15, 2017

Personalised weather warnings

One of the benefits of having a personal weather station in your back garden is that you should know about local bad weather events quite quickly after they happen. However, the reality is that I don't constantly check the weather data published by my station, so I decided to implement a personal alert system driven off the data.

The obvious protocol for such an alert system is MQTT. However, the MQTT interface module  of the pywws software that I am using to manage my weather station doesn't seem to want to upload any data. After spending time debugging Python (confirming my dislike of the language), I gave up and decided to pursue an alternative strategy based upon the Twitter updates from the station. I implemented a NodeRed  flow on the IBM BlueMix service which monitored the twitter feed and took various actions depending upon what it saw.

The warning rules I decided to implement were:
  • The station is supposed to tweet a weather status every 10 minutes. If 15 minutes or more have passed since the last tweet something has malfunctioned, so the weather station twitter account (@llweather) sends a direct message to my personal account (@bodonovan).
  • When it starts to rain (an all too frequent event in Ireland), the weather station sends me an @reply message to advise me to bring in any washing hanging on the line.
  • The dashboard in my car warns of possible icy roads when the temperature drops below 3 degrees centigrade. Therefore I decided to get my weather station to also send me an @reply message when this happens (luckily this alert gets triggered less frequently in Ireland, but if I moved to Alaska I would need to tweak the threshold).
  • I don't want to be annoyed by repeated tweets about the same weather event, so I put in some code that alerts of the same type won't be repeated more often than once every 6 hours. 
  • The application is configured not to send any warnings between midnight and 7am. I am interested in weather, but not interested enough to lose sleep over it.
It is quite unusual for the temperature in Ireland to drop below 3 degrees at this time of year. Rather than wait for several months to find out if the temperature warning was working I temporarily set the limit to 10 degrees and this is an example of what I got:
Unfortunately, I didn't have to wait too long to get a real rain warning e.g.:

At some stage in the future I will put some more effort into fixing the MQTT problems (partly as a way to learn Python better). But, for now the system seems to be working fine.

Monday, February 13, 2017

My Personal Weather Station comes back on line

Back in March 2011I set up a personal weather station reporting to Weather Underground. Thus continued to report until September 2014 when the hardware I was using died. I recently acquired  replacement hardware and I now have my site on Weather Underground up and working with data being updated every 10 minutes. I am now using a Raspberry Pi rather than a Tonido plug which I was using last time. But, this useful guide on how to get working on a Raspberry Pi helped make it very easy.

I am still using the pywws library, but I am glad to report that it has become even better since the last time.  Using the new functionality, the site is also twittering regularly and also send updates to the UK Met Office and OpenWeatherMap. The software also supports a number of more obscure web sites so it is really easy to widely share the data being collected.

When I first set up the weather station, there were around 4 or 5 stations reporting from Dublin. However, when I checked recently I see that the number of stations reporting from Dublin has grown to over 50 (possibly helped by the fact that Maplin are selling the hardware in kit form quite cheaply).

Previously I could claim to be the only wunderground weather station in Castleknock, but now there are 4 quite close to me. One is about 750 meters south west of me. Another is 1km east of me, while a fourth station is about 1km further east. When I have sufficient data collected I might do a little analysis about how close are the data point reported by the 4 stations in almost the same place.

Last time I mounted the sensors on the boundary wall. Unfortunately this meant that the wind sensors were blocked by overgrown vegetation in neighbouring gardens. This time I decided the put the hardware on the side of shed where I hope it is less likely to become entagngled.

Tuesday, January 10, 2017

How accurate are wind forecasts for Dublin?

In my last post I analysed temperature forecasts for Dublin and today I will turn my attention to wind.

At first glance, the wind readings seemed less consistent with each other than the temperature readings. In particular, the readings from OpenWeatherMap and WeatherUnderground (WU) were consistently lower than the others. However, when I investigated, I found:
  1. I had been interpreting the readings from OpenWeatherMap as kilometres per hour while in fact they were in meters per second. Once I corrected this error, their readings lined up well with other services.
  2. There was no similar simple explanation for the wind speed readings from WU not matching the other services. It was just a problem with their actual data from Dublin - the forecast data for Dublin and the actual readings from other cities lined up with other services. Since weather underground is built upon data from amateur weather stations, I suspect that the weather station they were using for wind speed readings from Dublin was badly positioned e.g. see  the picture of a weather station of mine which used to report to WU before it broke - initially the readings were reasonable, but then the neighbour's hedge grew taller and began to block wind from reaching the station. As a result, I chose to exclude the WU from the calculation of averages and to compare the WU forecasts with the actual reading from other stations rather than their own readings.
The raw data about wind forecasts is available here and a summary table is given below.

ProviderDecimal PlacesAve ErrFcst1 ErrFcst3 ErrFcst7 Err
weatheronline04.306.137.37
openweathermap24.3010.2211.10
weatherunderground115.834.194.026.04
darksky24.893.314.647.07
BlueMix04.284.675.378.07
yr.no25.973.624.317.97
Average excl WU4.755.596.567.70
Average incl WU6.595.366.137.29

A few observations about this table:

  • In general, the accuracy of the wind forecasts is worse than the accuracy of the temperature forecasts. Although you can't compare Celsius readings with km/h readings, if I transformed the data into % error the same conclusion would be reached. This is probably a reflection of the fact that the wind speed in Dublin varies more from day to day than the temperature.
  • On balance DarkSky is probably the overall winner for accuracy, but BlueMix and yr.no are both very close.
  • Surprisingly the wind forecasts from weather underground are almost as accurate as the best services, but their historical reports are so inaccurate that they could not be considered good.
  • In contrast, the wind forecasts from open weather map are noticeably worse than the other services (and weather online is not much better).

While I was writing this post, I found out about an organisation called Forecast Watch who did a much more detailed analysis of weather forecast accuracy. You can read their conclusions here but the quick summary is that most years the winner for the most accurate forecasts was The Weather Channel (which is now an IBM subsidiary and I refer to a BlueMix), but in a few cases the winner was the Weather Underground (also an IBM company) or MeteoGroup (which was not one of the services I analysed). They analysed forecasts for several cities and they found that the best performing service varies significantly from city to city.