Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!

A Python wrapper for Apex coordinates

Project Description

Documentation Status PyPI Package latest release doi

This is a Python wrapper for the Apex fortran library by Emmert et al. [2010] [1], which allows converting between geodetic, modified apex, and quasi-dipole coordinates as well as getting modified apex and quasi-dipole base vectors (Richmond [1995] [2]). MLT calculations are also included. The package is free software (MIT license).

Quick start

Install (requires NumPy before installation):

pip install apexpy

Conversion is done by creating an Apex object and using its methods to perform the desired calculations. Some simple examples:

>>> from apexpy import Apex
>>> from __future__ import print_function
>>> A = Apex(date=2015.3)  # datetime objects are also supported
>>> # geo to apex, scalar input
>>> mlat, mlon = A.convert(60, 15, 'geo', 'apex', height=300)
>>> print("{:.12f}, {:.12f}".format(mlat, mlon))
57.469573974609, 93.633583068848
>>> # apex to geo, array input
>>> glat, glon = A.convert([90, -90], 0, 'apex', 'geo', height=0)
>>> print(["{:.12f}, {:.12f}".format(ll, glon[i]) for i,ll in enumerate(glat)])
['83.099594116211, -84.594589233398', '-74.388267517090, 125.714927673340']
>>> # geo to MLT
>>> import datetime as dt
>>> mlat, mlt = A.convert(60, 15, 'geo', 'mlt', datetime=dt.datetime(2015, 2, 10, 18, 0, 0))
>>> print("{:.12f}, {:.12f}".format(mlat, mlt))
56.590423583984, 19.108103879293
>>> # can also convert magnetic longitude to mlt
>>> mlt = A.mlon2mlt(120, dt.datetime(2015, 2, 10, 18, 0, 0))
>>> print("{:.2f}".format(mlt))

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


[1]Emmert, J. T., A. D. Richmond, and D. P. Drob (2010), A computationally compact representation of Magnetic-Apex and Quasi-Dipole coordinates with smooth base vectors, J. Geophys. Res., 115(A8), A08322, doi:10.1029/2010JA015326.
[2]Richmond, A. D. (1995), Ionospheric Electrodynamics Using Magnetic Apex Coordinates, Journal of geomagnetism and geoelectricity, 47(2), 191–212, doi:10.5636/jgg.47.191.


docs Documentation Status
PyPI Package latest release Supported versions
PyPI Wheel Supported implementations


1.0.3 (2018-04-05)

  • Updated badges and added DOI
  • Added tests for python 3.6
  • Removed tests for python 3.3
  • Made some PEP8 changes

1.0.2 (2018-02-27)

  • Extend character limit for allowable data file path, and update documentation to reflect a change in maintainers. Also updated testing implimentation, reduced fortran compiler warnings, and improved PEP8 compliance.

1.0.1 (2016-03-10)

  • Remove geocentric to geodetic conversion of subsolar point based on feedback from Art Richmond. (The subsolar point is the same in geocentric and geodetic coordinates.) The helper function gc2gdlat have been kept to preserve backwards compatibility.

1.0.0 (2015-11-30)

  • Initial release

Release history Release notifications

This version
History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
apexpy-1.0.3-cp27-cp27m-macosx_10_12_x86_64.whl (365.4 kB) Copy SHA256 hash SHA256 Wheel cp27 Apr 6, 2018
apexpy-1.0.3-cp34-cp34m-macosx_10_12_x86_64.whl (363.9 kB) Copy SHA256 hash SHA256 Wheel cp34 Apr 6, 2018
apexpy-1.0.3-cp35-cp35m-macosx_10_12_x86_64.whl (364.3 kB) Copy SHA256 hash SHA256 Wheel cp35 Apr 6, 2018
apexpy-1.0.3-cp36-cp36m-macosx_10_12_x86_64.whl (363.9 kB) Copy SHA256 hash SHA256 Wheel cp36 Apr 6, 2018
apexpy-1.0.3.tar.gz (253.4 kB) Copy SHA256 hash SHA256 Source None Apr 6, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page