Hello everybody,
I implemented my Orekit code in python environment.
I need to retrieve the Sun position wrt the Earth in an Inertial reference frame. I found the method getsun() in the class CelestialBodyFactory but I don’t understand if it actually returns the position of the Sun and in which reference frame.
Could someone help me?
Thanks a lot.
Hi @Tanozar,
From CelestialBodyFactory.getSun()
, you get the Sun as a CelestialBody
from which you can get the position at any date and in any frame according to the following excerpt which gives the position of the Sun in the EME2000 inertial frame:
CelestialBody sun = CelestialBodyFactory.getSun() ;
Vector3D sunPositionInECI = sun.getPVCoordinates(date, FramesFactory.getEME2000()).getPosition() ;
This is Java code, I don’t know the python way.
Regards,
Pascal
Hi @Tanozar and @pascal.parraud ,
In python, see the tutorials Orekit in Python - The basics. There is an additional step, cast_
to PVCoordinatesProvider
.
from org.orekit.bodies import CelestialBodyFactory
from org.orekit.utils import PVCoordinatesProvider
from org.orekit.time import AbsoluteDate, TimeScalesFactory
from org.orekit.frames import FramesFactory
sun = CelestialBodyFactory.getSun() # Here we get it as an CelestialBody
sun = PVCoordinatesProvider.cast_(sun) # But we want the PVCoord interface
# Get the position of the sun in the Earth centered coordinate system EME2000
date = AbsoluteDate(2020, 2, 28, 23, 30, 0.0, TimeScalesFactory.getUTC())
sun.getPVCoordinates(date, FramesFactory.getEME2000()).getPosition()
Regards,
Lirw
1 Like