Commit e1ebee2b authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Allowed parsing of SP3 files without EOF key.

Fixes #895
parent 07e21e12
Pipeline #2103 passed with stages
in 14 minutes and 54 seconds
......@@ -21,6 +21,9 @@
</properties>
<body>
<release version="11.2" date="TBD" description="TBD">
<action dev="bryan" type="update" issue="895">
Allowed parsing of SP3 files without EOF key.
</action>
<action dev="gc" type="add" issue="790">
Added writing of velocity record in CPF file writers.
</action>
......
......@@ -198,7 +198,14 @@ public class SP3Parser implements EphemerisFileParser<SP3> {
}
}
// we never reached the EOF marker
// Sometimes, the "EOF" key is not available in the file
// If the expected number of entries has been read
// we can suppose that the file has been read properly
if (pi.nbEpochs == pi.file.getNumberOfEpochs()) {
return pi.file;
}
// we never reached the EOF marker or number of epochs doesn't correspond to the expected number
throw new OrekitException(OrekitMessages.SP3_UNEXPECTED_END_OF_FILE, lineNumber);
} catch (IOException ioe) {
......
......@@ -731,6 +731,36 @@ public class SP3ParserTest {
}
@Test
public void testIssue895NoEOF() {
// Test issue 895
final String ex = "/sp3/issue895-no-eof.sp3";
final DataSource source = new DataSource(ex, () -> getClass().getResourceAsStream(ex));
final SP3 file = new SP3Parser().parse(source);
// Verify
Assert.assertEquals(TimeSystem.UTC, file.getTimeSystem());
Assert.assertEquals(SP3.SP3FileType.LEO, file.getType());
Assert.assertEquals(1, file.getSatelliteCount());
final List<SP3Coordinate> coords = file.getSatellites().get("L51").getCoordinates();
Assert.assertEquals(1, coords.size());
final SP3Coordinate coord = coords.get(0);
// 2021 12 26 0 0 0.00000000
Assert.assertEquals(new AbsoluteDate(2021, 12, 26, 0, 0, 0,
TimeScalesFactory.getUTC()), coord.getDate());
// PL51 5029.867893 1304.362160 -11075.527276 999999.999999
// VL51 -17720.521773 -55720.482742 -14441.695083 999999.999999
checkPVEntry(new PVCoordinates(new Vector3D(5029867.893, 1304362.160, -11075527.276),
new Vector3D(-1772.0521773, -5572.0482742, -1444.1695083)),
coord);
}
@Before
public void setUp() {
Utils.setDataRoot("regular-data");
......
#cV2021 12 26 0 0 0.00000000 1 SLR SLR08 FIT COMB
## 2190 0.00000000 120.00000000 59574 0.0000000000000
+ 1 L51 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
%c L cc UTC ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc
%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc
%f 0.0000000 0.000000000 0.00000000000 0.000000000000000
%f 0.0000000 0.000000000 0.00000000000 0.000000000000000
%i 0 0 0 0 0 0 0 0 0
%i 0 0 0 0 0 0 0 0 0
%/* ilrsa.orb.lageos1.220101.v70.sp3 Reference TRF: SLRF2008
%/* Input orbits: ASI v70, ESA v70, GFZ v70, JCET v70,
%/* NSGF v70,
%/* Combination details in README_CC.ilrsa
* 2021 12 26 0 0 0.00000000
PL51 5029.867893 1304.362160 -11075.527276 999999.999999
VL51 -17720.521773 -55720.482742 -14441.695083 999999.999999
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment