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.

Thursday, December 29, 2016

How accurate are temperature forecasts for Dublin

I got a very positive reaction to my presentation about my weather forecast tracking application on Bluemix. Most people who saw this presentation asked which weather forecast service was best. Unfortunately I had to reply to them that I didn't know because I had only just built the app and never used it yet to do any detailed analysis. This post is an attempt start rectifying that error by looking at the accuracy of the various services for forecasting temperature in Dublin over the last month.

At the innovation showcase event a number of people spoke highly of  the Norwegian forecast service yr.no and claimed that it was the most accurate in their experience. Therefore, I decided to add this service into my data collection service (it is a testament to the flexible architecture that this was a relatively easy task) and wait until a month had passed before beginning analysis so that we had  enough data from them to compare.

I chose to initially analyse data from Dublin since this is where I live. I analysed temperature readings and forecasts for the period from 22nd of November to 21st of December 2016. I looked at the actual weather reported as well as the forecast for next day and the forecast for 3 days time. Some of the services offered forecasts for further into the future, but I chose to pick the 3 day forecast because this was supported by all services. If you want, you can see the actual data here.

The thing that most people commented upon at the innovation showcase was the fact that actual temperature data reported by each service did not match up exactly. When I analysed this, I noticed that some of this difference was down to data rounding. The temperature data reported by OpenWeatherMap  and DarkSky is given in celcius with 2 decimal places, in contrast WeatherUnderground and yr.no only give a single decimal place and both WeatherOnline and the BlueMix weather data are reported in whole numbers.

People asked me which service was actually correct, but the truth is that I have no way to tell. What I decided to do was to compute the average of the temperature reported by all services and then comparing the number reported by each service to this average. As you can see from the table below, the average error was actually quite small - not much more  than the average of 0.25 degrees which would be expected from rounding error. Interestingly, the yr.no service has the greatest level of difference from the average.

For assessing the forecasts I looked at the difference between the temperature that was forecast 1 or 3 days earlier and the actual temperature reported on the date in question. I also looked at the forecasts for one week ahead, although this could only be done for 4 of the 6 services since WeatherOnline and OpenWeatherMap don't supply 1 week forecasts.

The average level of error was slightly higher for 3 days in advance  (1.74 degrees) than it was for 1 day in advance (1.41 degrees) and higher again (1.95 degrees) for 7 day forecasts. The most accurate forecasts were from the BlueMix weather service across all 3 timespans. The second most accurate 1 daya forecasts were from the yr.no service although the 3 day and 7 forecasts from yr.no were definitely worse - the 7 day forecasts from yr.no were the worst of all services..


-->
ProviderDecimal PlacesAve ErrFcst1 ErrFcst3 ErrFcst7 Err
weatheronline00.391.201.37
openweathermap20.371.932.21
weatherunderground10.581.962.012.30
darksky20.521.591.791.30
BlueMix00.520.800.801.30
yr.no10.750.962.282.90
Average0.521.411.741.95

-->

Overall, I think the conclusion is that the temperature forecasts are actually quite close to the  actual values, but the details might vary if I looked at a longer time period and/or more cities.

In reality temperature forecasts are relatively easy since temperature doesn't vary widely from day to day in this part of the world. Next I will look at wind speed forecasts since these might be more variable and also because I have been told that they are closely watched by insurance companies since wind speed correlates with weather damage,



-->-->

Saturday, December 3, 2016

Where the streets have too many names

U2 had a big hit with a song named "Where the streets have no name", but in Ireland many streets have more than one name. Sometimes the change is minor, like when "Baggot Street Upper" becomes "Baggot Street Lower", but other times the streets have totally unconnected names. This is very confusing for visitors and locals alike.

