Skip to content

Commit

Permalink
Merge pull request #66 from aburrell/rc_26.2
Browse files Browse the repository at this point in the history
Release Candidate for v2.6.2
  • Loading branch information
aburrell authored Jan 13, 2021
2 parents da8b541 + 9eda1e0 commit fdc1aef
Show file tree
Hide file tree
Showing 32 changed files with 167 additions and 235 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: python
python:
- "2.7"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
env:
global:
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
Expand Down
43 changes: 43 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"license": {
"id": "MIT"
},
"notes": "When referencing this package, please cite both the package DOI and the AACGM-v2 journal article: Shepherd, S. G. (2014), Altitude\u2010adjusted corrected geomagnetic coordinates: Definition and functional approximations, Journal of Geophysical Research: Space Physics, 119, 7501\u20137521, doi:10.1002/2014JA020264.",
"references": [
"Shepherd, S. G. (2014), Altitude\u2010adjusted corrected geomagnetic coordinates: Definition and functional approximations, Journal of Geophysical Research: Space Physics, 119, 7501\u20137521, doi:10.1002/2014JA020264."
],
"keywords": [
"AACGM",
"AACGMV2",
"AACGM-v2",
"Altitude Adjusted Corrected Geomagnetic Coordinates",
"MLT",
"Magnetic Local Time",
"Conversion",
"Coordinate Conversion",
"Converting",
"Ionosphere",
"Magnetic Field",
"Space Physics",
"Heliophysics"
],
"creators": [
{
"orcid": "0000-0001-8875-9326",
"affiliation": "Naval Research Laboratory",
"name": "Angeline G. Burrell"
},
{
"orcid": "0000-0002-8043-0953",
"name": "Christer van der Meeren"
},
{
"orcid": "0000-0001-5028-4943",
"name": "Karl M. Laundal"
},
{
"orcid": "0000-0001-5715-8632",
"name": "Hugo van Kemenade"
}
]
}
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Authors
* Angeline G. Burrell - https://github.com/aburrell
* Christer van der Meeren
* Karl M. Laundal
* Hugo van Kemenade - https://github.com/hugovk

Thanks
======
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
Changelog
=========

2.6.2 (2020-01-13)
------------------

* Drop support for EOL Python 2.7 and added testing for Python 3.9
* Added a .zenodo.json file
* Fixed AppVeyor environment

2.6.1 (2020-09-11)
------------------

* Moved formerly deprecated utilities from `deprecated.py` to `utils.py`
* Removed allowance for deprecated kwarg `code` from `convert_latlon` and
`convert_latlon_arr`, as scheduled
* Updated CI to include python 3.8 everywhere
* Updated CI to include Python 3.8 everywhere
* Moved all configuration information to setup.cfg
* Fixed coveralls implementation
* Fixed broken links in the documentation
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ To set up `aacgmv2` for local development:
in ``tests/test_py_aacgmv2.py`` (for the wrapper), ``test_c_aacgmv2.py``
(for the C extension), or ``tests/test_cmd_aacgmv2.py`` (for the
command-line interface). ``tests/test_dep_aacgmv2.py`` includes tests for
deprecated functions. The tests are run with ``py.test`` and can be
deprecated functions. The tests are run with ``pytest`` and can be
written as normal functions (starting with ``test_``) containing a standard
``assert`` statement for testing output, or use the numpy testing suite.

Expand Down Expand Up @@ -87,7 +87,7 @@ For merging, you should:
1. Include passing tests (run ``tox``) [1]_
2. Update/add documentation if relevant
3. Add a note to ``CHANGELOG.rst`` about the changes
4. Add yourself to ``AUTHORS.rst``
4. Add yourself to the end of ``AUTHORS.rst`` and the ``.zenodo.json`` files

.. [1] If you don't have all the necessary Python versions available locally or
have trouble building all the testing environments, you can rely on
Expand All @@ -99,7 +99,7 @@ Tips

