1 /* Copyright 2002-2026 CS GROUP
2 * Licensed to CS GROUP (CS) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * CS licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.orekit.frames;
18
19 import java.io.IOException;
20 import java.util.Collection;
21
22 import org.orekit.data.DataSource;
23 import org.orekit.time.TimeScales;
24 import org.orekit.utils.IERSConventions;
25
26 /** Interface for loading Earth Orientation Parameters history.
27 * @author Luc Maisonobe
28 * @since 6.1
29 */
30 public interface EopHistoryLoader {
31
32 /** Load celestial body.
33 * @param converter converter to use for nutation corrections
34 * @param history history to fill up
35 */
36 void fillHistory(IERSConventions.NutationCorrectionConverter converter,
37 Collection<EOPEntry> history);
38
39 /**
40 * Interface for parsing EOP data files.
41 *
42 * @author Evan Ward
43 * @since 10.1
44 */
45 interface Parser {
46
47 /** Parse EOP from the given source.
48 * @param source source of the EOP data
49 * @return parsed EOP entries.
50 * @exception IOException if {@code input} throws one during parsing.
51 */
52 Collection<EOPEntry> parse(DataSource source) throws IOException;
53
54 /**
55 * Create a new parser for EOP data in the rapid and predicted XML format.
56 *
57 * <p>The XML EOP files are recognized thanks to their base names, which
58 * match one of the the patterns <code>finals.2000A.*.xml</code> or
59 * <code>finals.*.xml</code> where * stands for a word like "all", "daily", or
60 * "data".
61 *
62 * @param conventions used to convert between equinox-based and
63 * non-rotating-origin-based paradigms.
64 * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
65 * @param timeScales used to parse the EOP data.
66 * @return a new parser.
67 */
68 static Parser newFinalsXmlParser(
69 final IERSConventions conventions,
70 final ItrfVersionProvider itrfVersionProvider,
71 final TimeScales timeScales) {
72 return new EopXmlLoader.Parser(
73 conventions.getNutationCorrectionConverter(timeScales),
74 itrfVersionProvider,
75 timeScales.getUTC());
76 }
77
78 /**
79 * Create a new parser for EOP data in the rapid and predicted columnar format.
80 *
81 * <p>The rapid data and prediction file is recognized thanks to its base name,
82 * which match one of the the patterns <code>finals.*</code> or
83 * <code>finals2000A.*</code> where * stands for a word like "all", "daily", or
84 * "data". The file with 2000A in their name correspond to the IAU-2000
85 * precession-nutation model whereas the files without any identifier correspond
86 * to the IAU-1980 precession-nutation model. The files with the all suffix start
87 * from 1973-01-01, and the files with the data suffix start from 1992-01-01.
88 *
89 * @param conventions used to convert between equinox-based and
90 * non-rotating-origin-based paradigms.
91 * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
92 * @param timeScales used to parse the EOP data.
93 * @param isNonRotatingOrigin if true the supported files <em>must</em> contain
94 * δX/δY nutation corrections, otherwise they
95 * <em>must</em> contain δΔψ/δΔε nutation
96 * corrections
97 * @return a new parser.
98 */
99 static Parser newFinalsColumnsParser(
100 final IERSConventions conventions,
101 final ItrfVersionProvider itrfVersionProvider,
102 final TimeScales timeScales,
103 final boolean isNonRotatingOrigin) {
104 return new RapidDataAndPredictionColumnsLoader.Parser(
105 conventions.getNutationCorrectionConverter(timeScales),
106 itrfVersionProvider,
107 timeScales.getUTC(),
108 isNonRotatingOrigin);
109 }
110
111 /**
112 * Create a new parser for EOP data in the EOP C04 format.
113 *
114 * <p>The EOP xx C04 files are recognized thanks to their base names, which
115 * match one of the patterns {@code eopc04_##_IAU2000.##} or {@code eopc04_##.##}
116 * where # stands for a digit character.
117 *
118 * @param conventions used to convert between equinox-based and
119 * non-rotating-origin-based paradigms.
120 * @param timeScales used to parse the EOP data.
121 * @return a new parser.
122 */
123 static Parser newEopC04Parser(
124 final IERSConventions conventions,
125 final TimeScales timeScales) {
126 return new EopC04FilesLoader.Parser(conventions.getNutationCorrectionConverter(timeScales),
127 timeScales.getUTC());
128 }
129
130 /**
131 * Create a new parser for EOP data in the Bulletin A format.
132 *
133 * @param conventions used to convert between equinox-based and
134 * non-rotating-origin-based paradigms.
135 * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
136 * @param timeScales used to parse the EOP data.
137 * @return a new parser.
138 * @since 14.0
139 */
140 static Parser newBulletinAParser(
141 final IERSConventions conventions,
142 final ItrfVersionProvider itrfVersionProvider,
143 final TimeScales timeScales) {
144 return new BulletinAFilesLoader.Parser(conventions.getNutationCorrectionConverter(timeScales),
145 itrfVersionProvider,
146 timeScales.getUTC());
147 }
148
149 /**
150 * Create a new parser for EOP data in the Bulletin B format.
151 *
152 * @param conventions used to convert between equinox-based and
153 * non-rotating-origin-based paradigms.
154 * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
155 * @param timeScales used to parse the EOP data.
156 * @return a new parser.
157 */
158 static Parser newBulletinBParser(
159 final IERSConventions conventions,
160 final ItrfVersionProvider itrfVersionProvider,
161 final TimeScales timeScales) {
162 return new BulletinBFilesLoader.Parser(
163 conventions.getNutationCorrectionConverter(timeScales),
164 itrfVersionProvider,
165 timeScales.getUTC());
166 }
167
168 }
169
170 }