Skip to main content

A Python wrapper for AACGM-v2 magnetic coordinates

Project description

Documentation Status PyPI Package latest release DOI

This is a Python wrapper for the AACGM-v2 C library, which allows converting between geographic and magnetic coordinates. The currently included version of the C library is 2.6. The package is free software (MIT license). When referencing this package, please cite both the package DOI and the AACGM-v2 journal article:

Shepherd, S. G. (2014), Altitude‐adjusted corrected geomagnetic coordinates: Definition and functional approximations, Journal of Geophysical Research: Space Physics, 119, 7501–7521, doi:10.1002/2014JA020264.

Quick start

Install (requires NumPy):

pip install aacgmv2

Convert between AACGM and geographic coordinates:

>>> import aacgmv2
>>> import datetime as dt
>>> import numpy as np
>>> np.set_printoptions(formatter={'float_kind': lambda x:'{:.4f}'.format(x)})
>>> # geo to AACGM, single numbers
>>> dtime = dt.datetime(2013, 11, 3)
>>> np.array(aacgmv2.get_aacgm_coord(60, 15, 300, dtime))
array([57.4736, 93.6111, 1.4816])
>>> # AACGM to geo, mix arrays/numbers
>>> np.array2string(np.array(aacgmv2.convert_latlon_arr([90, -90], 0, 0, dtime, method_code="A2G"))).replace('\n', '')
'[[82.9686 -74.3390] [-84.6501 125.8476] [14.1246 12.8772]]'

Convert between AACGM and MLT:

>>> import aacgmv2
>>> import datetime as dt
>>> import numpy as np
>>> np.set_printoptions(formatter={'float_kind': lambda x:'{:.4f}'.format(x)})
>>> # MLT to AACGM
>>> dtime = dt.datetime(2013, 11, 3, 0, 0, 0)
>>> np.array(aacgmv2.convert_mlt([1.4822189, 12], dtime, m2a=True))
array([93.6203, -108.6130])

If you don’t know or use Python, you can also use the command line. See details in the full documentation.

Documentation

https://aacgmv2.readthedocs.io/en/latest/

http://superdarn.thayer.dartmouth.edu/aacgm.html

Badges

docs

Documentation Status

tests

Travis-CI Build Status AppVeyor Build Status Requirements Status
CodeClimate Quality Status Scrutinizer Status Codacy Code Quality Status Coverage Status (Coveralls)

package

PyPI Package latest release Supported versions
PyPI Wheel Supported implementations

Changelog

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

  • Moved all configuration information to setup.cfg

  • Fixed coveralls implementation

  • Fixed broken links in the documentation

  • Removed unused code analysis tools

  • Improved unit test coverage

  • Make PEP8 changes

2.6.0 (2020-01-06)

  • Updated AACGM-v2 coefficients derived using the IGRF13 model

  • Updated IGRF and GUFM1 coefficients using the IGRF13 model

  • Added additional checks to the C code for reading the IGRF13 coefficient file

  • Removed convert routine in deprecated.py

  • Pushed back keyword argument deprecation of code

  • Scheduled deprecation for remaining routines in deprecated.py

  • Parametrized several unit tests

  • Updated README.md examples

  • Updated CI to include python 3.8

2.5.3 (2019-12-23)

  • Changed log warning about array functions to info

  • Changed default method from TRACE to ALLOWTRACE

  • Added C wrappers for list input, removing inefficient use of np.vectorize

  • Fixed documentation for use of method_code

  • Added FutureWarning for deprecated use of code keyword argument

  • Updated previous version’s changelog to encompass all changes

  • Improved docstrings to make documentation easier to read

  • Removed failing twine commands from appveyor.yml

  • Removed RuntimeWarning filter from tox.ini

2.5.2 (2019-08-27)

  • Added FutureWarning to deprecated functions

  • Updated names in licenses

  • Moved module structure routine tests to their own class

  • Added high altitude limit to avoid while-loop hanging

  • Changed version support to 2.7, 3.6, and 3.7

  • Removed logbook dependency

  • Added logic to avoid reseting environment variables if not necessary

  • Added copyright and license disclaimer to module-specific program files

  • Changed keyword argument code to method_code

2.5.1 (2018-10-19)

  • Commented out debug statement in C code

  • Updated environment variable warning to output to stderr instead of stdout

  • Added templates for pull requests, issues, and a code of conduct

