Coverage for pyaxqg / __init__.py: 100%

21 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-08-28 17:55 -0400

1 

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

3 

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

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

6lat-, longitude with ellipsoidal height C{h} and cartesian X, Y, Z with orthometric height C{H} 

7using bilinear interpolation of quasi-geoid heights C{axN} from bi- and triaxial, C{1-degree}, 

8whole Earth grids. 

9 

10The 5 grids are columns C{Nbiaxial}, C{xE}, C{xyE}, C{xzE} and C{Ntriaxial} from U{Supplementary 

11file 2<https://link.Springer.com/article/10.1007/s00190-023-01717-1#Sec21>}, zipped. 

12 

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

14for other pure Python geoid implementations and height interpolations. 

15 

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

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

18''' 

19import os.path as os_path 

20import sys 

21 

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

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

24_pyaxqg_ = __package__ or os_path.basename(pyaxqg_abspath) 

25 

26# setting __path__ should ... 

27__path__ = [pyaxqg_abspath] 

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

29 import pyaxqg.__pygeodesy as __pygeodesy 

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

31 if pyaxqg_abspath not in sys.path: 

32 sys.path.insert(0, pyaxqg_abspath) 

33 import pyaxqg.__pygeodesy as __pygeodesy # noqa: F401 

34 

35import pyaxqg.axqgs as _axqgs # noqa: F401 

36 

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

38__version__ = '26.08.28' 

39 

40del _axqgs # os_path, sys 

41 

42 

43def _sys_modules_pyaxqg(_ax_grids_): 

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

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

46 sys.path.insert(0, p) 

47 try: # ignore Zipimporter.exec_module, .load_module 

48 import ax_grids 

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

50 except ImportError: 

51 ax_grids = None 

52 finally: 

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

54 return ax_grids 

55 

56 

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

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

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

60 

61# **) MIT License 

62# 

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

64# 

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

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

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

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

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

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

71# 

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

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

74# 

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

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

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

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

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

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

81# OTHER DEALINGS IN THE SOFTWARE.