I want to find out the heliocentric position of jupiter, and the corresponding zodiac but i am having basic problems.
from skyfield.api import sun, jupiter
p = sun(utc=(1980, 1, 1)).observe(jupiter)
lat, lon, d = p.ecliptic_latlon()
print(lat)
print(lon)
the error i get:
Traceback (most recent call last):
File "/home/panos/Desktop/skyfield test.py", line 1, in <module>
from skyfield.api import sun, jupiter
ImportError: cannot import name 'sun'
if someone can help me solve the error problem and then suggest to me how to map jupiter to the constellation i would appreciate it.
By the document said, if you want to get data of sun and jupiter, you need to load ephemeris files first. After downloading, you can get the heliocentric position from the file.
The code example is below:
from skyfield.api import load
ts = load.timescale()
t = ts.utc(1980, 1, 1)
#load "de421.bsp", which built at 2008 short size ephemeris files
planets = load('de421.bsp')
sun = planets['Sun'] #get Sun data
jupiter = planets['jupiter_barycenter'] #get jupiter data, need to input full name
p = sun.at(t).observe(jupiter) #get jupiter position from zodiac
lat, lon, d = p.ecliptic_latlon()
print(lat)
print(lon)
Result is below:
<Angle +01deg 00' 46.7">
<Angle 151deg 19' 21.7">