Skip to content

Commit

Permalink
Allow user commands in wind roses
Browse files Browse the repository at this point in the history
A contribution from Sabine Tobolka via the pywws mailing list.

Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Jun 21, 2016
1 parent 9c4a983 commit 66f4b9d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/contributors/contributors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Rod Persky
Morten Høybye Frederiksen morten@mfd-consult.dk
Simon Josefsson simon@josefsson.org
Matthew Hilton matthilton2005@gmail.com
Sabine Tobolka oe1yvw@gmail.com

Translators
-----------
Expand All @@ -24,4 +25,4 @@ Ramiro ramiro.sanchez@telefonica.net
Rick Sulman rick@sulman.org
Pyttsen weather@spacelab.se
Tech2304 tech2304@gmail.com
Pablo Vera pablo.vera82@gmail.com
Pablo Vera pablo.vera82@gmail.com
35 changes: 27 additions & 8 deletions src/pywws/WindRose.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-15 pywws contributors
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -65,6 +65,7 @@
| points_
| source_
| :ref:`title <plot-title>`
| command_
| start_
| stop_
| duration_
Expand Down Expand Up @@ -212,9 +213,9 @@
^^^^^^
Sets the text of the compass points. The defaults are 'N', 'S', 'E' &
'W'. For graphs in another language you can over-ride this, for
example: ``<points>'No', 'Zu', 'Oo', 'We'</points>``. (The preferred
way to do this is to create a language file, see Localisation.py.)
'W'. For graphs in another language you can over-ride this, for example:
``<points>'No', 'Zu', 'Oo', 'We'</points>``. (The preferred way to do
this is to create a language file, see :py:mod:`pywws.Localisation`.)
source
^^^^^^
Expand All @@ -234,6 +235,21 @@
``<title>Morning winds</title>``. This title appears within the plot
area, above the threshold colour key.
command
^^^^^^^
.. versionadded:: 16.06.0
Execute any gnuplot command, just before the main "plot" command. This
option allows advanced users to have greater control over the graph
appearance. The value is any valid gnuplot command, typically
beginning with the word set.
For example, ``<command>set grid front</command>`` will stop the grid
being hidden by the coloured wedges, and ``<command>set key outside
above right maxrows 1</command>`` will place the key outside the plot
area.
Detailed API
------------
Expand Down Expand Up @@ -374,10 +390,13 @@ def PlotData(self, plot_no, plot, source):
result += u'set yrange [-%f:%f]\n' % (yrange, yrange)
points = [_('N'), _('S'), _('E'), _('W')]
points = eval(plot.get_value('points', str(points)))
result += u'set label 1000 "%s" at 0, %d center front\n' % (points[0], yrange)
result += u'set label 1001 "%s" at 0, -%d center front\n' % (points[1], yrange)
result += u'set label 1002 "%s" at %d, 0 center front\n' % (points[2], yrange)
result += u'set label 1003 "%s" at -%d, 0 center front\n' % (points[3], yrange)
result += u'set label 1000 "%s" at 0, %d center front\n' % (points[0], yrange + 1)
result += u'set label 1001 "%s" at 0, -%d center front\n' % (points[1], yrange + 1)
result += u'set label 1002 "%s" at %d, 0 center front\n' % (points[2], yrange + 1)
result += u'set label 1003 "%s" at -%d, 0 center front\n' % (points[3], yrange + 1)
# additional commands for gnuplot
for command in plot.get_values('command'):
result += u'%s\n' % command
# plot segments for each speed-direction
result += u'plot '
for i in reversed(range(len(thresh))):
Expand Down
6 changes: 3 additions & 3 deletions src/pywws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '16.05.0'
_release = '1352'
_commit = '73d751e'
__version__ = '16.06.0'
_release = '1353'
_commit = '9c4a983'

0 comments on commit 66f4b9d

Please sign in to comment.