[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orekit Users] CelestialBody.getPVCoordinates() not working in Python

Hi everybody,
I just got started today with Orekit, and I used JCC to integrate it in Python
I tried to run the demo python script from the wiki page and it worked fine.
I am now trying to get the Moon position in EME2000 frame but the last line of
the script below returns the error {'CelestialBody' object has no attribute
import orekit

from java.io import File
from org.orekit.data import DataProvidersManager, ZipJarCrawler
from org.orekit.time import TimeScalesFactory, AbsoluteDate
from org.orekit.frames import FramesFactory
from org.orekit.bodies import CelestialBodyFactory

#Setup Orekit:
DM = DataProvidersManager.getInstance()
datafile = File('lib/xtra/orekit/orekit-data.zip')
if datafile.exists() == False:
    print 'File :', datafile.absolutePath, ' not found'

crawler = ZipJarCrawler(datafile)

#Get Moon position:
utc = TimeScalesFactory.getUTC()
gei = FramesFactory.getEME2000()
moon = CelestialBodyFactory.getMoon()

date = AbsoluteDate(2014, 01, 01, 00, 00, 00.000, utc)
print moon.getPVCoordinates(date,gei).getPosition()

So I tried the following java code, and it worked fine so it's not helping me
to understand what's wrong in my Python code. Now it's been a couple of hours
I am fighting against this problem, but maybe there is somebody here who could
give me some hints to get my python script working.
Thanks in advance!


import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.orekit.bodies.CelestialBody;
import org.orekit.bodies.CelestialBodyFactory;
import org.orekit.errors.OrekitException;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScale;
import org.orekit.time.TimeScalesFactory;
import fr.cs.examples.Autoconfiguration;

public class test_01 {

    public static void main(String[] args) {
        try {

            TimeScale utc = TimeScalesFactory.getUTC();
            Frame gei = FramesFactory.getEME2000();
            CelestialBody moon = CelestialBodyFactory.getMoon();

            AbsoluteDate date = new AbsoluteDate(2014, 01, 01, 00, 00, 00,
            Vector3D pos_Moon = moon.getPVCoordinates(date,

        } catch (OrekitException oe) {