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 import java.util.List;
22
23 import org.orekit.data.DataSource;
24 import org.orekit.time.TimeScales;
25 import org.orekit.utils.IERSConventions;
26
27 /** Interface for loading Earth Orientation Parameters history.
28 * @author Luc Maisonobe
29 * @since 6.1
30 */
31 public interface EopHistoryLoader {
32
33 /** Load celestial body.
34 * @param converter converter to use for nutation corrections
35 * @param history history to fill up
36 */
37 void fillHistory(IERSConventions.NutationCorrectionConverter converter,
38 Collection<EOPEntry> history);
39
40 /**
41 * Interface for parsing EOP data files.
42 *
43 * @author Evan Ward
44 * @since 10.1
45 */
46 interface Parser {
47
48 /** Parse EOP from the given source.
49 * @param source source of the EOP data
50 * @return parsed EOP entries.
51 * @exception IOException if {@code input} throws one during parsing.
52 */
53 List<EOPEntry> parse(DataSource source) throws IOException;
54
55 /**
56 * Create a new parser for EOP data in the rapid and predicted XML format.
57 *
58 * <p>The XML EOP files are recognized thanks to their base names, which
59 * match one of the the patterns <code>finals.2000A.*.xml</code> or
60 * <code>finals.*.xml</code> where * stands for a word like "all", "daily", or
61 * "data".
62 *
63 * @param conventions used to convert between equinox-based and
64 * non-rotating-origin-based paradigms.
65 * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
66 * @param timeScales used to parse the EOP data.
67 * @return a new parser.
68 */
69 static Parser newFinalsXmlParser(
70 final IERSConventions conventions,
71 final ItrfVersionProvider itrfVersionProvider,
72 final TimeScales timeScales) {
73 return new EopXmlLoader.Parser(
74 conventions.getNutationCorrectionConverter(timeScales),
75 itrfVersionProvider,
76 timeScales.getUTC());
77 }
78
79 /**
80 * Create a new parser for EOP data in the rapid and predicted columnar format.
81 *
82 * <p>The rapid data and prediction file is recognized thanks to its base name,
83 * which match one of the the patterns <code>finals.*</code> or
84 * <code>finals2000A.*</code> where * stands for a word like "all", "daily", or
85 * "data". The file with 2000A in their name correspond to the IAU-2000
86 * precession-nutation model whereas the files without any identifier correspond
87 * to the IAU-1980 precession-nutation model. The files with the all suffix start
88 * from 1973-01-01, and the files with the data suffix start from 1992-01-01.
89 *
90 * @param conventions used to convert between equinox-based and
91 * non-rotating-origin-based paradigms.
92 * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
93 * @param timeScales used to parse the EOP data.
94 * @param isNonRotatingOrigin if true the supported files <em>must</em> contain
95 * δX/δY nutation corrections, otherwise they
96 * <em>must</em> contain δΔψ/δΔε nutation
97 * corrections
98 * @return a new parser.
99 */
100 static Parser newFinalsColumnsParser(
101 final IERSConventions conventions,
102 final ItrfVersionProvider itrfVersionProvider,
103 final TimeScales timeScales,
104 final boolean isNonRotatingOrigin) {
105 return new RapidDataAndPredictionColumnsLoader.Parser(
106 conventions.getNutationCorrectionConverter(timeScales),
107 itrfVersionProvider,
108 timeScales.getUTC(),
109 isNonRotatingOrigin);
110 }
111
112 /**
113 * Create a new parser for EOP data in the EOP C04 format.
114 *
115 * <p>The EOP xx C04 files are recognized thanks to their base names, which
116 * match one of the patterns {@code eopc04_##_IAU2000.##} or {@code eopc04_##.##}
117 * where # stands for a digit character.
118 *
119 * @param conventions used to convert between equinox-based and
120 * non-rotating-origin-based paradigms.
121 * @param timeScales used to parse the EOP data.
122 * @return a new parser.
123 */
124 static Parser newEopC04Parser(
125 final IERSConventions conventions,
126 final TimeScales timeScales) {
127 return new EopC04FilesLoader.Parser(conventions.getNutationCorrectionConverter(timeScales),
128 timeScales.getUTC());
129 }
130
131 /**
132 * Create a new parser for EOP data in the Bulletin A format.
133 *
134 * @param conventions used to convert between equinox-based and
135 * non-rotating-origin-based paradigms.
136 * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
137 * @param timeScales used to parse the EOP data.
138 * @return a new parser.
139 * @since 14.0
140 */
141 static Parser newBulletinAParser(
142 final IERSConventions conventions,
143 final ItrfVersionProvider itrfVersionProvider,
144 final TimeScales timeScales) {
145 return new BulletinAFilesLoader.Parser(conventions.getNutationCorrectionConverter(timeScales),
146 itrfVersionProvider,
147 timeScales.getUTC());
148 }
149
150 /**
151 * Create a new parser for EOP data in the Bulletin B format.
152 *
153 * @param conventions used to convert between equinox-based and
154 * non-rotating-origin-based paradigms.
155 * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
156 * @param timeScales used to parse the EOP data.
157 * @return a new parser.
158 */
159 static Parser newBulletinBParser(
160 final IERSConventions conventions,
161 final ItrfVersionProvider itrfVersionProvider,
162 final TimeScales timeScales) {
163 return new BulletinBFilesLoader.Parser(
164 conventions.getNutationCorrectionConverter(timeScales),
165 itrfVersionProvider,
166 timeScales.getUTC());
167 }
168
169 }
170
171 }