Closed chris-haste closed 3 years ago
I get:
(base) PS C:\Users\peran\Documents\workspace\nvector> ipython Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import nvector as nv
In [2]: nv.__version__
Out[2]: '0.7.5'
In [3]: wgs84 = nv.FrameE(name='WGS84')^M
...: point1 = wgs84.GeoPoint(latitude=88, longitude=0, degrees=True)^M
...: point2 = wgs84.GeoPoint(latitude=89, longitude=-170, degrees=True)^M
...: s_12, _azi1, _azi2 = point1.distance_and_azimuth(point2)^M
...: p_12_E = point2.to_ecef_vector() - point1.to_ecef_vector()^M
...: d_12 = p_12_E.length[0]^M
...: msg = 'Ellipsoidal and Euclidean distance = {:5.2f} km, {:5.2f} km'^M
...: msg.format(s_12 / 1000, d_12 / 1000)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-3-accdc39bf2e9> in <module>
4 s_12, _azi1, _azi2 = point1.distance_and_azimuth(point2)
5 p_12_E = point2.to_ecef_vector() - point1.to_ecef_vector()
----> 6 d_12 = p_12_E.length[0]
7 msg = 'Ellipsoidal and Euclidean distance = {:5.2f} km, {:5.2f} km'
8 msg.format(s_12 / 1000, d_12 / 1000)
IndexError: invalid index to scalar variable.
This is as expected and is due to the change described in issue #10. If you give scalar input in, you will get scalar output. Likewise, if you give vector input, you get vector output. In this particular example line 6 must be changed to
d_12 = p_12_E.length
without the bracket indexing.
Hi,
Using the latest version 0.7.5 the below example fails:
The error given is:
The example works correctly with version 0.7.4