-
Notifications
You must be signed in to change notification settings - Fork 16
/
__init__.py
30 lines (20 loc) · 1.14 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
__version__ = "1.0.5"
import os as _os
# path and filename prefix for the IGRF coefficients
AACGM_v2_DAT_PREFIX = _os.path.join(_os.path.realpath(_os.path.dirname(__file__)), 'aacgm_coeffs', 'aacgm_coeffs-12-')
IGRF_12_COEFFS = _os.path.join(_os.path.realpath(_os.path.dirname(__file__)), 'igrf12coeffs.txt')
def set_coeff_path():
'''Sets the environment variables ``AACGM_v2_DAT_PREFIX`` and
``IGRF_12_COEFFS`` (for the current process). These are required for the
C library to function correctly. This function is automatically called
when importing aacgmv2. You may need to call this manually if you use
multithreading or spawn child processes (untested).
'''
_os.environ['AACGM_v2_DAT_PREFIX'] = AACGM_v2_DAT_PREFIX
_os.environ['IGRF_12_COEFFS'] = IGRF_12_COEFFS
set_coeff_path()
# NOTE: it is important that we import _aacgmv2 AFTER setting the
# environment variables above, otherwise it doesn't seem to inherit them
from aacgmv2 import _aacgmv2
from aacgmv2.wrapper import convert, convert_mlt, subsol
__all__ = ['_aacgmv2', 'convert', 'convert_mlt', 'subsol', 'set_coeff_path', 'AACGM_v2_DAT_PREFIX', 'IGRF_12_COEFFS']