Skip to content

Commit

Permalink
Merge pull request #34 from ocefpaf/unpin_mpl
Browse files Browse the repository at this point in the history
Update dependency to matplotlib>=2.
  • Loading branch information
pelson authored May 31, 2018
2 parents 8860726 + 4d9df15 commit d9056a7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion nc_time_axis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(self, max_n_ticks, calendar, date_unit, min_n_ticks=3):
self.min_n_ticks = min_n_ticks
self._max_n_locator = mticker.MaxNLocator(max_n_ticks, integer=True)
self._max_n_locator_days = mticker.MaxNLocator(
max_n_ticks, integer=True, steps=[1, 2, 4, 7, 14])
max_n_ticks, integer=True, steps=[1, 2, 4, 7, 10])
self.calendar = calendar
self.date_unit = date_unit
if not self.date_unit.lower().startswith('days since'):
Expand Down
7 changes: 4 additions & 3 deletions nc_time_axis/tests/unit/test_NetCDFTimeConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
from six import assertRaisesRegex

import unittest

Expand Down Expand Up @@ -56,7 +57,7 @@ def test_nonequal_calendars(self):
unit = 'days since 2000-01-01'
val = [CalendarDateTime(cftime.datetime(2014, 8, 12), calendar_1),
CalendarDateTime(cftime.datetime(2014, 8, 13), calendar_2)]
with self.assertRaisesRegexp(ValueError, 'not all equal'):
with assertRaisesRegex(self, ValueError, 'not all equal'):
NetCDFTimeConverter().default_units(val, None)


Expand Down Expand Up @@ -98,14 +99,14 @@ def test_non_cftime_datetime(self):
val = CalendarDateTime(4, '360_day')
msg = 'The datetime attribute of the CalendarDateTime object must ' \
'be of type `cftime.datetime`.'
with self.assertRaisesRegexp(ValueError, msg):
with assertRaisesRegex(self, ValueError, msg):
result = NetCDFTimeConverter().convert(val, None, None)

def test_non_CalendarDateTime(self):
val = cftime.datetime(1988, 5, 6)
msg = 'The values must be numbers or instances of ' \
'"nc_time_axis.CalendarDateTime".'
with self.assertRaisesRegexp(ValueError, msg):
with assertRaisesRegex(self, ValueError, msg):
result = NetCDFTimeConverter().convert(val, None, None)


Expand Down
6 changes: 5 additions & 1 deletion nc_time_axis/tests/unit/test_NetCDFTimeDateLocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@

import unittest

import matplotlib.style
import matplotlib.dates as mdates
import cftime
import numpy as np

from nc_time_axis import NetCDFTimeDateLocator


matplotlib.style.use('classic')


class Test_compute_resolution(unittest.TestCase):
def setUp(self):
self.date_unit = 'days since 2004-01-01 00:00'
Expand Down Expand Up @@ -108,7 +112,7 @@ def test_monthly(self):

def test_yearly(self):
np.testing.assert_array_equal(
self.check(5, 0, 5*365), [31., 638., 1246., 1856.])
self.check(5, 0, 5*365), [31., 485., 942., 1399., 1856.])


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
author='Laura Dreyer, Philip Elson',
url='https://github.com/scitools/nc-time-axis',
packages=packages,
install_requires = ['matplotlib==1.*',
'cftime',
install_requires = ['cftime',
'matplotlib',
'numpy',
'six'],
tests_require = ['mock', 'pep8'],
Expand Down

0 comments on commit d9056a7

Please sign in to comment.