Skip to content
Snippets Groups Projects
Commit fc59a3ec authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Fixed parsing of clock values in SP3 files.

parent 4309ae13
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,9 @@
</properties>
<body>
<release version="11.0" date="TBD" description="TBD">
<action dev="bryan" type="fix" issue="803">
Fixed parsing of clock values in SP3 files.
</action>
<action dev="bryan" type="fix" issue="820">
TLE Jacobians are now calculated in cartesian elements.
</action>
......
......@@ -59,6 +59,9 @@ import org.orekit.utils.IERSConventions;
*/
public class SP3Parser implements EphemerisFileParser<SP3> {
/** Bad or absent clock values are to be set to 999999.999999. */
public static final double DEFAULT_CLOCK_VALUE = 999999.999999;
/** Spaces delimiters. */
private static final String SPACES = "\\s+";
......@@ -574,8 +577,9 @@ public class SP3Parser implements EphemerisFileParser<SP3> {
pi.latestPosition = new Vector3D(x * 1000, y * 1000, z * 1000);
// clock (microsec)
pi.latestClock =
Double.parseDouble(line.substring(46, 60).trim()) * 1e-6;
pi.latestClock = line.length() <= 46 ?
DEFAULT_CLOCK_VALUE :
Double.parseDouble(line.substring(46, 60).trim()) * 1e-6;
// the additional items are optional and not read yet
......@@ -657,8 +661,9 @@ public class SP3Parser implements EphemerisFileParser<SP3> {
final Vector3D velocity = new Vector3D(xv / 10d, yv / 10d, zv / 10d);
// clock rate in file is 1e-4 us / s
final double clockRateChange =
Double.parseDouble(line.substring(46, 60).trim()) * 1e-4;
final double clockRateChange = line.length() <= 46 ?
DEFAULT_CLOCK_VALUE :
Double.parseDouble(line.substring(46, 60).trim()) * 1e-4;
// the additional items are optional and not read yet
......
......@@ -481,6 +481,31 @@ public class SP3ParserTest {
}
@Test
public void testIssue803() {
// Test issue 803 (see https://gitlab.orekit.org/orekit/orekit/-/issues/803)
final String ex = "/sp3/truncated-nsgf.orb.lageos2.160305.v35.sp3";
final DataSource source = new DataSource(ex, () -> getClass().getResourceAsStream(ex));
final SP3 file = new SP3Parser().parse(source);
// Coordinates
final List<SP3Coordinate> coords = file.getSatellites().get("L52").getCoordinates();
Assert.assertEquals(1, coords.size());
final SP3Coordinate coord = coords.get(0);
// Verify
// PL52 2228.470946 7268.265924 9581.471543
// VL52 -44856.945000 24321.151000 -7116.222800
checkPVEntry(new PVCoordinates(new Vector3D(2228470.946, 7268265.924, 9581471.543),
new Vector3D(-4485.6945000, 2432.1151000, -711.6222800)),
coord);
Assert.assertEquals(999999.999999, coord.getClockCorrection(), 1.0e-6);
Assert.assertEquals(999999.999999, coord.getClockRateChange(), 1.0e-6);
}
@Before
public void setUp() {
Utils.setDataRoot("regular-data");
......
#cV2016 2 28 0 0 0.00000000 1 SLR ECF FIT NSGF
## 1886 0.00000000 120.00000000 57446 0.0000000000000
+ 1 L52 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
/*
/* Earth-centered-fixed orbital product from SGF ILRS AC
/* The underlying ECF frame is that of IERS/ITRF
/*
* 2016 2 28 0 0 0.00000000
PL52 2228.470946 7268.265924 9581.471543
VL52 -44856.945000 24321.151000 -7116.222800
EOF
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment