pbrod / nvector

Nvector is a suite of tools written in Python to solve geographical position calculations.
Other
58 stars 7 forks source link

KeyError: 'point' in __repr__ of Pvector #15

Closed f380cedric closed 3 years ago

f380cedric commented 3 years ago

Python 3.9.2 nvector 0.7.7

Following Example 1:

import numpy as np
import nvector as nv
wgs84 = nv.FrameE(name='WGS84')
pointA = wgs84.GeoPoint(latitude=1, longitude=2, z=3, degrees=True)
pointB = wgs84.GeoPoint(latitude=4, longitude=5, z=6, degrees=True)
p_AB_N = pointA.delta_to(pointB)
print(p_AB_N)

gives

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/f380cedric/.local/lib/python3.9/site-packages/nvector/objects.py", line 138, in __repr__
    params = fmt.join(['{}={!r}'.format(name, dict_params[name])
  File "/home/f380cedric/.local/lib/python3.9/site-packages/nvector/objects.py", line 138, in <listcomp>
    params = fmt.join(['{}={!r}'.format(name, dict_params[name])
  File "/home/f380cedric/.local/lib/python3.9/site-packages/nvector/objects.py", line 138, in __repr__
    params = fmt.join(['{}={!r}'.format(name, dict_params[name])
  File "/home/f380cedric/.local/lib/python3.9/site-packages/nvector/objects.py", line 138, in <listcomp>
    params = fmt.join(['{}={!r}'.format(name, dict_params[name])
KeyError: 'point'

It goes like this: Pvector.__dict__["frame"] → FrameN.__dict__["point"]. FrameN._NAMES gives "point" while dict_params only contains key nvector.

pbrod commented 3 years ago

Thanks for the notification. This is clearly a bug!

pbrod commented 3 years ago

Closing since it is fixed in commit https://github.com/pbrod/nvector/commit/096e0b8ce7294492b27f16f8dd37585e57dd7044