Moon position wrt Earth discrepancy between orekit and jplephem

Hello everyone,

I am trying to replace a Python function with some Orekit methods. The function uses the jplephem package to get the Moon’s coordinates in ECI.

I tested different approaches with Orekit, however I do not obtain the same result as the one obtained with jplephem.

I am using Orekit 12.0 so the ephemeris file is ‘orekit-data/DE-440-ephemerides/lnxp1990.440’ . Whereas the file used by jplephem is de440.bsp. The only explanation that I can think of is that both files might not contain the same information, but I am not quite sure.

So my questions are:

  • Why don’t I get the same result?
  • Which Orekit approach is better?

Here there is the Python code:

import datetime
import jplephem.spk
import pathlib

jpl_ephemeris_file = pathlib.Path().resolve().joinpath('de440.bsp')
kernel = jplephem.spk.SPK.open(jpl_ephemeris_file)

t_utc = datetime.datetime(2020, 12, 6, 10, 54)
# get julian date in TT scale
t_jd = astropy.time.Time(t_utc.isoformat(), format='isot', scale='utc').tt.jd

earthbary2moon=kernel[3,301].compute(t_jd)
earthbary2earth = kernel[3,399].compute(t_jd)
earth2moon = earthbary2moon-earthbary2earth
moon_pos_eci = earth2moon*1e3

I obtain moon_pos_eci = [-3.10778888e+08, 1.88690714e+08, 1.16647898e+08]

My Orekit code is:

utc = org.orekit.time.TimeScalesFactory.getUTC()
abs_date = org.orekit.time.AbsoluteDate(2020, 12, 6, 10, 54, 0.0, utc)
eci = org.orekit.frames.FramesFactory.getEME2000()

# Approach 1
moon = org.orekit.bodies.CelestialBodyFactory.getMoon()
moon_pos_eci_app1 = org.orekit.utils.PVCoordinatesProvider.cast_(moon).getPosition(abs_date, eci)

# Approach 2
earthLoader = org.orekit.bodies.JPLEphemeridesLoader(
            'lnxp1990.440',
            org.orekit.bodies.JPLEphemeridesLoader.EphemerisType.EARTH)
moonLoader = org.orekit.bodies.JPLEphemeridesLoader(
            'lnxp1990.440',
            org.orekit.bodies.JPLEphemeridesLoader.EphemerisType.MOON)
baryLoader = org.orekit.bodies.JPLEphemeridesLoader(
            'lnxp1990.440',
            org.orekit.bodies.JPLEphemeridesLoader.EphemerisType.EARTH_MOON)

earthFrame = earthLoader.loadCelestialBody(org.orekit.bodies.CelestialBodyFactory.EARTH).getInertiallyOrientedFrame()
moonFrame = moonLoader.loadCelestialBody(org.orekit.bodies.CelestialBodyFactory.MOON).getInertiallyOrientedFrame()
baryFrame = baryLoader.loadCelestialBody(org.orekit.bodies.CelestialBodyFactory.EARTH_MOON).getInertiallyOrientedFrame()

bary2moon = moonFrame.getTransformTo(baryFrame, abs_date).getTranslation()
bary2earth = earthFrame.getTransformTo(baryFrame, abs_date).getTranslation()
earth2moon = bary2moon.subtract(bary2earth)

Where moon_pos_eci_app1 = [-310,778,891.4369477; 188,690,696.69546238; 116,647,917.47247553] and earth2moon =[-316,468,950.2885845; 201,322,689.62856388; 42,008,293.0192652]

Thank you.

Hi @altierl

Welcome to the Orekit forum!

Your 1st approach looks good.
In order to explain the difference, do you know the frame used by the jplephem package?

I ask the question because ECI is a large term denoting Earth Centered Inertial frames. EME2000 is an example, but GCRF is also an ECI. And MOD too. Soo maybe the difference you observe is just a frame difference. Did you tried using GCRF?

Regards
Bryan