Ephemeris instantiation

Hi all,

I have an ephemeris file (which contains position and speed) and I try to read the data and create an Ephemeris object.

Here are my code lines:
orekit_states = []
for position_speed in orbit[1][“positionSpeedJ2000”]:
pv_j2000 = PVCoordinates(Vector3D(position_speed[“position”][“x”], position_speed[“position”][“y”],
position_speed[“position”][“z”]),
Vector3D(position_speed[“speed”][“x”], position_speed[“speed”][“y”],
position_speed[“speed”][“z”]))
co = CartesianOrbit(pv_j2000, FramesFactory.getEME2000(), date, Constants.WGS84_EARTH_MU)
orekit_states.append(SpacecraftState(co))

When I try to instantiate my Ephemeris object (eph = Ephemeris(orekit_states, 8)), I get the following error message:

orekit.InvalidArgsError: (<class ‘org.orekit.propagation.analytical.Ephemeris’>, ‘init’, ([<SpacecraftState: SpacecraftState{orbit=Cartesian parameters: {P(2097757.6423836458, 5780449.4216761645, 3192920.9367387), V(2225.559356890253, 2870.276288753063, -6658.533513386607)}, attitude=org.orekit.attitudes.Attitude@7fc7c4a, mass=1000.0, additional={}, additionalDot={}}>, …………… ,<SpacecraftState: SpacecraftState{orbit=Cartesian parameters: {P(2367626.0994545086, 6240872.489109277, 1858704.919792436), V(1673.5699740324053, 1521.2606364955427, -7239.65459088271)}, attitude=org.orekit.attitudes.Attitude@61a1ea2c, mass=1000.0, additional={}, additionalDot={}}>], 8))

Can someone help me?

Thanks,

Benje

Hi @Benje,

Welcome to the Orekit community !

This is maybe an error related to using a Python list instead of a Java-styled ArrayList ?

See this answer from Bryan for more.

Hope this helps

Hi Maxime,

thanks for your answer.
Indeed, I’ve been trying to cast the list to a Java ArrayList for a while but, since I’m new as a Python user, I didn’t manage to make my Python interpreter recognize “ArrayList”. I’ve tried “from java.util import ArrayList” but the java reference is unresolved.

Can someone help me?

Thanks,

Benje

Hi again @Benje,

I had the same problem when trying from java.util import ArrayList and section Java Virtual Machine problems → Windows from Petrus faq page solved the issue.
Does it help ?

Thanks Maxime,

I still can not import the Java ArrayList but it seems to be linked to my IDE (PyCharm).
Probably the Java runtime to be reconfigured but I didn’t manage to do it.
Nevertheless, when I run the code in a mamba prompt, it works using the “ArrayList”:

orekit_states = ArrayList()
for position_speed in orbit[1][“positionSpeedJ2000”]:
pv_j2000 = PVCoordinates(Vector3D(position_speed[“position”][“x”], position_speed[“position”][“y”], position_speed[“position”][“z”]), Vector3D(position_speed[“speed”][“x”], position_speed[“speed”][“y”], position_speed[“speed”][“z”]))
co = CartesianOrbit(pv_j2000, FramesFactory.getEME2000(), date, Constants.WGS84_EARTH_MU)
orekit_states.add(SpacecraftState(co))
date = date.shiftedBy(float(step))

return Ephemeris(orekit_states, 8)

Thanks again for your answers

Benje

Hello!

I have encountered the same issue while working with ephemeris files in my Orekit Python project. I followed the steps mentioned in this forum post to create an Ephemeris object from the data of an ephemeris file. However, the Python interpreter is not able to recognize the “ArrayList” since the jave reference is unresolved.

Has anyone found a solution to this problem?

Thanks,
Adria

Hi there,

What do you mean exactly by unresolved?
In my experience, the IDE can underline in red some imports and still rune the code without problems. Have you tried using the terminal also? If so what exception do you get exactly?

Cheers,
Romain.