1

I want to find the python library in which I may obtain the SUN coordinates in ECEF (Eart-Centered, Earth-Fixed) frame - geocenter coordinates. I try using jplephem, pyephem etc. but none of them availalbe to give these coordinates. Please give me library, algorithm or etc. in which I may obtained these coordinates. With greetings.

D_K
  • 11
  • 1
  • 2

1 Answers1

1

You are correct that neither of those libraries has quick support for an ECEF reference frame, though it can be faked in PyEphem by creating an Observer at latitude 0° and longitude 0° and whose elevation is negative enough to put them at the center of the Earth.

If you are interested in a more modern library, the new 1.34 version of Skyfield directly supports the standard ITRS reference frame, which is ECEF:

from skyfield import framelib
from skyfield.api import load

ts = load.timescale()
t = ts.now()

planets = load('de421.bsp')
sun = planets['sun']
earth = planets['earth']

apparent = earth.at(t).observe(sun).apparent()
vector = apparent.frame_xyz(framelib.itrs)
print(vector.au)

The result:

[-0.653207   -0.62839897 -0.38480108]

The operations you can perform with reference frames are explained in more detail here:

https://rhodesmill.org/skyfield/positions.html#coordinates-in-other-reference-frames

Brandon Rhodes
  • 83,755
  • 16
  • 106
  • 147
  • 1
    Thank you very much. Today I also found this library and used it. This library is very helpful and allowed obtain coordinates in ECEF :-) – D_K Dec 11 '20 at 21:12
  • I am glad it worked! Let me know if you need any more information before accepting this answer as correct. – Brandon Rhodes Dec 12 '20 at 14:05