5.2.12. nvector.core.p_EB_E2n_EB_E¶
-
p_EB_E2n_EB_E
(p_EB_E, a=6378137, f=0.0033528106647474805, R_Ee=None)[source]¶ Converts Cartesian position vector in meters to n-vector.
- Parameters
- p_EB_E: 3 x n array
Cartesian position vector(s) from E to B, decomposed in E.
- a: real scalar, default WGS-84 ellipsoid.
Semi-major axis of the Earth ellipsoid given in [m].
- f: real scalar, default WGS-84 ellipsoid.
Flattening [no unit] of the Earth ellipsoid. If f==0 then spherical Earth with radius a is used in stead of WGS-84.
- R_Ee3 x 3 array
rotation matrix defining the axes of the coordinate frame E.
- Returns
- n_EB_E: 3 x n array
n-vector(s) [no unit] of position B, decomposed in E.
- depth: 1 x n array
Depth(s) [m] of system B, relative to the ellipsoid (depth = -height)
Notes
The position of B (typically body) relative to E (typically Earth) is given into this function as cartesian position vector p_EB_E, in meters. (“ECEF-vector”). The function converts to n-vector, n_EB_E and its depth, depth. The calculation is excact, taking the ellipsity of the Earth into account. It is also non-singular as both n-vector and p-vector are non-singular (except for the center of the Earth). The default ellipsoid model used is WGS-84, but other ellipsoids/spheres might be specified.
Examples
Example 3: “ECEF-vector to geodetic latitude”
Position B is given as an “ECEF-vector” p_EB_E (i.e. a vector from E, the center of the Earth, to B, decomposed in E). Find the geodetic latitude, longitude and height (latEB, lonEB and hEB), assuming WGS-84 ellipsoid.
- Solution:
>>> import numpy as np >>> import nvector as nv >>> from nvector import deg >>> wgs84 = dict(a=6378137.0, f=1.0/298.257223563) >>> p_EB_E = 6371e3 * np.vstack((0.9, -1, 1.1)) # m
>>> n_EB_E, z_EB = nv.p_EB_E2n_EB_E(p_EB_E, **wgs84)
>>> lat_EB, lon_EB = nv.n_E2lat_lon(n_EB_E) >>> h = -z_EB >>> lat, lon = deg(lat_EB), deg(lon_EB)
>>> msg = 'Ex3: Pos B: lat, lon = {:4.2f}, {:4.2f} deg, height = {:9.2f} m' >>> msg.format(lat[0], lon[0], h[0]) 'Ex3: Pos B: lat, lon = 39.38, -48.01 deg, height = 4702059.83 m'