| Total Complexity | 1 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import os as _os |
||
| 2 | |||
| 3 | __version__ = "2.6.0" |
||
| 4 | |||
| 5 | # path and filename prefix for the IGRF coefficients |
||
| 6 | AACGM_v2_DAT_PREFIX = _os.path.join(_os.path.realpath(_os.path.dirname(__file__)), 'aacgm_coeffs', 'aacgm_coeffs-13-') |
||
| 7 | IGRF_12_COEFFS = _os.path.join(_os.path.realpath(_os.path.dirname(__file__)), 'magmodel_1590-2020.txt') |
||
| 8 | |||
| 9 | |||
| 10 | def set_coeff_path(): |
||
| 11 | '''Sets the environment variables ``AACGM_v2_DAT_PREFIX`` and |
||
| 12 | ``IGRF_12_COEFFS`` (for the current process). These are required for the |
||
| 13 | C library to function correctly. This function is automatically called |
||
| 14 | when importing aacgm2. You may need to call this manually if you use |
||
| 15 | multithreading or spawn child processes (untested). |
||
| 16 | ''' |
||
| 17 | _os.environ['AACGM_v2_DAT_PREFIX'] = AACGM_v2_DAT_PREFIX |
||
| 18 | _os.environ['IGRF_12_COEFFS'] = IGRF_12_COEFFS |
||
| 19 | _os.environ['IGRF_COEFFS'] = IGRF_12_COEFFS |
||
| 20 | |||
| 21 | |||
| 22 | set_coeff_path() |
||
| 23 | |||
| 24 | |||
| 25 | # NOTE: it is important that we import _aacgmv2 AFTER setting the |
||
| 26 | # environment variables above, otherwise it doesn't seem to inherit them |
||
| 27 | from aacgm2 import _aacgmv2 # noqa: E402 |
||
| 28 | |||
| 29 | from .wrapper import convert, convert_mlt, subsol # noqa: E402 |
||
| 30 | |||
| 31 | __all__ = ['_aacgmv2', 'convert', 'convert_mlt', 'subsol', 'set_coeff_path', 'AACGM_v2_DAT_PREFIX', 'IGRF_12_COEFFS'] |
||
| 32 |