1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.frames;
18
19 import org.junit.jupiter.api.Assertions;
20 import org.junit.jupiter.api.Test;
21 import org.orekit.data.AbstractFilesLoaderTest;
22 import org.orekit.time.AbsoluteDate;
23 import org.orekit.time.ChronologicalComparator;
24 import org.orekit.time.TimeScalesFactory;
25 import org.orekit.utils.Constants;
26 import org.orekit.utils.IERSConventions;
27
28 import java.util.SortedSet;
29 import java.util.TreeSet;
30
31
32 public class EopC04FilesLoaderTest extends AbstractFilesLoaderTest {
33
34 @Test
35 public void testMissingMonths() {
36 setRoot("missing-months");
37 IERSConventions.NutationCorrectionConverter converter =
38 IERSConventions.IERS_2010.getNutationCorrectionConverter();
39 SortedSet<EOPEntry> history = new TreeSet<EOPEntry>(new ChronologicalComparator());
40 new EopC04FilesLoader(FramesFactory.EOPC04_2000_FILENAME, manager, () -> utc).fillHistory(converter, history);
41 Assertions.assertTrue(getMaxGap(history) > 5);
42 }
43
44 @Test
45 public void testStartDate() {
46 setRoot("regular-data");
47 IERSConventions.NutationCorrectionConverter converter =
48 IERSConventions.IERS_2010.getNutationCorrectionConverter();
49 SortedSet<EOPEntry> history = new TreeSet<EOPEntry>(new ChronologicalComparator());
50 new EopC04FilesLoader(FramesFactory.EOPC04_2000_FILENAME, manager, () -> utc).fillHistory(converter, history);
51 Assertions.assertEquals(new AbsoluteDate(2003, 1, 1, TimeScalesFactory.getUTC()),
52 new EOPHistory(IERSConventions.IERS_2010, EOPHistory.DEFAULT_INTERPOLATION_DEGREE,
53 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 Assertions.assertEquals(new AbsoluteDate(2005, 12, 31, TimeScalesFactory.getUTC()),
64 new EOPHistory(IERSConventions.IERS_2010, EOPHistory.DEFAULT_INTERPOLATION_DEGREE,
65 history, true).getEndDate());
66 }
67
68 @Test
69 public void testContent() {
70 setRoot("regular-data");
71 IERSConventions.NutationCorrectionConverter converter =
72 IERSConventions.IERS_2010.getNutationCorrectionConverter();
73 SortedSet<EOPEntry> data = new TreeSet<EOPEntry>(new ChronologicalComparator());
74 new EopC04FilesLoader(FramesFactory.EOPC04_2000_FILENAME, manager, () -> utc).fillHistory(converter, data);
75 EOPHistory history = new EOPHistory(IERSConventions.IERS_2010, EOPHistory.DEFAULT_INTERPOLATION_DEGREE,
76 data, true);
77 Assertions.assertEquals(IERSConventions.IERS_2010, history.getConventions());
78 AbsoluteDate date = new AbsoluteDate(2003, 1, 7, 12, 0, 0, TimeScalesFactory.getUTC());
79 Assertions.assertEquals( (9 * ( 0.0007777 + 0.0008565) - ( 0.0005883 + 0.0008758)) / 16, history.getLOD(date), 1.0e-10);
80 Assertions.assertEquals( (9 * (-0.2920264 + -0.2928461) - (-0.2913281 + -0.2937305)) / 16, history.getUT1MinusUTC(date), 1.0e-10);
81 Assertions.assertEquals(asToRad((9 * (-0.105933 + -0.108553) - (-0.103513 + -0.111054)) / 16), history.getPoleCorrection(date).getXp(), 2.5e-12);
82 Assertions.assertEquals(asToRad((9 * ( 0.201451 + 0.203596) - ( 0.199545 + 0.205660)) / 16), history.getPoleCorrection(date).getYp(), 8.3e-11);
83 Assertions.assertEquals(ITRFVersion.ITRF_2008, history.getITRFVersion(date));
84 }
85
86 @Test
87 public void testMixedItrf() {
88 setRoot("eopc04");
89 IERSConventions.NutationCorrectionConverter converter =
90 IERSConventions.IERS_2010.getNutationCorrectionConverter();
91 SortedSet<EOPEntry> data = new TreeSet<EOPEntry>(new ChronologicalComparator());
92 new EopC04FilesLoader(FramesFactory.EOPC04_2000_FILENAME, manager, () -> utc).fillHistory(converter, data);
93 EOPHistory history = new EOPHistory(IERSConventions.IERS_2010, EOPHistory.DEFAULT_INTERPOLATION_DEGREE,
94 data, true);
95 Assertions.assertEquals(IERSConventions.IERS_2010, history.getConventions());
96
97
98 AbsoluteDate date2011 = new AbsoluteDate(2011, 1, 9, 12, 0, 0, TimeScalesFactory.getUTC());
99 Assertions.assertEquals( (9 * ( 0.0005774 + 0.0005865) - ( 0.0005456 + 0.0005776)) / 16, history.getLOD(date2011), 1.0e-10);
100 Assertions.assertEquals( (9 * (-0.1431393 + -0.1437380) - (-0.1425794 + -0.1443274)) / 16, history.getUT1MinusUTC(date2011), 1.0e-10);
101 Assertions.assertEquals(asToRad((9 * ( 0.103097 + 0.101098) - ( 0.106313 + 0.099966)) / 16), history.getPoleCorrection(date2011).getXp(), 2.9e-11);
102 Assertions.assertEquals(asToRad((9 * ( 0.197749 + 0.196801) - ( 0.198821 + 0.196146)) / 16), history.getPoleCorrection(date2011).getYp(), 9.0e-12);
103 Assertions.assertEquals(ITRFVersion.ITRF_2005, history.getITRFVersion(date2011));
104
105
106 AbsoluteDate date2012 = new AbsoluteDate(2012, 1, 9, 12, 0, 0, TimeScalesFactory.getUTC());
107 Assertions.assertEquals( (9 * ( 0.0009020 + 0.0009794) - ( 0.0007866 + 0.0011310)) / 16, history.getLOD(date2012), 1.0e-10);
108 Assertions.assertEquals( (9 * (-0.4263648 + -0.4272859) - (-0.4255338 + -0.4283517)) / 16, history.getUT1MinusUTC(date2012), 1.0e-10);
109 Assertions.assertEquals(asToRad((9 * ( 0.104225 + 0.101787) - ( 0.106429 + 0.099783)) / 16), history.getPoleCorrection(date2012).getXp(), 5.2e-11);
110 Assertions.assertEquals(asToRad((9 * ( 0.258041 + 0.257252) - ( 0.258874 + 0.256002)) / 16), history.getPoleCorrection(date2012).getYp(), 1.4e-10);
111 Assertions.assertEquals(ITRFVersion.ITRF_2008, history.getITRFVersion(date2012));
112
113
114 AbsoluteDate date2013 = new AbsoluteDate(2013, 1, 9, 12, 0, 0, TimeScalesFactory.getUTC());
115 Assertions.assertEquals( (9 * (0.0008315 + 0.0008859) - (0.0008888 + 0.0010276)) / 16, history.getLOD(date2013), 1.0e-10);
116 Assertions.assertEquals( (9 * (0.2686090 + 0.2677610) - (0.2694696 + 0.2668054)) / 16, history.getUT1MinusUTC(date2013), 1.0e-10);
117 Assertions.assertEquals(asToRad((9 * (0.065348 + 0.064418) - (0.066251 + 0.063242)) / 16), history.getPoleCorrection(date2013).getXp(), 4.0e-11);
118 Assertions.assertEquals(asToRad((9 * (0.291376 + 0.292248) - (0.290552 + 0.293086)) / 16), history.getPoleCorrection(date2013).getYp(), 2.3e-11);
119 Assertions.assertEquals(ITRFVersion.ITRF_2014, history.getITRFVersion(date2013));
120
121
122 AbsoluteDate date2014 = new AbsoluteDate(2014, 1, 9, 12, 0, 0, TimeScalesFactory.getUTC());
123 Assertions.assertEquals( (9 * ( 0.0009514 + 0.0008041) - ( 0.0011181 + 0.0006787)) / 16, history.getLOD(date2014), 1.0e-10);
124 Assertions.assertEquals( (9 * (-0.1072271 + -0.1081017) - (-0.1061938 + -0.1088416)) / 16, history.getUT1MinusUTC(date2014), 1.0e-10);
125 Assertions.assertEquals(asToRad((9 * ( 0.033902 + 0.033520) - ( 0.034347 + 0.032766)) / 16), history.getPoleCorrection(date2014).getXp(), 5.4e-11);
126 Assertions.assertEquals(asToRad((9 * ( 0.325031 + 0.326443) - ( 0.323939 + 0.327836)) / 16), history.getPoleCorrection(date2014).getYp(), 8.0e-12);
127 Assertions.assertEquals(ITRFVersion.ITRF_2020, history.getITRFVersion(date2014));
128
129
130 AbsoluteDate date2015 = new AbsoluteDate(2015, 1, 10, 0, 0, 0, TimeScalesFactory.getUTC());
131 Assertions.assertEquals( (9 * ( 0.0010180 + 0.0010925) - ( 0.0009043 + 0.0011262)) / 16, history.getLOD(date2015), 1.0e-10);
132 Assertions.assertEquals( (9 * (-0.4665177 + -0.4675780) - (-0.4655555 + -0.4686919)) / 16, history.getUT1MinusUTC(date2015), 1.0e-10);
133 Assertions.assertEquals(asToRad((9 * ( 0.024041 + 0.023048) - ( 0.025192 + 0.022026)) / 16), history.getPoleCorrection(date2015).getXp(), 6.5e-11);
134 Assertions.assertEquals(asToRad((9 * ( 0.286304 + 0.287241) - ( 0.285811 + 0.288345)) / 16), history.getPoleCorrection(date2015).getYp(), 2.2e-10);
135 Assertions.assertEquals(ITRFVersion.ITRF_2020, history.getITRFVersion(date2015));
136
137 }
138
139 private double asToRad(double as) {
140 return as * Constants.ARC_SECONDS_TO_RADIANS;
141 }
142
143 }