One of the worst examples starts off in Rathmines, where you can travel 3 km along a straight road but officially be walking on 9 different street names:
  1. The journey starts on "Rathmines Road Upper".
  2. As you head north you will see that the road becomes "Rathmines Road Lower" which probably is no surprise.
  3. Continue straight and as you pass over the canal and you will see that for a short time you are travelling on "Richmond Street South". If this was not confusing enough, after a short while you will come to a junction where you can either continue straight or turn right and in both cases you would still be on  "Richmond Street South".
  4. Assuming you keep straight, the road will transform itself into "Camden Street Upper".
  5. Unsurprisingly this road changes its name into "Camden Street Lower".
  6. However, if you continue straight on the same road, you might be a little confused to find that the road transforms again into "Wexford Street".
  7. Many Dubliners know "Wexford Street", but relatively few realize that if you continue walking straight along this street you will be on "Redmond's Hill". If you are looking for this piece of the road, don't be fooled by the name into thinking that there should be some slope in the road - this is a perfectly flat stretch of road.
  8. If you are confused to find yourself on "Redmond's Hill", don't worry - it only lasts about 100 meters or so before transforming into "Aungier Street".
  9. "Aungier Street" is reasonably long, but clearly some city planners decided that it was too long since it changes without warning into "South Great George's Street". Don't be fooled into thinking that walking north on "South Great George's Street" would bring you to "North Great George's Street" - that street is several km away in a different part of town. Instead the road comes to an abrupt end in a T-junction with "Dame Street" (needless to say "Dame Street" also has several names)..
Is it any wonder that tourists get confused when they ask someone what street they are walking along and they are told "Aungier Street" and then 5 minutes later they ask someone  else and they are assured that they are walking along "South Great George's Street" despite the fact that they have been walking straight all the time.

Sunday, November 20, 2016

Confusing presidential ballot

I am lucky enough to have an absentee ballot in US presidential elections. Of course I knew that Clinton and Trump were battling it out for the Democrats and Republicans. I vaguely heard that there were additional candidates for the Libertarian and Green parties, so I was expecting to see 4 names on the ballot, However, when I got my absentee ballot, I was surprised to see 8 candidates that I could vote for, Closer scrutiny revealed that many of the candidates were listed more than once.

Hillary Clinton is the candidate for the Democratic Party, but is also listed separately as the candidate for the Women's Equality Party and the candidate for the Working Families Party (neither of which I heard of before). Likewise Donald Trump is listed as the Republican Party candidate and separately listed as the candidate for the Conservative Party (which I thought was based in the UK).

I had vaguely heard that Gary Johnson was running for the Libertarian candidate, but the ballot also lists him as the candidate for the Independence Party. Poor Jil Stein of the Green Party is the only candidate who has to make do with a single listing on the ballot.

What I am not sure of is if it makes any difference if I tick the box beside the Democratic Party or the box beside the Working Families Party? Could it be that Hillary and/or Donald are splitting their vote or do the counters amalgamate both sets of ticks?

Tuesday, November 8, 2016

My weather forecast tracking project.on BlueMix

In Ireland people are obsessed about the accuracy (or otherwise) of weather forecasts. This is why I previously did a small project to compare the accuracy of a three different online weather forecast services for Ireland. This project was limited and, only looked at Ireland over a short time period. However, because the way I collected data was only partially automated, it was impractical to extend it without a radical change.

IBM has recently launched the BlueMix cloud platform with lots of cool features which make it ideal to do what I wanted i.e. collect, store and process weather data. Therefore I decided to re-implement my earlier idea with a much wider scope.

There are lots of services available on the internet for current weather data and forecasts. As I mentioned before, there are even some which offer historic weather data, but none which offer access to historic forecasts - i.e. they will tell you what they predict tomorrow's weather is going to be, but they won't tell you what they predicted yesterday for today's weather. Therefore I need to collect and store the weather forecasts so I can later analyse them.

There are so many different services offering weather forecasts on the internet that it was hard to decide which ones to use. I picked the services to use mainly based upon the ease of use of their API:
I started by collecting data for cities with which I had some association, but this collection didn't cover the globe very well. So I then added in a few random cities which increased my geographic and climate type distribution. (e.g. Antarctica covered an extreme in both directions).

