Skip to content

Commit

Permalink
Short duration plots no longer start on the hour
Browse files Browse the repository at this point in the history
The start and end times of plots (and wind roses) were being rounded to
an exact hour. For plots of 6 hours or less this rounding is now to the
exact minute.

Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Jun 3, 2015
1 parent 744a4ff commit 0c54680
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/pywws/Plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,14 @@ def DoPlot(self, input_file, output_file):
if not self.x_hi:
self.x_hi = datetime.utcnow() # only if no hourly data
self.x_hi += Local.utcoffset(self.x_hi)
# set end of graph to start of the next hour after last item
self.x_hi += timedelta(minutes=55)
self.x_hi = self.x_hi.replace(minute=0, second=0)
if self.duration < timedelta(hours=6):
# set end of graph to start of the next minute after last item
self.x_hi += timedelta(seconds=55)
self.x_hi = self.x_hi.replace(second=0)
else:
# set end of graph to start of the next hour after last item
self.x_hi += timedelta(minutes=55)
self.x_hi = self.x_hi.replace(minute=0, second=0)
self.x_lo = self.x_hi - self.duration
self.utcoffset = Local.utcoffset(self.x_hi)
# open gnuplot command file
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__ = '15.05.0.dev1299'
_release = '1299'
_commit = 'ce12d50'
__version__ = '15.06.0.dev1300'
_release = '1300'
_commit = '744a4ff'

0 comments on commit 0c54680

Please sign in to comment.