Thursday, 8 August 2013

The Chronicles of RPi - GnuPlot

After the HTML table display, I decided to take it one step further and plot the data in graphical format. In keeping with my open source ideology, I decided to use GnuPlot, which is a command-line graphing tool. Another reason for using GnuPlot is that it had a Python library which would fit in nicely with the existing script.
Presently, only temperature, dew point, relative humidity, pressure and AWS battery voltage (for diagnostic/performance reasons) graphs are being generated from the incoming data. There are three possible types of graphs:

1. A current graph - this shows the data set with it time axis close to or at present time at its extremity.

2. A 24 hour graph - this shows the data set on a full 24 hour time scale. Its easier to spot trends on this graph than on the "current graph" . Sometime these graphs can look different although the data being presented in both is identical.

3. A weekly graph - this is where the data is displayed cumulatively for a week from its present time. Therefore, any data older than a week will be discarded. (NB. This graph is data dependent and not time dependent, if there are any significant breaks in the data set, it is possible that the time scale can read more than a calendar week.)

Following closely behind  these variables will be rainfall. That format has been identified and will be implemented in the near future.
An example of a "Current Graph" of Temperature and Dew Point
GnuPlot is a very versatile graphing tool with many features. Two of these features that made my work a lot easier were its "NaN" and is ability to output the graphs as a .jpg or .png formatted image.
The "NaN", which stands for 'Not a Number" feature allows me to some rudimentary quality control checks in my scripts and flag and "weird" data and then prevents that data from being plotted in the graphs. Once flagged, GnuPlot will simply omit that value from the graph and leave it blank. These QC checks are hardly used but if implemented, the are usually one out of every 100 readings and on the entire scale of the graph, it is usually not seen.
The formatted image feature usefulness will be discussed in the next blog as I look into the world of web hosting the data.
Until next time...
Marvin...

No comments:

Post a Comment