brandon-rhodes / python-sgp4

Python version of the SGP4 satellite position library
MIT License
377 stars 88 forks source link

TEME to ECEF conversion #61

Closed joseherrerasamp closed 4 years ago

joseherrerasamp commented 4 years ago

Hello,

I am developing an orbit propagator for a thesis and i am trying to check the result i am getting with STK propagator.

I am finding that the results not match, and i have seen that SGP4.propagate returns the position and velocity vectors in TEME reference system. I am trying to get it in the ECEF reference system but i am quite new at this, and i am not getting it.

Is there any way to perform that conversion directly through sgp4 or some other library ?

Any help is more than welcome.

Thank you so much in advance.

brandon-rhodes commented 4 years ago

Yes! I should update the documentation to explicitly mention “ECEF” — currently the introduction at the top of the documentation says:

Note that this package produces raw Earth-centered cartesian coordinates. It does not implement all the steps necessary to convert satellite positions into geographic coordinates. For that, look for a comprehensive astronomy library that is built atop this one, like the Skyfield library:

http://rhodesmill.org/skyfield/earth-satellites.html

But without acronyms inside that paragraph probably did not catch your eye? Let me go see how I can reword it.

brandon-rhodes commented 4 years ago

@joseherrerasamp — Okay, I have drafted a new version of that paragraph:

Note that the SGP4 propagator returns raw *x,y,z* Cartesian coordinates
in a “True Equator Mean Equinox” (TEME) reference frame that’s centered
on the Earth but does not rotate with it — an “Earth centered inertial”
(ECI) reference frame.  The SGP4 propagator itself does not implement
the math that’s necessary to convert these positions into more official
ECI frames like J2000 or the ICRF.  Nor does it provide conversion into
any Earth-centered Earth-fixed (ECEF) frames whose coordinates are fixed
with respect to the Earth’s surface, like the ITRF that defines latitude
and longitude.

For conversions into other coordinate frames, look for a comprehensive
astronomy library that is built atop this one, like the `Skyfield
<http://rhodesmill.org/skyfield/>`_ library:

http://rhodesmill.org/skyfield/earth-satellites.html

If on the next release that paragraph near the top of the documentation gets updated to this new text, do you think it will be more likely to help users who need other coordinate systems?

joseherrerasamp commented 4 years ago

Hello @brandon-rhodes ! Now it is much clearer! Thank you so much

But, I am still having problems to find my solution. I mean, i am searching through skyfield but i cant find any function/method which returns me ECEF position and velocity coordinates from the TEME parameters I have.

Sorry for all the inconveniences

Again, thank you in advance!

brandon-rhodes commented 4 years ago

The simplest approach would be to use a Skyfield EarthSatellite object — then Skyfield handles the coordinate transforms for you.

If you want to do it manually, there's a TEME_to_ITRF() function in skyfield.sgp4lib. Maybe I should document it somewhere for folks doing very low-level operations on raw coordinates?

joseherrerasamp commented 4 years ago

Okey! I would try that. Thank you so much Brandon!

All possible documentation is always helpfull!

brandon-rhodes commented 4 years ago

I've pasted that paragraph into the official docs, so it should appear with the next release! Feel free to open an issue over on Skyfield if you want to remind me to add TEME_to_ITRF() docs — and suggest where I might put them, if you do; I am not sure where it would best go, since a Skyfield user would themselves never use it.

eaeyal commented 7 months ago

Is there support for array acceleration with this method?

brandon-rhodes commented 7 months ago

The TEME_to_ITRF() function accepts arrays, yes.