CPF parser ignores direction flag - causing an exception later

Hello all!

I saw an exception for CPF objects on the moon.

The main cause is, that the CPF parser object (org.orekit.files.ilrs.CPFParser:470) ignores the direction flag for positions - lines starting with 10. This direction flag is also ignored for other line types, but this is not a problem here.

The farther-away objects are generated with inbound and outbound position vectors (10 1 and 10 2 lines with the same time but other direction) - see pages 6, 13, 15 in the CPF specification: https://ilrs.gsfc.nasa.gov/docs/2018/cpf_2.00h-1.pdf
On https://edc.dgfi.tum.de/pub/slr/cpf_predicts_v2/current are apollo11, apollo 15 luna17 and luna21 the affected objects.

Because of two positional entries existing with the same time an exception is generated when trying to acquire the object location:

Exception in thread "main" org.hipparchus.exception.MathIllegalArgumentException: duplicated abscissa 0 causes division by zero
	at org.hipparchus.analysis.interpolation.HermiteInterpolator.addSamplePoint(HermiteInterpolator.java:113)
	at org.orekit.utils.TimeStampedPVCoordinatesHermiteInterpolator.lambda$interpolate$0(TimeStampedPVCoordinatesHermiteInterpolator.java:148)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
	at org.orekit.utils.TimeStampedPVCoordinatesHermiteInterpolator.interpolate(TimeStampedPVCoordinatesHermiteInterpolator.java:146)
	at org.orekit.utils.TimeStampedPVCoordinatesHermiteInterpolator.interpolate(TimeStampedPVCoordinatesHermiteInterpolator.java:39)
	at org.orekit.time.AbstractTimeInterpolator.interpolate(AbstractTimeInterpolator.java:91)
	at org.orekit.files.general.EphemerisSegmentPropagator.getPVCoordinates(EphemerisSegmentPropagator.java:115)

The example program causing this exception with an ephemeris of the above mentioned objects:

CPF cpfFile = new CPFParser().parse(new DataSource(...));
for (CPFEphemeris ephemerisEntry : cpfFile.getSatellites().values()) {
   ephemerisEntry.getPropagator().getPVCoordinates(ephemerisEntry.getStart(), FramesFactory.getITRF(IERSConventions.IERS_2010, true));
}

For me, modifying the CPF and removing all 10 2 lines prevents the exception, but there maybe should be a solution implemented directly in Orekit?
Probably i overlooked other problems with my workaround? Light time correction comes to my mind here.

Thank you for your feedback.
Mario

Hi @M-V

It looks like an issue. Could you open an issue on the gitlab repository?

Thank you,
Bryan

Hi again,
i opened a ticket (#1298).
If i can help/test, please reply.
Thank you very much!