ECEF to ECI

1,500 views
Skip to first unread message

Thomas Lavergne

unread,
Feb 23, 2015, 10:58:01 AM2/23/15
to pyt...@googlegroups.com
Dear all,

I face the challenge of converting satellite cartesian coordinates from Earth Centered Earth Fixed (ECEF) system to Earth Centered Intertial (ECI) system. Basically, most the satellite geo-positions we (I?) work with are in ECI (meaning taking into account Earth's rotation) but I have this new annoying dataset that is ECEF.

Anyway... this is is clearly something for pyorbital...

Any of you PyTrollers experience with this type of tranformations? There are several links on the net, but I thought I would first ask you.

All the best,
Thomas

Thomas Lavergne

unread,
Feb 24, 2015, 6:50:30 AM2/24/15
to pyt...@googlegroups.com
Hei group,

As an answer to myself:

I ended up with the following routine. Most of the dirty work is actually already implemented in pyorbital:

======================
from pyorbital import astronomy

def ecef_to_eci(xyz,utc_times):
""" Convert ECEF (Earth Centered Earth Fixed) positions to ECI (Earth Centered Inertial)
positions:
XYZ are cartesian positions in ECEF. Should have shape (...,3)
UTC_times are UTC_times. Sould have shape (...)

http://ccar.colorado.edu/ASEN5070/handouts/coordsys.doc

[X] [C -S 0][X]
[Y] = [S C 0][Y]
[Z]eci [0 0 1][Z]ecf

C and S are cos() and sin() of gmst (Greenwich Meridian Sideral Time)

Inspired from satellite-js (https://github.com/shashwatak/satellite-js)
"""
# XYZ and utc_time must have the same shape
if not xyz.shape[:-1] == utc_times.shape:
raise ValueError("shape mismatch for XYZ and utc_times (got {} and {})".format(xyz.shape[:-1],utc_times.shape))

gmst = -1 * astronomy.gmst(utc_times)
eci = xyz.copy()
eci[:,0] = xyz[:,0]*np.cos(gmst) - xyz[:,1]*np.sin(gmst)
eci[:,1] = xyz[:,0]*np.sin(gmst) + xyz[:,1]*np.cos(gmst)
return eci

======================

This routine could belong to pyorbital/astronomy.py

Things I did not really check:
* the computation of Greenwich Meridian Sidereal Time (GMST) involves UTC times, and thus leap seconds. I am not sure they are correctly treated in the provided gmst routine.
* for some reason, I had to use "-1 * gmst()" in the formula...

Thomas
> --
> You received this message because you are subscribed to the Google Groups
> "pytroll" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pytroll+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

Martin Raspaud

unread,
Feb 24, 2015, 7:46:34 AM2/24/15
to pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Thomas,

great work ! Feel free to add it to astronomy.py.

About leap seconds, this might indeed be a problem, since datetime for
example doesn't seem to take them into account...

Best regards,
Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBAgAGBQJU7HKpAAoJEBdvyODiyJI4z/IIAI7fPzpA4aQeMGB9KX2Yhmog
zj+16scstu+I2T+KtRClJSCe73qX9f3K3Se6qF1DFCDzyZnWHHepleTZTJRbtbab
vfFxTwvU9SYxaIEcTVLJ/k3dVukwzooQCzKezFopdFu5cTPGfLKvBass1hrnAaEz
NpDRGN+ORazr4S2d8YQJcTC/BW+eW1IpWaonrO/HJtcgjTTpurub3QCJ9nOJ+Vb1
zunmiWAe6tsA/KKaGGU7mOsIGRVTkGiwzl+8phqE+9COJ9pMIn1V1kvE2EBCTq2u
siz/PMaLb439jFBG/c/VCUjlp2bUq21r7yaSqgCR3W7MhWDtF0zmUfIVUVioKfA=
=4sIE
-----END PGP SIGNATURE-----
martin_raspaud.vcf

Daniel L

unread,
Oct 25, 2018, 4:31:41 PM10/25/18
to pytroll
Hey Thomas,

I have been working through this as well, and it looks like the results don't quite match unless I change your 

gmst = -1 * astronomy.gmst(utc_times)

line to just be +1.  Unless something has changed downstream of this
Reply all
Reply to author
Forward
0 new messages