2.5.0 (2018-08-08)

  • Updated C code and coefficients to version 2.5. Changes in python code reflect changes in C code (includes going back to using environment variables instead of strings for coefficient file locations)

  • Added decorators to some of the test functions

  • Specified AppVeyor Visual Studio version, since it was defaulting to 2010 and that version doesn’t work with python 3

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 (2018-04-04)

  • Fix bug in installation that caused files to be placed in the wrong directory

  • Added DOI

2.4.0 (2018-03-21)

  • Update to use AACGM-v2.4, which includes changes to the inverse MLT and dipole tilt functions and some minor bug fixes

  • Updated file structure

  • Updated methods, retaining old methods in deprecated module

  • Added testing for python 3.6

  • Updated dependencies, removing support for python 3.3

  • Tested on Mac OSX

  • Updated comments to include units for input and output

2.0.0 (2016-11-03)

  • Change method of calculating MLT, see documentation of convert_mlt for details

1.0.13 (2015-10-30)

  • Correctly convert output of subsol() to geodetic coordinates (the error in MLT/mlon conversion was not large, typically two decimal places and below)

1.0.12 (2015-10-26)

  • Return nan in forbidden region instead of throwing exception

1.0.11 (2015-10-26)

  • Fix bug in subsolar/MLT conversion

1.0.10 (2015-10-08)

  • No code changes, debugged automatic build/upload process and needed new version numbers along the way

1.0.0 (2015-10-07)

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aacgmv2-2.6.1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distributions

aacgmv2-2.6.1-cp38-cp38-macosx_10_14_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

aacgmv2-2.6.1-cp37-cp37m-macosx_10_14_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

aacgmv2-2.6.1-cp36-cp36m-macosx_10_14_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

aacgmv2-2.6.1-cp27-cp27m-macosx_10_14_x86_64.whl (1.6 MB view details)

Uploaded CPython 2.7m macOS 10.14+ x86-64

File details

Details for the file aacgmv2-2.6.1.tar.gz.

File metadata

  • Download URL: aacgmv2-2.6.1.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

File hashes

Hashes for aacgmv2-2.6.1.tar.gz
Algorithm Hash digest
SHA256 12f8eb978cd18b427bdd401bb3214370facab30b47f63e5d185054fc3bf12d85
MD5 be437b95f72b6e48108e061611a3f7c7
BLAKE2b-256 a9a3503e8d45e762ef37e944b8bcaf5aa0c5f6e363fa4982f7381500c5d25dd6

See more details on using hashes here.

File details

Details for the file aacgmv2-2.6.1-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: aacgmv2-2.6.1-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

File hashes

Hashes for aacgmv2-2.6.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 57b15a94a0d4f11781d104c158a2b92a64a9b7df110a8eda37b9e1f50d9b2642
MD5 9f95ba5ed8a5680a27357b7884abfc6c
BLAKE2b-256 42d962b88e9bde29571b3cb03d181d0381d56ce724fdd4730262cde6418dccfd

See more details on using hashes here.

File details

Details for the file aacgmv2-2.6.1-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: aacgmv2-2.6.1-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

File hashes

Hashes for aacgmv2-2.6.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 62dfb72194e881e256db9d03226fb8dde665f149caa24fb98c4f177f5b50dd7a
MD5 124131174368fc9520bdee2212d63fa7
BLAKE2b-256 17c11b02e57ff17efa732f28ef34798f11f67ed0f3d0124b3911e895e7008d08

See more details on using hashes here.

File details

Details for the file aacgmv2-2.6.1-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: aacgmv2-2.6.1-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

File hashes

Hashes for aacgmv2-2.6.1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 6b5cce5f294998aafcd58de1ee1eec77d5d47359e69da895a942ac8a2de14e0e
MD5 02c26721a4b8c4072d5136c731c14839
BLAKE2b-256 355c875671d520954475033e428e59ea8e5181711be12987293e5adbdb121cc4

See more details on using hashes here.

File details

Details for the file aacgmv2-2.6.1-cp27-cp27m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: aacgmv2-2.6.1-cp27-cp27m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 2.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

File hashes

Hashes for aacgmv2-2.6.1-cp27-cp27m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 4b2dbd1664e3072447f884dfe6030f7abafe81ce8ee07eeb58af0241bc78fe74
MD5 2a59c5fd9b7d48d25c3affc116a660d6
BLAKE2b-256 2d57845d6dcbff84fb4b0a25ba035c8ae7c9853e20a649543764e7321f70a6b9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page