How to calculate planet position in ecliptic frame latitude and longitde

Hello everyone I don’t know how to calculate planet position in an ecliptic frame using astropy here’s my code please help me I am new to astropy…

from astropy.time import Time
from astropy.coordinates import solar_system_ephemeris, EarthLocation
from astropy.coordinates import get_body_barycentric, get_body, get_moon
from astropy import units as u
from astropy.coordinates import SkyCoord, builtin_frames

t = Time("2014-09-22 23:22")
loc = EarthLocation.of_site('greenwich')

x = solar_system_ephemeris.set('de440s')
y = get_body('jupiter',t,loc)

You’re almost there! Your y is a SkyCoord instance in the GCRS coordinate frame, so a corrected form of your last line is:


The target can be the string 'geocentrictrueecliptic' instead of the frame class, or it can be a frame instance if you need to transform to a frame with non-default frame attributes (e.g., equinox other than J2000.0).