Coverage for pyrdnap/__init__.py: 100%

22 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2026-05-08 18:11 -0400

1 

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

3 

4u'''A pure Python implementation of 2018 version of the Netherlands' U{RD NAP<https://www.NSGI.NL/ 

5coordinatenstelsels-en-transformaties/coordinatentransformaties/rdnap-etrs89-rdnaptrans>} 

6specification to convert between geodetic GRS80 (ETRS89) lat-/longitudes in degrees and local 

7I{B{R}ijksB{D}riehoeksmeeting (B{RD})} coordinates and I{B{N}ormaal B{A}msterdams B{P}eil (B{NAP}) 

8quasi-geoid-height} in C{meter}. 

9 

10See module L{pyrdnap.rdnap2018} for further information and usage, implementation details. 

11 

12See modules L{pyrdnap.v1grid} and L{pyrdnap.v2grid} for the I{pythonic} grid files for 

13variant 1 respectively 2 included in L{pyrdnap}. 

14 

15See function L{pyrdnap.validation3} for self-validation testing details. 

16 

17See file C{testresults/Z001_ETRSandRDNAP-self-validation-v1-results.txt} for the 

18self-validation results of the L{RDNAP2018v1} transformer, especially the summary in the 

19final 3 lines. 

20 

21@note: C{PyRDNAP} and C{pyrdnap} have B{not been formally validated} and are B{not certified} 

22 to carry the trademark name C{RDNAPTRANS(tm)}. 

23''' 

24import os.path as os_path 

25import sys 

26 

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

28pyrdnap_abspath = os_path.dirname(os_path.abspath(__file__)) # _sys._MEIPASS + '/pyrdnap' 

29_pyrdnap_ = __package__ or os_path.basename(pyrdnap_abspath) 

30 

31# setting __path__ should ... 

32__path__ = [pyrdnap_abspath] 

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

34 import pyrdnap.__pygeodesy as _ # PYCHOK unused 

35except ImportError: # ... if it doesn't, extend sys.path to include 

36 # this very directory such that all public and private sub-modules 

37 # can be imported (by epydoc, checked by PyChecker, etc.) 

38 if pyrdnap_abspath not in sys.path: 

39 sys.path.insert(0, pyrdnap_abspath) # XXX __path__[0] 

40 

41try: # PYCHOK once 

42 from pyrdnap.__pygeodesy import _SPACE_, _versions as _pygeodesy_versions # PYCHOK ... 

43except (AttributeError, ImportError) as x: 

44 raise AssertionError(str(x)) 

45 

46from pyrdnap.rd0 import * # PYCHOK * 

47from pyrdnap.rd0 import __all__ as _rd0 # PYCHOK ? 

48from pyrdnap.rdnap2018 import * # PYCHOK * 

49from pyrdnap.rdnap2018 import __all__ as _rdnap # PYCHOK ? 

50from pyrdnap.v_self import * # PYCHOK * 

51from pyrdnap.v_self import __all__ as _v_self # PYCHOK ? 

52 

53__all__ = ('pyrdnap_abspath',) + _rd0 + _rdnap + _v_self 

54__version__ = '26.05.08' 

55 

56 

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

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

59 v = __version__.replace('.0', '.') 

60 l_ = [_pyrdnap_, v] + _pygeodesy_versions(None) 

61 return _SPACE_.join(l_) 

62 

63 

64del _rd0, _rdnap, _v_self # os_path, sys 

65 

66# **) MIT License 

67# 

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

69# 

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

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

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

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

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

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

76# 

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

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

79# 

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

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

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

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

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

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

86# OTHER DEALINGS IN THE SOFTWARE.