Saturday, June 3, 2017

My neighbour becomes youngest ever Irish leader

There was great excitement yesterday when Leo Varadkar was announced as the new leader of the Fine Gael party. This means that he will almost certainly  be elected Taoiseach at the next meeting of the Dáil.

Much of the press coverage focused on his attributes which would in the past have been a barrier to high office in Ireland.

  • He is on;y 38 which will make him the youngest ever Taoiseach
  • He is openly gay
  • His father is an immigrant from India
Around where I live there is additional excitement since he is a local boy having grown up quite close to where I live and even still lives in the area.

Leo has many positive attributes:
  • He is clever and well educated (he is a medical doctor)
  • I don't think he will be an embarrassment to us in public (unlike other leaders I won't mention)
  • In all previous ministries, he seems ti have been a very competent administrator
  • He is a good communicator and is loved by the media due to his habit of giving a straight answer when asked a question (this sets him apart from most other politicians).
However, I can't be totally enthusiastic about his election. Fine Gael is definitely on the right in Irish politics, but Leo's politics are on the right wing of the party. Many people think that his recent campaign against social welfare cheats didn't set a very good tone. I also didn't like the slogan of his leadership campaign which was that he would represent "the people who get up early in the morning" - this doesn't show much sympathy with people unlucky enough to be unemployed.

I am not too worried however, because Fine Gael need support from other parties and independents and hence his right wing tendencies will be help in check.

Wednesday, May 31, 2017

Windows and Linux command recall compared

I prefer to use Linux, but sometimes I need to use Windows. What is frustrating is that sometimes the operating systems have essentially the same feature, but there are differences in implementation that can trip you up if you forget about them.

Often when you are working at the command line you will need to issue the same command  you used before.(or a similar command). With either Windows or Linux you can easily recall the last command by typing up arrow once or recall the command before that by typing up arrow twice. So far so good, but if you read at the finer details of command recall on Linux or Mac you can see there are quite a few differences to the way the feature is implemented on Windows.

Mostly the differences are different key combinations used which can be difficult to remember when you switch between both systems. However, there are a few things that are significant:
  1. The way recalling commands affects your place in history:

    Linux takes a simple view of command history, while Windows adjusts your perception of history depending upon whether you typed a command directly or recalled it from history. This is a tricky concept, so lets look at example. Suppose you had typed the following commands:

     > command a
     > command b
     > command c

    If you type up-arrow twice and then return, both Windows and Linux would execute 'command b' because this is the second last command, However, the two systems have a subtly different view of your command history after this. Linux takes the view that you typed command a/b/c/b and so if you type up-arrow twice you should get 'command c'. Windows agrees that 'command b' was the last command executed, but if you type up-arrow twice it gives you 'command a' because that was the command executed before 'command b'. If you want to recall 'command c' on Windows, you should type down-arrow.

    The Windows approach is probably superior because it makes it easier to recall a series of commands you executed some time ago, but it can be confusing and it is easy to trip up (especially when you switch between both systems).
  2. The way you search for previous commands:

    If you executed a command involving 'blog.txt' some time ago it might be tedious to have to keep typing up arrow to find it. Luckily both Windows and Linux provide a quick way to find the command in question.

    In Windows you would type the string 'blog.txt' and then hit the F8 key to see the last command containing that text. In Linux you first type CTRL-r and then start typing the text you want to match. As you are typing Linux will show you the command it would match for the text you have typed. The Linux way is clearly better because you can see how much text you need to type to match the command you want or you might decide to match on a different part of the command if you see lots of commands in your history containing the word 'blog.txt'.
  3. History persisting between sessions:

    In Linux your command history is stored in a file, which means that when you start a new session it automatically know your command history from a previous session. In contrast, Windows stores the command history in volatile memory so each new session starts with a clear slate, In general the Linux approach is much more useful, but there can be problems when you have two command windows open at the same time - the command history is effectively a combination of the commands typed in both windows which can be confusing.

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.