1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.frames;
18
19
20 import java.util.SortedSet;
21 import java.util.TreeSet;
22
23 import org.junit.Assert;
24 import org.junit.Test;
25 import org.orekit.data.AbstractFilesLoaderTest;
26 import org.orekit.time.AbsoluteDate;
27 import org.orekit.time.ChronologicalComparator;
28 import org.orekit.time.TimeScalesFactory;
29 import org.orekit.utils.Constants;
30 import org.orekit.utils.IERSConventions;
31
32
33 public class EOPC04FilesLoaderTest extends AbstractFilesLoaderTest {
34
35 @Test
36 public void testMissingMonths() {
37 setRoot("missing-months");
38 IERSConventions.NutationCorrectionConverter converter =
39 IERSConventions.IERS_2010.getNutationCorrectionConverter();
40 SortedSet<EOPEntry> history = new TreeSet<EOPEntry>(new ChronologicalComparator());
41 new EOPC04FilesLoader(FramesFactory.EOPC04_2000_FILENAME, manager, () -> utc).fillHistory(converter, history);
42 Assert.assertTrue(getMaxGap(history) > 5);
43 }
44
45 @Test
46 public void testStartDate() {
47 setRoot("regular-data");
48 IERSConventions.NutationCorrectionConverter converter =
49 IERSConventions.IERS_2010.getNutationCorrectionConverter();
50 SortedSet<EOPEntry> history = new TreeSet<EOPEntry>(new ChronologicalComparator());
51 new EOPC04FilesLoader(FramesFactory.EOPC04_2000_FILENAME, manager, () -> utc).fillHistory(converter, history);
52 Assert.assertEquals(new AbsoluteDate(2003, 1, 1, TimeScalesFactory.getUTC()),
53 new EOPHistory(IERSConventions.IERS_2010, history, true).getStartDate());
54 }
55
56 @Test
57 public void testEndDate() {
58 setRoot("regular-data");
59 IERSConventions.NutationCorrectionConverter converter =
60 IERSConventions.IERS_2010.getNutationCorrectionConverter();
61 SortedSet<EOPEntry> history = new TreeSet<EOPEntry>(new ChronologicalComparator());
62 new EOPC04FilesLoader(FramesFactory.EOPC04_2000_FILENAME, manager, () -> utc).fillHistory(converter, history);
63 Assert.assertEquals(new AbsoluteDate(2005, 12, 31, TimeScalesFactory.getUTC()),
64 new EOPHistory(IERSConventions.IERS_2010, history, true).getEndDate());
65 }
66
67 @Test
68 public void testContent() {
69 setRoot("regular-data");
70 IERSConventions.NutationCorrectionConverter converter =
71 IERSConventions.IERS_2010.getNutationCorrectionConverter();
72 SortedSet<EOPEntry> data = new TreeSet<EOPEntry>(new ChronologicalComparator());
73 new EOPC04FilesLoader(FramesFactory.EOPC04_2000_FILENAME, manager, () -> utc).fillHistory(converter, data);
74 EOPHistory history = new EOPHistory(IERSConventions.IERS_2010, data, true);
75 AbsoluteDate date = new AbsoluteDate(2003, 1, 7, 12, 0, 0, TimeScalesFactory.getUTC());
76 Assert.assertEquals( (9 * ( 0.0007777 + 0.0008565) - ( 0.0005883 + 0.0008758)) / 16, history.getLOD(date), 1.0e-10);
77 Assert.assertEquals( (9 * (-0.2920264 + -0.2928461) - (-0.2913281 + -0.2937305)) / 16, history.getUT1MinusUTC(date), 1.0e-10);
78 Assert.assertEquals(asToRad((9 * (-0.105933 + -0.108553) - (-0.103513 + -0.111054)) / 16), history.getPoleCorrection(date).getXp(), 1.0e-10);
79 Assert.assertEquals(asToRad((9 * ( 0.201451 + 0.203596) - ( 0.199545 + 0.205660)) / 16), history.getPoleCorrection(date).getYp(), 1.0e-10);
80 Assert.assertEquals(ITRFVersion.ITRF_2008, history.getITRFVersion(date));
81 }
82
83 private double asToRad(double as) {
84 return as * Constants.ARC_SECONDS_TO_RADIANS;
85 }
86
87 }