To run a subset of tests::

tox -e envname -- py.test -k test_myfeature
tox -e envname -- pytest -k test_myfeature

To run all the test environments in parallel (you need to ``pip install detox``)::

Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ include CODE_OF_CONDUCT.md
include tox.ini
include *.yml
include .*.yml
include .zenodo.json

global-exclude *.py[cod] __pycache__ *.so *.dylib *.dSYM .pytest_cache
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Badges
:alt: Travis-CI Build Status
:target: https://travis-ci.org/github/aburrell/aacgmv2

.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/aburrell/aacgmv2?branch=main&svg=true
.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/qo01t2obf7bscveu?svg=true
:alt: AppVeyor Build Status
:target: https://ci.appveyor.com/project/aburrell/aacgmv2

Expand All @@ -92,9 +92,9 @@ Badges
:alt: Coverage Status (Coveralls)
:target: https://coveralls.io/github/aburrell/aacgmv2

.. |codacy| image:: https://api.codacy.com/project/badge/Grade/b64ee44194f148f5bdb0f00c7cf16ab8
.. |codacy| image:: https://api.codacy.com/project/badge/Grade/510602761f7f4a5a97a9d754e65f6f28
:alt: Codacy Code Quality Status
:target: https://www.codacy.com/manual/aburrell/aacgmv2?utm_source=github.com&utm_medium=referral&utm_content=aburrell/aacgmv2&utm_campaign=Badge_Grade
:target: https://app.codacy.com/gh/aburrell/aacgmv2?utm_source=github.com&utm_medium=referral&utm_content=aburrell/aacgmv2&utm_campaign=Badge_Grade

.. |codeclimate| image:: https://api.codeclimate.com/v1/badges/91f5a91bf3d9ba90cb57/maintainability.svg
:target: https://codeclimate.com/github/aburrell/aacgmv2
Expand Down
2 changes: 1 addition & 1 deletion aacgmv2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from aacgmv2 import (_aacgmv2)

# Define global variables
__version__ = "2.6.1"
__version__ = "2.6.2"

# Define a logger object to allow easier log handling
logger = logging.getLogger('aacgmv2_logger')
Expand Down
15 changes: 3 additions & 12 deletions aacgmv2/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# -*- coding: utf-8 -*-
"""Executed when aacgmv2 is invoked with python -m aacgmv2"""

from __future__ import division, print_function, absolute_import

import argparse
import datetime as dt
Expand All @@ -15,15 +14,6 @@

import aacgmv2

if sys.version_info.major >= 3:
# Python 3
STDIN = sys.stdin.buffer
STDOUT = sys.stdout.buffer
else:
# Python 2
STDIN = sys.stdin
STDOUT = sys.stdout


def main():
"""Entry point for the script"""
Expand All @@ -47,9 +37,10 @@ def main():
desc = 'input file (stdin if none specified)'
for pp in [parser_convert, parser_convert_mlt]:
pp.add_argument('-i', '--input', dest='file_in', metavar='FILE_IN',
type=argparse.FileType('r'), default=STDIN, help=desc)
type=argparse.FileType('r'), default=sys.stdin.buffer,
help=desc)
pp.add_argument('-o', '--output', dest='file_out', metavar='FILE_OUT',
type=argparse.FileType('wb'), default=STDOUT,
type=argparse.FileType('wb'), default=sys.stdout.buffer,
help='output file (stdout if none specified)')

desc = 'date for magnetic field model (1900-2020, default: today)'
Expand Down
54 changes: 19 additions & 35 deletions aacgmv2/aacgmv2module.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,39 +523,23 @@ mlon : (float)\n\

/* Different versions of python require different constant declarations */

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef aacgmv2module = {
PyModuleDef_HEAD_INIT,
"_aacgmv2", /* name of module */
"Interface to the AACGM-v2 C library.", /* module documentation */
-1, /* size of per-interpreter state of the module,
or -1 if the module keeps state in global variables. */
aacgm_v2_methods
};