The current list of cities monitored are:
  • Antarctica (not really a city, but I picked a point beside the south pole).
  • Canterbury, New Zealand
  • Cape Town, South Africa
  • Coral Springs, Florida, USA
  • Clemmons, North Carolina, USA
  • Dublin, Ireland
  • Galway, Ireland
  • Honolulu, Hawaii, USA
  • Isle of Wight, UK
  • Lanzarote, Canary Islands, Spain
  • Luxor, Egypt
  • Perth, Western Australia
  • Rio de Janeiro, Brazil
I know that most of these services update their forecasts several times a day, but I decided to make things simple by collecting weather data and forecasts once a day at midday. Working out midday in local time would be complex, especially since some of the cities implement daylight savings time at different times of the year and in different directions. Instead I decided to use the concept of solar midday - i.e. the time when the sun is highest at the city. This had the advantage of spreading out the sampling so that the system is not overloaded by taking many samples at the same time - e.g. the Isle of Wight has a solar midday at 5 minutes past 12 UTC, while Lanzarote has a solar midday of 54 minutes past 12 UTC despite the fact that the two locations use the exact same local time.

All of the weather services I used allow me to specify the latitude and longitude of where I want data or a forecast for. For larger cities I have a reasonably wide choice of where exactly within the city boundary I specify. However, the services don't have enough weather stations to provide coverage of everywhere. When I request data about a specific location the services will instead return information about the closest location that they have information about. This possibly explains some of the differenced between the services.

I added Antarctica to the list of cities so that I would have an extremely cold climate to compare with warmer locations like Luxor, Egypt. In fact, Antarctica  is not a city as such: there are no cities in such an inhospitable place. Unsurprisingly, not all of the weather services provide data or forecasts for Antarctica. Only OpenWeatherMap and DarkSky provide weather reports for Antarctica, but surprisingly BlueMix does also provide forecasts for here.

Technology Overview

As a computer geek, I am naturally most interested in the inner workings of how the data gets collected and processed. Therefore I decided to include a brief overview here, with the detail saved for a later post. However, if you are only interested in weather then jump to the next section which describes how to access the data.
  • As I mentioned, the project used the Bluemix platform. More specifically, I used the "Internet-of-Things (IOT) template" which provided me with the Node-Red programming environment and a Cloudant NoSQL database service to store my data. This was my first significant application to develop with Node-Red, but I had no problems getting to grips to this programming environment. It was also my first significant use of a NoSQL database. I created a database for the forecasts, but I also created additional ones to store logs of the various steps in the process.  Putting data into the database was really easy, but getting it back out again was not so easy - on a few occasions I was tempted to use a traditional SQL database.
  • All of the weather services report the weather data in different formats and so I needed to extract the data into a common format so they could be compared. This inevitably meant that I needed to discard some interesting information which is only supplied by one service. An example of the type of record I store is shown below:
    {
      "provider": "darksky",
      "request_date": "2016-11-01T00:32:00.980Z",
      "city": "Canterbury",
      "days_in_advance": 7,
      "temp_max": 18.26,
      "temp_min": 7.54,
      "temp": 18.26,
      "pressure": 997.09,
      "humidity": 68,
      "wind_speed": 11.62,
      "rain": true,
      "forecast_date": "2016-11-08T00:32:00.980Z"
    }
    
    The sample shown is a forecast from the darksky service for the city of Canterbury, New Zealand. The forecasts was retrieved shortly after midnight GMT (which is close to midday locally) on the 1st of November, Since the forecasts is for 7 days in advance, it is a prediction of what weather would be like on 8th of November. Most of the fields are self explanatory, but it should be noted that the precision is different from service to service. DarkSky gives 2 decimal places of accuracy for its temperature prediction while most give only 1 decimal place or even round them to the nearest degree centigrade. The value "rain": true implies that they predicted it would be raining on 8th of November. However, the value of the rain field currently comes with a serious health warning because I don't have a good grasp of the different ways that the various services report on rain. This will be improved in the future.
  • The example I gave is of a forecast. A historical weather reading is similar with the only difference being that it won't contain days_in_advance or forecast_date fields.
  • Most of the effort went into collecting the data, but I also needed to provide a way to get the data back out again. I implemented a simple web page (described below) which contains a Google chart widget and some buttons to control what data is displayed on the chart. In addition to this web page (accessed by the /ui url) I also needed to implement 2 other urls. The /data url is a service that gets called by the /ui page which returns raw weather data in JSON format. In addition I implemented the /check url which counts the number of weather reports and forecasts which have been retrieved today for each city. This url is used by a simple script that executes on a machine running on the Amazon cloud which sends me an email if the count doesn't match what is expected. I thought it was important to have this running outside of BlueMix because it is better not to have a service monitoring itself.

