Skip to content

Ecliptic (heliocentric) coordinates #1029

Answered by brandon-rhodes
salvomic asked this question in Q&A
Discussion options

You must be logged in to vote

Using the sample code from the Coordinates page linked above, I am getting results very close to the results from the web site:

from skyfield.api import load
from skyfield.framelib import ecliptic_frame

ts = load.timescale()
t = ts.utc(2025, 1, 5)

eph = load('de421.bsp')
sun = eph['sun']
mars = eph['mars']

position = sun.at(t).observe(mars)

print('Spherical ecliptic coordinates:')

lat, lon, distance = position.frame_latlon(ecliptic_frame)

print(' {:.4f} latitude'.format(lat.degrees))
print(' {:.4f} longitude'.format(lon.degrees))

I get:

Spherical ecliptic coordinates:
 1.6229 latitude
 111.0875 longitude

Probably a tweak or two might be necessary, like using an .apparent() coordin…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@salvomic
Comment options

@brandon-rhodes
Comment options

Answer selected by brandon-rhodes
@salvomic
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants