Search in sources :

Example 6 with EphemerisFile

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);
}
Also used : InterpolationMethod(org.orekit.files.ccsds.OEMWriter.InterpolationMethod) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) EphemerisFile(org.orekit.files.general.EphemerisFile) Test(org.junit.Test)

Aggregations

EphemerisFile (org.orekit.files.general.EphemerisFile)6 Test (org.junit.Test)5 FileInputStream (java.io.FileInputStream)4 InputStream (java.io.InputStream)4 OrekitIllegalArgumentException (org.orekit.errors.OrekitIllegalArgumentException)4 InterpolationMethod (org.orekit.files.ccsds.OEMWriter.InterpolationMethod)3 LinkedHashMap (java.util.LinkedHashMap)1 Segment (org.orekit.files.ccsds.StreamingOemWriter.Segment)1 EphemerisSegment (org.orekit.files.general.EphemerisFile.EphemerisSegment)1 TimeScale (org.orekit.time.TimeScale)1 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)1