How to Access the Data

The simple instruction is to go to http://bodonovan.mybluemix.net/ui and if
 I did a reasonable job you should be able to figure it out yourself. So just go ahead and try it, the description here is just in case you get stuck.

The bulk of the page comprises a google chart widget with a line chart for what data you have chosen.  Below it there are a number of controls to select data for charting.

  • You must specify the date range you want to chart by means of a to and from date fields. If you view the page in Google Chrome or Internet Explorer browser, these fields will have a fancy date picker associated with them, but if you use Firefox they act like simple text entry fields. You can specify dates as far back as August 2016 which is when I started collecting data, but the data is very patchy before October 2016 when I implemented the full range of providers and cities.
  • There are drop downs to specify which provider you want data from, what city you are interested in and what feature you want t o chart. The features supported are temperature, pressure, humidity, wind speed and wind direction.In the future, I hope to support rainfall, but this is not working yet because of the different ways that the different services report rainfall. You also have an option to select actual data or forecasts. If you select forecasts, you also must specify how many days in advance you want the forecast for (not all service providers provide forecasts as many days in advance)
  • When you have made all of the selections, you can click on the "load data" button to add the relevant line to the chart. You can then change your selections and add more lines to compare anything you want. For example you might want to compare actual data for your city to what the forecast was 1/5/7 days in advance. You can also compare what the different providers are forecasting to see if there is consensus - or you can compare the actual data they report to see if they even agree on this. You can even go crazy and compare temperature in one city with pressure in another city, but comparing different feature is unlikely to be satisfactory because I don't support rescaling the different measurement scales.
  • If the database is missing data about some of the days you requested, it will draw a line with gaps. However, if select something which we have no data about (e.g. asking for a 7 day forecast from a service which only supports 5 days) you with get a "no data" warning.
  • With so many possibilities it is inevitable that you will make some mistakes. Therefore there is a "remove data" button to remove the most recently added line from the chart. There is also a "clear chart" button which removed all lines from the chart.
  • When you have interesting data displayed, there is an "export data" button which allows you to export the displayed readings to a CSV file so you can analyse them further with other tools.

Future work

  • The UI for accessing the data is very basic so I intend to implement an improved UI soon.
  • The check service regularly informs me that certain services have failed to report data for a particular city, but I have no idea why. If I implement better error tracking and logging I should be able to reduce the error rate.
  • From an Irish perspective, one of the most important weather features is rain. Therefore, I intend to improve the way rain data and forecasts are handled.
  • I reckon that there is a reasonably wide spread of cities and weather forecast services supported, but I will add more if there is a demand.
  • Last, but not least, I hope to get some real users so I can learn how the service can be useful.

Wednesday, September 28, 2016

Do people really decide who to vote for AFTER they see the debates

A lot of people have been discussing whether or not people make up their mind about who to vote for after they watch the presidential debates. Some commentators say that the debates are a crucial factor in helping swing voters make up their mind, while other commentators think that the vast majority of people have already decided whom to vote for and the debates only serve to confirm their existing opinions.

I tend to agree with the later opinion. Most of the people I know are Clinton supporters and their consensus was that Clinton was the clear winner of the first debate. As a Clinton supporter, I was glad to hear this. However, my good humour was burst when I spoke with the few Trump supporters that I know and I realised that they were equally convinced that Trump had won the debate.

