pymgp.satorb.eci2ecef#

pymgp.satorb.eci2ecef(t, xsat, vsat=[])[source]#

Convert position and velocity from ECI to ECEF reference frame.

Convert position and velocity given in a non-rotating pseudo-inertial Earth Centered Inertial (ECI) reference frame into an Earth Centered Earth Fixed (ECEF) reference frame.

Parameters:
tarray_like with shape (n,) or scalar, of type datetime64, str or float

Universal time as datetime64 object, ISO date string or sequential date number (days since 1970-01-01).

xsatarray_like with shape (…,n,3) or (…,n,6)

Array with Cartesian coordinates (m) or state vector with positions (m) and velocities (m/s) in an ECI reference frame .

vsatarray_like with shape (…,n,3), optional

Array with velocities in ECI reference frame (m/s). If empty, velocities are assumed to be part of the state vector ‘xsat[…,3:6]’, or if xsat has shape (…,3), xsate = eci2ecef(t, xsat) only returns the positions.

Returns:
xsatendarray with shape (…,n,3) or shape (…,n,6)

Array with Cartesian coordinates (m) or state vector with positions (m) and velocities (m/s) in ECEF reference frame.

vsatendarray with shape (…,n,3), optional

Array with velocities in ECEF reference frame (m/s), only if the input parameter vsat is not empty.

See also

ut2gmst, ecef2eci

Notes

The function returns a single ndarray xsate with the ECEF state vector when the parameters xsat are a state vector (having 6 elements) and vsat is empty. When vsat is not empty, the function returns two ndarrays.

The function returns ndarrays with at least two dimensions.

Examples

Example with single statevector (note the two dimensional result(s))

>>> eci2ecef('2012-01-04 15:00:00',[-5767701.7786, -3097382.0132, 2737195.4374,  3001.4240, -6762.1059, -1280.2560])
array([[-3.31253110e+06, -5.64688382e+06,  2.73719544e+06,
         5.67077507e+03, -3.96999941e+03, -1.28025600e+03]])
>>> eci2ecef('2012-01-04 15:00:00',[-5767701.7786, -3097382.0132, 2737195.4374],[ 3001.4240, -6762.1059, -1280.2560])
(array([[-3312531.10067826, -5646883.81761125,  2737195.4374    ]]), array([[ 5670.77506798, -3969.99940934, -1280.256     ]]))

Two dimensional examples

>>> t = np.array(['2012-01-04 15:00:00', '2012-01-04 16:00:00', '2012-01-04 17:00:00', '2012-01-04 18:00:00'], dtype='datetime64[ns]')
>>> svec = [[-5767701.7786, -3097382.0132, 2737195.4374,  3001.4240, -6762.1059, -1280.2560],
...         [ -625224.3608, -7162713.9833,   16233.9739, -1131.8951,   116.3879,  7358.7436],
...         [-2301220.9378,  6666917.3737,  968353.5303, -6610.7556, -1833.8971, -2992.6557],
...         [-2301220.9378,  6666917.3737,  968353.5303, -6610.7556, -1833.8971, -2992.6557]]
>>> eci2ecef(t, svec)
array([[-3.31253110e+06, -5.64688382e+06,  2.73719544e+06,
         5.67077507e+03, -3.96999941e+03, -1.28025600e+03],
       [ 1.41341049e+06, -7.04965587e+06,  1.62339739e+04,
        -1.63304150e+03, -3.09546050e+02,  7.35874360e+03],
       [-2.45011540e+06,  6.61364798e+06,  9.68353530e+05,
        -6.08570289e+03, -1.80298462e+03, -2.99265570e+03],
       [-6.49857962e+05,  7.02289753e+06,  9.68353530e+05,
        -6.34510204e+03, -1.61905582e+02, -2.99265570e+03]])
>>> svec_array = np.asarray(svec)
>>> xsat = svec_array[:,0:3]
>>> vsat = svec_array[:,3:]
>>> eci2ecef(t, xsat, vsat)
(array([[-3312531.10067826, -5646883.81761125,  2737195.4374    ],
       [ 1413410.48702954, -7049655.87125032,    16233.9739    ],
       [-2450115.40038307,  6613647.97952822,   968353.5303    ],
       [ -649857.96174134,  7022897.52893159,   968353.5303    ]]), array([[ 5670.77506798, -3969.99940934, -1280.256     ],
       [-1633.0414957 ,  -309.54604979,  7358.7436    ],
       [-6085.70289335, -1802.98462425, -2992.6557    ],
       [-6345.10203574,  -161.90558206, -2992.6557    ]]))

Check that inverse operation returns the original

>>> svece = eci2ecef(t,svec)
>>> svec2 = ecef2eci(t, svece)
>>> print(np.max(np.abs(svec2-svec)) < 1e-8)
True

Example with more than two dimensions

>>> svece = eci2ecef(t, svec)
>>> svece23 = eci2ecef(t,[[svec, svec, svec],[svec, svec, svec]])
>>> svece23.shape
(2, 3, 4, 6)
>>> np.max(np.abs(svece23 - svece), axis=(-1,-2))
array([[0., 0., 0.],
       [0., 0., 0.]])