pymgp.crstrans.ellnormal#

pymgp.crstrans.ellnormal(ref, mode='plh', unit='rad')[source]#

Compute unit normal vector (ECEF) perpendicular to the ellipsoid at a given location.

Parameters:
refarray_like with shape (…,3) or (…,2)

Reference position(s) on the ellipsoid. The type of coordinates are specified by mode. ref can be a vector with more than one coordinate triplet/doublet.

mode{‘plh’, ‘xyz’,’normalize’}, default = ‘plh’

Coordinate type for ref. Possible values are:

  • ‘plh’ : ref contains the geographic latitude and longitude with the unit specified by unit. A third coordinate with the height is optional, but not used.

  • ‘xyz’ : ref contains cartesian XYZ coordinates in the ECEF of a point (close) to the ellipsoid. The normal vector is computed for a point on the ellipsoid above or below ref.

  • ‘normal’ : ref contains a vector with Cartesian coordinates. The function returns the normalized unit vector.

unit{‘rad’, ‘deg’}, default = ‘rad’

Units for latitude and longitude, only useful in case the mode=’plh’ option is used.

Returns:
nndarray with shape (…,3)

Unit normal vector(s) in Cartesian XYZ coordinates.

Examples

>>> n = ellnormal([52*np.pi/180, 4*np.pi/180])
>>> print(n)
[0.61416175 0.04294637 0.78801075]
>>> n = ellnormal([52, 4], unit='deg')
>>> print(n)
[0.61416175 0.04294637 0.78801075]
>>> n = ellnormal([[50, 0], [52, 4]] , unit='deg')
>>> print(n)
[[0.64278761 0.         0.76604444]
 [0.61416175 0.04294637 0.78801075]]
>>> n = ellnormal([[50, 0, 0], [52, 4, 2]] , unit='deg')
>>> print(n)
[[0.64278761 0.         0.76604444]
 [0.61416175 0.04294637 0.78801075]]
>>> xyz = plh2xyz([[50, 0, 0], [52, 4, 2]] , unit='deg')
>>> n  = ellnormal(xyz, mode='xyz')
>>> print(n)
[[0.64278761 0.         0.76604444]
 [0.61416175 0.04294637 0.78801075]]

The next example does not give the same result as above because the normal direction is different

>>> n = ellnormal(xyz, mode='normal')
>>> print(n)
[[0.64531918 0.         0.76391306]
 [0.61672217 0.04312542 0.7859987 ]]