use of org.orekit.files.general.EphemerisFile in project Orekit by CS-SI.
the class OEMWriterTest method testWriteOEM1.
@Test
public void testWriteOEM1() throws OrekitException, IOException {
final String ex = "/ccsds/OEMExample.txt";
final InputStream inEntry = getClass().getResourceAsStream(ex);
final OEMParser parser = new OEMParser().withMu(CelestialBodyFactory.getEarth().getGM()).withConventions(IERSConventions.IERS_2010);
final OEMFile oemFile = parser.parse(inEntry, "OEMExample.txt");
final EphemerisFile ephemerisFile = (EphemerisFile) oemFile;
String originator = oemFile.getOriginator();
String objectName = oemFile.getEphemeridesBlocks().get(0).getMetaData().getObjectName();
String objectID = oemFile.getEphemeridesBlocks().get(0).getMetaData().getObjectID();
String interpolationMethodString = oemFile.getEphemeridesBlocks().get(0).getInterpolationMethod();
InterpolationMethod interpolationMethod = Enum.valueOf(InterpolationMethod.class, interpolationMethodString);
String tempOEMFilePath = tempFolder.newFile("TestWriteOEM1.oem").toString();
OEMWriter writer = new OEMWriter(interpolationMethod, originator, objectID, objectName);
writer.write(tempOEMFilePath, ephemerisFile);
final OEMFile generatedOemFile = parser.parse(tempOEMFilePath);
compareOemFiles(oemFile, generatedOemFile);
}
Aggregations