diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 5dc41343..2af2c8d4 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.4.1 +current_version = 2.4.2 commit = True tag = True diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f473b1cc..b67404d0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,14 +1,20 @@ Changelog ========= +2.4.2 (2018-05-21) +----------------------------------------- +* Fixed bug in convert_mlt that caused all time inputs to occur + at 00:00:00 UT +* Fixed year of last two updates in changelog + -2.4.1 (2017-04-04) +2.4.1 (2018-04-04) ----------------------------------------- -* Fix bug in installation, that caused files to be placed in the wrong +* Fix bug in installation that caused files to be placed in the wrong directory * Added DOI -2.4.0 (2017-03-21) +2.4.0 (2018-03-21) ----------------------------------------- * Update to use AACGM-v2.4, which includes changes to the inverse MLT and diff --git a/aacgmv2/__init__.py b/aacgmv2/__init__.py index 43f72a44..29e170e3 100644 --- a/aacgmv2/__init__.py +++ b/aacgmv2/__init__.py @@ -41,7 +41,7 @@ """ import os.path as _path import logbook as logging -__version__ = "2.4.1" +__version__ = "2.4.2" # path and filename prefix for the IGRF coefficients AACGM_V2_DAT_PREFIX = _path.join(_path.realpath(_path.dirname(__file__)), diff --git a/aacgmv2/tests/test_py_aacgmv2.py b/aacgmv2/tests/test_py_aacgmv2.py index 0f1a5b0d..2acdba21 100644 --- a/aacgmv2/tests/test_py_aacgmv2.py +++ b/aacgmv2/tests/test_py_aacgmv2.py @@ -853,18 +853,32 @@ class TestMLTConvert: def setup(self): """Runs before every method to create a clean testing setup""" self.dtime = dt.datetime(2015, 1, 1, 0, 0, 0) + self.dtime2 = dt.datetime(2015, 1, 1, 10, 0, 0) self.ddate = dt.date(2015, 1, 1) self.mlon_out = None self.mlt_out = None + self.mlt_diff = None self.mlon_list = [270.0, 80.0, -95.0] self.mlt_list = [12.0, 25.0, -1.0] self.mlon_comp = [-101.657689, 93.34231102, 63.34231102] self.mlt_comp = [12.77717927, 0.1105126, 12.44384593] + self.diff_comp = np.ones(shape=(3,)) * -10.52411552 def teardown(self): """Runs after every method to clean up previous testing""" del self.mlon_out, self.mlt_out, self.mlt_list, self.mlon_list - del self.mlon_comp, self.mlt_comp + del self.mlon_comp, self.mlt_comp, self.mlt_diff, self.diff_comp + + def test_date_input(self): + """Test to see that the date input works""" + self.mlt_out = aacgmv2.convert_mlt(self.mlon_list, self.ddate, + m2a=False) + np.testing.assert_allclose(self.mlt_out, self.mlt_comp, rtol=1.0e-4) + + def test_datetime_exception(self): + """Test to see that a value error is raised with bad time input""" + with pytest.raises(ValueError): + self.mlt_out = aacgmv2.wrapper.convert_mlt(self.mlon_list, 1997) def test_inv_convert_mlt_single(self): """Test MLT inversion for a single value""" @@ -924,6 +938,14 @@ def test_mlt_convert_arr(self): self.dtime, m2a=False) np.testing.assert_allclose(self.mlt_out, self.mlt_comp, rtol=1.0e-4) + def test_mlt_convert_change(self): + """Test that MLT changes with UT""" + self.mlt_out = aacgmv2.convert_mlt(self.mlon_list, self.dtime) + self.mlt_diff = self.mlt_out - aacgmv2.convert_mlt(self.mlon_list, + self.dtime2) + + np.testing.assert_allclose(self.mlt_diff, self.diff_comp, rtol=1.0e-4) + class TestCoeffPath: def setup(self): """Runs before every method to create a clean testing setup""" diff --git a/aacgmv2/wrapper.py b/aacgmv2/wrapper.py index 9ed22714..da142812 100644 --- a/aacgmv2/wrapper.py +++ b/aacgmv2/wrapper.py @@ -531,10 +531,10 @@ def convert_mlt(arr, dtime, m2a=False, coeff_prefix=None, igrf_file=None): # Test time if isinstance(dtime, dt.date): - dtime = dt.datetime.combine(dtime, dt.time(0)) - - assert isinstance(dtime, dt.datetime), \ - logging.error('time must be specified as datetime object') + if not isinstance(dtime, dt.datetime): + dtime = dt.datetime.combine(dtime, dt.time(0)) + else: + raise ValueError('time must be specified as datetime object') # Calculate desired location, C routines set date and time if m2a: diff --git a/docs/conf.py b/docs/conf.py index 0b8bae1c..0215b4b2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,7 +24,7 @@ year = u'2015' author = u'Angeline G. Burrell, Christer van der Meeren' copyright = '{0}, {1}'.format(year, author) -version = release = u'2.4.1' +version = release = u'2.4.2' # on_rtd is whether we are on readthedocs.org on_rtd = os.environ.get('READTHEDOCS', None) == 'True' diff --git a/setup.py b/setup.py index 5d9d5974..002df7fd 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ def read(fname, **kwargs): setup( name='aacgmv2', - version='2.4.1', + version='2.4.2', license='MIT', description='A Python wrapper for AACGM-v2 magnetic coordinates', long_description='%s\n%s' % (read('README.rst'), @@ -49,7 +49,6 @@ def read(fname, **kwargs): 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6',