StateCovarianceBlender unable to interpolate at the epoch of the first interpolation point

Hello,

I am using Orekit-Jpype version v13.1.4.0, and I have noticed an unexpected behaviour when using the StateCovarianceBlender class in combination with the OrbitHermiteInterpolator class.

Specifically, it seems that, when interpolating at the exact same epoch of the first interpolation point, an error is raised by the StateCovarianceBlender interpolator because of what I think is some numerical noise in the epoch of the start of the allowed interpolation range. The latter does not happen regularly, so it may not be trivial to reproduce.

Below you can find a simplified (not working) version of my code

from java import util

from orekit_jpype import pyhelpers

from org.hipparchus.analysis import polynomials

from org.orekit import frames
from org.orekit import orbits
from org.orekit import propagation
from org.orekit import time


# Set frame
eme2000 = frames.FramesFactory.getEME2000()

# Set blending function
blending_func = polynomials.SmoothStepFactory.getQuadratic()

# Create orbit interpolator
hermite_orbit_interp = orbits.OrbitHermiteInterpolator(2, eme2000)

# Create covariance blender
covariance_blender = propagation.StateCovarianceBlender(
    blending_func,
    hermite_orbit_interp,
    eme2000,
    orbits.OrbitType.CARTESIAN,
    orbits.PositionAngleType.MEAN,
)

# Prepare list of interpolation points
time_stamped_pair_list = util.ArrayList()
for i in range(100):
    # NOTE: `orbit` is an Orbit object while `orekit_cov` is a StateCovariance object
    time_stamped_pair_list.add(time.TimeStampedPair(orbit, orekit_cov))

# Interpolate
# NOTE: `epoch` is a datetime.datetime object 
orekit_epoch = pyhelpers.datetime_to_absolutedate(epoch)
interpolated_pair = covariance_blender.interpolate(
    orekit_epoch, time_stamped_pair_list)

Below you can find the details of the error I have encountered.

Traceback (most recent call last):
  File "AbstractTimeInterpolator.java", line 93, in org.orekit.time.AbstractTimeInterpolator.interpolate
Exception: Java Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "./test.py", line 236, in get_ephemeris
    interpolated_pair = covariance_blender.interpolate(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

org.orekit.errors.org.orekit.errors.TimeStampedCacheException: org.orekit.errors.TimeStampedCacheException: unable to generate new data before 2026-03-04T13:08:27.172000000000000608Z, but data is requested for 2026-03-04T13:08:27.172Z which is 6.08E-16 s before

Epoch 2026-03-04T13:08:27.172Zis exactly the epoch of the first interpolation point passed to the interpolate() method of a StateCovarianceBlender object.

  1. Have you noticed a similar behavior?
  2. Am I using the StateCovarianceBlender class improperly?

Thanks again for all the support, wish you a great day!

Best,
GmM

Hello @gianmario.merisio,

Thank you for bringing up this issue. I’m going to investigate this and see what happens.

Cheers,
Vincent

1 Like

Could you show how your epoch datetime.datetime object are created @gianmario.merisio ? I’m failing to reproduce the issue in both python and java. I believe the issue does not come directly from the interpolator but rather from the dates itself which, as you pointed out, might be slightly noised somewhere.

Hello @Vincent,

I am creating the epochs reading ISO format datetime strings from a JSON file.

If in the next days I find the time I will try to produce some data and a working example. We have added a unit test in our codebase reproducing the error to test if the workaround we implemented is working. I will extract that unit test so that you have the material to reproduce the error.

I will get back to you as soon as possible.

Best,
GmM

1 Like

Hello @Vincent,

I have prepared a working example: test.py (8.8 KB)

While preparing it, I found out I was not able to reproduce the error anymore using the same data. Therefore, I dug more into the matter, starting from your suggestion to look into datetime conversions (great hint by the way, thanks for that :smiley:). I found out some legacy code in our codebase that was doing the conversion from a Python datetime object to an Orekit AbsoluteDate object by directly calling the AbsoluteDate constructor when creating the list of interpolation points. It was exactly there that some numerical noise was introduced in the AbsoluteDate object (see attached picture). Likely, you were already aware of it.

I have modified the legacy code to use the conversion method in the orekit_jpype.pyhelpers module, and now everything works fine.

Summarising, the issue does not come from the interpolator as you pointed out, but rather from an inaccurate datetime conversion.

Thanks for the support, it was very much appreciated!

Best,
GmM

1 Like

Hello @gianmario.merisio ,

It was only a guess but i’m glad it worked out for you. Happy to help :+1: !

Cheers,
Vincent

1 Like