PyMODINIT_FUNC PyInit__aacgmv2(void)
{
module = PyModule_Create(&aacgmv2module);
PyModule_AddIntConstant(module, "G2A", G2A);
PyModule_AddIntConstant(module, "A2G", A2G);
PyModule_AddIntConstant(module, "TRACE", TRACE);
PyModule_AddIntConstant(module, "ALLOWTRACE", ALLOWTRACE);
PyModule_AddIntConstant(module, "BADIDEA", BADIDEA);
PyModule_AddIntConstant(module, "GEOCENTRIC", GEOCENTRIC);
return module;
}

#else

PyMODINIT_FUNC init_aacgmv2(void)
{
module = Py_InitModule("_aacgmv2", aacgm_v2_methods);
PyModule_AddIntConstant(module, "G2A", G2A);
PyModule_AddIntConstant(module, "A2G", A2G);
PyModule_AddIntConstant(module, "TRACE", TRACE);
PyModule_AddIntConstant(module, "ALLOWTRACE", ALLOWTRACE);
PyModule_AddIntConstant(module, "BADIDEA", BADIDEA);
PyModule_AddIntConstant(module, "GEOCENTRIC", GEOCENTRIC);
}
static struct PyModuleDef aacgmv2module = {
PyModuleDef_HEAD_INIT,
"_aacgmv2", /* name of module */
"Interface to the AACGM-v2 C library.", /* module documentation */
-1, /* size of per-interpreter state of the module,
or -1 if the module keeps state in global variables. */
aacgm_v2_methods
};

