Coverage for pyaxqg / __init__.py: 100%

21 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-08-22 11:45 -0400

1 

2# -*- coding: utf-8 -*- 

3 

4u'''A pure Python implementation of a biaxial and U{triaxial reference ellipsoid for the 

5Earth<https://link.Springer.com/article/10.1007/s00190-023-01717-1>} with conversion 

6between geodetic lat-, longitude with ellipsoidal height C{h} and (geocentric) cartesian 

7X, Y, Z with orthometric height C{H} using bilinear interpolation of quasi-geoid height 

8C{axN} in bi- and trixial, C{1-degree} grids. 

9 

10See U{pygeodesy.geoids<https://mrjean1.GitHub.io/PyGeodesy/docs/pygeodesy.geoids-module.html>} 

11for other pure Python geoid implementations and height interpolations. 

12 

13See the L{pyaxqg main<pyaxqg.__main__>} module for some usage examples and comparison with the 

14U{pygeodesy.GeoidKarney<https://GeographicLib.SourceForge.io/C++/doc/geoid.html#geoidinst>} results. 

15''' 

16import os.path as os_path 

17import sys 

18 

19# _isfrozen = getattr(_sys, 'frozen', False) 

20pyaxqg_abspath = os_path.dirname(os_path.abspath(__file__)) # _sys._MEIPASS + '/pyaxqg' 

21_pyaxqg_ = __package__ or os_path.basename(pyaxqg_abspath) 

22 

23# setting __path__ should ... 

24__path__ = [pyaxqg_abspath] 

25try: # ... make this import work, ... 

26 import pyaxqg.__pygeodesy as __pygeodesy # noqa: F401 

27except ImportError: # ... if not, extend sys.path 

28 if pyaxqg_abspath not in sys.path: 

29 sys.path.insert(0, pyaxqg_abspath) 

30 import pyaxqg.__pygeodesy as __pygeodesy # noqa: F401 

31 

32import pyaxqg.axqgs as _axqgs # noqa: F401 

33 

34__all__ = __pygeodesy._ALL_STAR(_pyaxqg_, _axqgs, __pygeodesy) 

35__version__ = '26.08.22' 

36 

37del _axqgs # os_path, sys 

38 

39 

40def _sys_modules_pyaxqg(_ax_grids_): 

41 # set sys.modules['pyaxqg.ax_grids'] to ax_grids from ax_grids.zip 

42 p = os_path.join(pyaxqg_abspath, __pygeodesy._DOT_(_ax_grids_, 'zip')) 

43 sys.path.insert(0, p) 

44 try: # ignore Zipimporter.exec_module, .load_module 

45 import ax_grids 

46 sys.modules[__pygeodesy._DOT_(_pyaxqg_, _ax_grids_)] = ax_grids 

47 except ImportError: 

48 ax_grids = None 

49 finally: 

50 assert sys.path.pop(0) == p 

51 return ax_grids 

52 

53 

54def _versions(**sep): # in .__main__, .test/bases 

55 # Get the pyaxqg, pygeodesy, Python ... versions (C{str}). 

56 return __pygeodesy._versions(pyaxqg=__version__, **sep) 

57 

58 

59# **) MIT License 

60# 

61# Copyright (C) 2026-2026 -- mrJean1 at Gmail -- All Rights Reserved. 

62# 

63# Permission is hereby granted, free of charge, to any person obtaining a 

64# copy of this software and associated documentation files (the "Software"), 

65# to deal in the Software without restriction, including without limitation 

66# the rights to use, copy, modify, merge, publish, distribute, sublicense, 

67# and/or sell copies of the Software, and to permit persons to whom the 

68# Software is furnished to do so, subject to the following conditions: 

69# 

70# The above copyright notice and this permission notice shall be included 

71# in all copies or substantial portions of the Software. 

72# 

73# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 

74# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 

75# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 

76# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 

77# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 

78# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 

79# OTHER DEALINGS IN THE SOFTWARE.