Coverage for pyrdnap / __init__.py: 100%

24 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-06-26 11:46 -0400

1 

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

3 

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

5www.NSGI.NL/coordinatenstelsels-en-transformaties/coordinatentransformaties/rdnap-etrs89-rdnaptrans>} 

6specification to convert between GRS80 (ETRS89) geodetic lat-, longitudes and height 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}. 

9 

10The results of both B{C{pyrdnap}} transformer classes L{RDNAP2018v1} and L{RDNAP2018v2} have been 

11formally validated and B{C{PyRDNAP}} has been certified to carry the trademark B{C{RDNAPTRANS(tm)}}. 

12 

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

14 

15See modules L{pyrdnap.v1grid} and L{pyrdnap.v2grid} for the C{RDNAPTRANS(tm)2018_v220627} grid 

16files, each the original, unmodified ASCII C{.txt} but compressed as C{.txt.zip}. 

17 

18See function L{pyrdnap.validation3} for C{.../Z001_ETRSandRDNAP.txt} test set details. 

19 

20See files C{testresults/v1_..._round_trips.txt} for "round-trip" (forward plus reverse) test 

21results of the L{RDNAP2018v1} transformer, especially the final, summary lines in each file. 

22''' 

23import os.path as os_path 

24import sys 

25 

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

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

28_pyrdnap_ = __package__ or os_path.basename(pyrdnap_abspath) 

29 

30# setting __path__ should ... 

31__path__ = [pyrdnap_abspath] 

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

33 import pyrdnap.__pygeodesy as _ # noqa: F401 

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

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

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

37 if pyrdnap_abspath not in sys.path: 

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

39 

40try: # PYCHOK pygeodesy 

41 from pyrdnap.__pygeodesy import * # noqa: F403 

42except (AttributeError, ImportError) as x: 

43 raise AssertionError(str(x)) 

44 

45from pyrdnap.rd0 import * # noqa: F403 

46from pyrdnap.rdnap2018 import * # noqa: F403 

47from pyrdnap.v_self import * # noqa: F403 

48 

49 

50def _all__init__(*names): # deleted below 

51 from pyrdnap.__pygeodesy import _all__all__ # PYCHOK ... 

52 _all__all__.extend(names) 

53 _all__all__[:] = sorted(_all__all__) # set(_all__all__) 

54 return _all__all__ 

55 

56 

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

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

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

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

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

62 return _SPACE_.join(l_) # PYCHOK shadows? 

63 

64 

65__all__ = _all__init__('pyrdnap_abspath') 

66__version__ = '26.06.26' 

67# del _all__init__ 

68 

69# **) MIT License 

70# 

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

72# 

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

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

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

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

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

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

79# 

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

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

82# 

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

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

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

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

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

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

89# OTHER DEALINGS IN THE SOFTWARE.