#endif
PyMODINIT_FUNC PyInit__aacgmv2(void)
{
module = PyModule_Create(&aacgmv2module);
PyModule_AddIntConstant(module, "G2A", G2A);
PyModule_AddIntConstant(module, "A2G", A2G);
PyModule_AddIntConstant(module, "TRACE", TRACE);
PyModule_AddIntConstant(module, "ALLOWTRACE", ALLOWTRACE);
PyModule_AddIntConstant(module, "BADIDEA", BADIDEA);
PyModule_AddIntConstant(module, "GEOCENTRIC", GEOCENTRIC);
return module;
}
1 change: 0 additions & 1 deletion aacgmv2/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"""

from __future__ import absolute_import, unicode_literals
import warnings
import aacgmv2

Expand Down
3 changes: 0 additions & 3 deletions aacgmv2/tests/environ/test_environ_aacgmv2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals

import os
import sys
import pytest
Expand Down
3 changes: 0 additions & 3 deletions aacgmv2/tests/test_c_aacgmv2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals

import datetime as dt
import numpy as np
import pytest
Expand Down
3 changes: 0 additions & 3 deletions aacgmv2/tests/test_cmd_aacgmv2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals

import subprocess
import numpy as np
import os
Expand Down
3 changes: 0 additions & 3 deletions aacgmv2/tests/test_dep_aacgmv2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals

import datetime as dt
import warnings

Expand Down
24 changes: 6 additions & 18 deletions aacgmv2/tests/test_py_aacgmv2.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals

import datetime as dt
from io import StringIO
import logging
import numpy as np
import os
from sys import version_info
import pytest
import warnings

Expand Down Expand Up @@ -79,8 +75,6 @@ def test_convert_latlon_datetime_date(self):
np.testing.assert_allclose(self.out, [58.2268, 81.1613, 1.0457],
rtol=self.rtol)

@pytest.mark.skipif(version_info.major == 2,
reason='Not raised in Python 2')
def test_convert_latlon_location_failure(self):
"""Test single value latlon conversion with a bad location"""
self.out = aacgmv2.convert_latlon(0, 0, 0, self.dtime, self.in_args[-1])
Expand Down Expand Up @@ -194,8 +188,6 @@ def test_convert_latlon_arr_badidea(self, method_code, alt, local_ref):
self.ref = local_ref
self.evaluate_output()

@pytest.mark.skipif(version_info.major == 2,
reason='Not raised in Python 2')
def test_convert_latlon_arr_location_failure(self):
"""Test array latlon conversion with a bad location"""

Expand Down Expand Up @@ -282,8 +274,6 @@ def test_get_aacgm_coord_datetime_date(self):
np.testing.assert_allclose(self.out, [58.2268, 81.1613, 0.1888],
rtol=self.rtol)

@pytest.mark.skipif(version_info.major == 2,
reason='Not raised in Python 2')
def test_get_aacgm_coord_location_failure(self):
"""Test single value AACGMV2 calculation with a bad location"""
self.in_args.extend([0.0, self.dtime, 'TRACE'])
Expand Down Expand Up @@ -388,8 +378,6 @@ def test_get_aacgm_coord_arr_badidea(self):
self.ref = [[64.3481], [83.2885], [0.3306]]
self.evaluate_output()

@pytest.mark.skipif(version_info.major == 2,
reason='Not raised in Python 2')
def test_get_aacgm_coord_arr_location_failure(self):
"""Test array AACGMV2 calculation with a bad location"""
self.out = aacgmv2.get_aacgm_coord_arr([0], [0], [0], self.dtime,
Expand Down Expand Up @@ -716,8 +704,8 @@ class TestPyLogging:
def setup(self):
"""Runs before every method to create a clean testing setup"""

self.lwarn = u""
self.lout = u""
self.lwarn = ""
self.lout = ""
self.log_capture = StringIO()
aacgmv2.logger.addHandler(logging.StreamHandler(self.log_capture))
aacgmv2.logger.setLevel(logging.INFO)
Expand All @@ -729,7 +717,7 @@ def teardown(self):

def test_warning_below_ground(self):
""" Test that a warning is issued if height < 0 for height test """
self.lwarn = u"conversion not intended for altitudes < 0 km"
self.lwarn = "conversion not intended for altitudes < 0 km"

aacgmv2.wrapper.test_height(-1, 0)
self.lout = self.log_capture.getvalue()
Expand All @@ -738,7 +726,7 @@ def test_warning_below_ground(self):

def test_warning_magnetosphere(self):
""" Test that a warning is issued if altitude is very high"""
self.lwarn = u"coordinates are not intended for the magnetosphere"
self.lwarn = "coordinates are not intended for the magnetosphere"

aacgmv2.wrapper.test_height(70000, aacgmv2._aacgmv2.TRACE)
self.lout = self.log_capture.getvalue()
Expand All @@ -747,7 +735,7 @@ def test_warning_magnetosphere(self):

def test_warning_high_coeff(self):
""" Test that a warning is issued if altitude is very high"""
self.lwarn = u"must either use field-line tracing (trace=True"
self.lwarn = "must either use field-line tracing (trace=True"

aacgmv2.wrapper.test_height(3000, 0)
self.lout = self.log_capture.getvalue()
Expand All @@ -756,7 +744,7 @@ def test_warning_high_coeff(self):

def test_warning_single_loc_in_arr(self):
""" Test that user is warned they should be using simpler routine"""
self.lwarn = u"for a single location, consider using"
self.lwarn = "for a single location, consider using"

aacgmv2.convert_latlon_arr(60, 0, 300, dt.datetime(2015, 1, 1, 0, 0, 0))
self.lout = self.log_capture.getvalue()
Expand Down
3 changes: 0 additions & 3 deletions aacgmv2/tests/test_struct_aacgmv2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals

import logging
import numpy as np
import os
Expand Down
3 changes: 0 additions & 3 deletions aacgmv2/tests/test_utils_aacgmv2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals

import datetime as dt
import numpy as np
import pytest
Expand Down
Loading

0 comments on commit fdc1aef

Please sign in to comment.