nvector._core.mean_horizontal_position

nvector._core.mean_horizontal_position(n_EB_E)[source][source]
Return the n-vector of the horizontal mean position.
Parameters:

n_EB_E: 3 x n array

n-vectors [no unit] of positions Bi, decomposed in E.

Returns:

p_EM_E: 3 x 1 array

n-vector [no unit] of the mean positions of all Bi, decomposed in E.

Examples

Example 7: “Mean position”

http://www.navlab.net/images/ex7img.png

Three positions A, B, and C are given as n-vectors n_EA_E, n_EB_E, and n_EC_E. Find the mean position, M, given as n_EM_E. Note that the calculation is independent of the depths of the positions.

Solution:
>>> import numpy as np
>>> import nvector as nv
>>> from nvector import rad, deg
>>> n_EA_E = lat_lon2n_E(rad(90), rad(0))
>>> n_EB_E = lat_lon2n_E(rad(60), rad(10))
>>> n_EC_E = lat_lon2n_E(rad(50), rad(-20))
>>> n_EM_E = unit(n_EA_E + n_EB_E + n_EC_E)
or
>>> n_EM_E = nv.mean_horizontal_position(np.hstack((n_EA_E, n_EB_E, n_EC_E)))
>>> lat, lon = nv.n_E2lat_lon(n_EM_E)
>>> lat, lon = deg(lat), deg(lon)
>>> msg = 'Ex7: Pos M: lat, lon = {:4.2f}, {:4.2f} deg'
>>> msg.format(lat[0], lon[0])
'Ex7: Pos M: lat, lon = 67.24, -6.92 deg'
See also
Example 7 at www.navlab.net