I was amused to read that Jimmy Kimmel ran an interesting experiment to test this phenomenon. He went out on the streets to ask random passers by how they felt the two candidates had performed on the first presidential debate. This is a pretty normal thing to do - the twist was the fact that he conducted the interviews several hours before the debate happened. I wasn't surprised that most of the interviewees had a strong opinions about who had won the debate. It is well worth checking out this episode of the Jimmy Kimmel show.

Friday, February 19, 2016

Getting full use out of the touchpad of my new mini-laptop

I am the only person in my house who doesn't have an iPad because I never thought I would find one useful.  Instead I recently splashed out and bought myself a HP mini laptop. It is a little bit like an iPad because it is roughly the same size and hence it fits the gap between a full size laptop and a smartphone. However, it has a full keyboard so there is no awkward touch typing and it runs a real operating system rather than Apple's restricted iOS.

The machine came with Windows 10 and since they place a few restrictions making it difficult to install another operating system (e.g. Ubuntu) I have been forced to learn how to use it. Overall the experience was not too bad - but that will be the subject of another blog post. This article will focus on the touch pad.

The laptop came with a sheet of paper which (among other things) described how to make best use of the touchpad. I read this with great interest, but I was disappointed to find that some of the gestures did not work as they suggested. I did a bit of googling and found an article giving a different set of gestures and a video with even  more suggestions for how it might work, but again many gestures they described didn't work when I tried them. Eventually I found an article on how-to-geek which explained that apparently the touchpad on my laptop is not of high enough quality for all of the gestures to work (Windows apparently disables many gestures when it detects that the touchpad hardware is not of brand that it has certified).

This list shows the gestures that I found to work - this might work on other laptops or might not, but it is definitely worth trying them.
  • Drag a finger gently across the touchpad to move the mouse.
  • Press on the left-bottom corner of the touchpad to emulate a click on the left mouse button.
  • Press with a single finger on the right-bottom corner of the touchpad or press anywhere on the touchpad with two fingers to emulate a click on the right mouse button.
  • Press hard anywhere on the touchpad apart from the bottom right corner to emulate a left click. I guess this gesture requires a considerable amount of pressure to avoid the user accidentally triggering a left mouse click while dragging the mouse
  • While clicking the mouse with one finger, you can move the mouse with another finger. This allows you to do drag-and-drop.
  • When you press on the touchpad with two fingers, you can zoom in by moving your fingers apart or zoom out by moving them closer together. This pinch/stretch gesture is the same as is commonly available on smartphones.
  • If you click on the touchpad with two fingers and maintain a constant distance between them you can scroll text up or down by moving your fingers up or down. You can even use this two-fingered gesture to scroll left or right if there is a horizontal scroll option in your application.
  • If you find two finger scrolling too awkward, you can configure your system to scroll by dragging a single finger up and down on the right hand side of the touchpad. (by default this option is disabled).
None of the three-finger gestures seemed to work for me (possibly due to limitations of my hardware).  In any case I think the above list of gestures is complicated enough to remember.

Monday, February 15, 2016

This shower is definitely closed

At work they are currently doing some maintenance on the toilets and shower facilities. I think they expect that people might ignore the instructions not to use the facilities while the works are in progress. As a result they put warning signs telling people to keep out which make it look like someone died in there.

Thursday, February 11, 2016

Is it OK to talk to strangers?

When I was younger my parents used to tell me "don't talk to strangers", but what I observed them doing was "talk to strangers at every opportunity". This attitude was quite typical in Ireland and it still is a cultural norm.

The Irish Tourist Board is very proud of the fact that surveys of visitors to Ireland report that the people are very friendly. However, the reason for the friendliness is simply a desire to meet strangers.

The reason for this is because Irish culture evolved in a situation where people lived in small villages and everyone knew each other very well In this situation when you met a local person, there was a good chance that you already knew a lot about that person's life so it is not surprising that the conversation might tend to be a little boring. In contrast, on the rare occasions when you met a stranger/tourist you made a special effort to speak to that stranger because it would be an interesting conversation where you might learn something new.

So you see the famous Irish friendliness is in fact just a way to relieve the boredom of living in what until recently used to be a very mono-cultural society.