Sun object does not have getPVCoordinates available


When I generate a CelestialBody like below, getPVCoordinates isn’t available when documentation suggests that it should be.

from org.orekit.bodies import CelestialBodyFactory
sun = CelestialBodyFactory.getSun()

When I try to getPVCoordinates I get:

AttributeError: ‘CelestialBody’ object has no attribute ‘getPVCoordinates’

also, when I do

Out[39]: <Class: class org.orekit.bodies.JPLCelestialBody>

Not sure if a “JPLCelestialBody” is a different class than the “CelestialBody” which is in the API docs.

Is there a workaround to get the sun position in a specified frame?

Thanks for your time,


When using the Python wrapper, the CelestialBody object must be explicitely casted to the PVCoordinatesProvider interface, for instance:

from org.orekit.utils import PVCoordinatesProvider
sun_pv_provider = PVCoordinatesProvider.cast_(sun)
pv = sun_pv_provider.getPVCoordinates(date, frame)

I think this is true in general with the Python wrapper when you want to use a method from an interface implemented by a class: the class must be explicitely casted to the interface.

1 Like