1 /* Contributed in the public domain.
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 org.orekit.bodies.CelestialBodies;
20 import org.orekit.time.TimeScales;
21 import org.orekit.utils.IERSConventions;
22
23 /**
24 * This class lazily loads auxiliary data when it is needed by a requested frame. It is
25 * designed to match the behavior of {@link FramesFactory} in Orekit 10.0.
26 *
27 * @author Guylaine Prat
28 * @author Luc Maisonobe
29 * @author Pascal Parraud
30 * @author Evan Ward
31 * @see LazyLoadedEop
32 * @since 10.1
33 */
34 public class LazyLoadedFrames extends AbstractFrames {
35
36 /** Delegate for all EOP loading. */
37 private final LazyLoadedEop lazyLoadedEop;
38
39 /**
40 * Create a collection of frames from the given auxiliary data.
41 *
42 * @param lazyLoadedEop loads Earth Orientation Parameters.
43 * @param timeScales defines the time scales used when computing frame
44 * transformations. For example, the TT time scale needed for
45 * {@link #getPZ9011(IERSConventions, boolean)}.
46 * @param celestialBodies defines the celestial bodies which, for example, are used in
47 * {@link #getICRF()}.
48 */
49 public LazyLoadedFrames(final LazyLoadedEop lazyLoadedEop,
50 final TimeScales timeScales,
51 final CelestialBodies celestialBodies) {
52 super(timeScales, () -> celestialBodies.getSolarSystemBarycenter()
53 .getInertiallyOrientedFrame());
54 this.lazyLoadedEop = lazyLoadedEop;
55 }
56
57 /** Add the default loaders EOP history (IAU 1980 precession/nutation).
58 * <p>
59 * The default loaders look for IERS EOP C04 and bulletins B files. They
60 * correspond to {@link IERSConventions#IERS_1996 IERS 1996} conventions.
61 * </p>
62 * @param rapidDataColumnsSupportedNames regular expression for supported
63 * rapid data columns EOP files names
64 * (may be null if the default IERS file names are used)
65 * @param xmlSupportedNames regular expression for supported XML EOP files names
66 * (may be null if the default IERS file names are used)
67 * @param eopC04SupportedNames regular expression for supported EOP C04 files names
68 * (may be null if the default IERS file names are used)
69 * @param bulletinBSupportedNames regular expression for supported bulletin B files names
70 * (may be null if the default IERS file names are used)
71 * @param bulletinASupportedNames regular expression for supported bulletin A files names
72 * (may be null if the default IERS file names are used)
73 * @param csvSupportedNames regular expression for supported csv files names
74 * (may be null if the default IERS file names are used)
75 * @see <a href="https://datacenter.iers.org/products/eop/">IERS https data download</a>
76 * @see #addEOPHistoryLoader(IERSConventions, EopHistoryLoader)
77 * @see #clearEOPHistoryLoaders()
78 * @see #addDefaultEOP2000HistoryLoaders(String, String, String, String, String, String)
79 * @since 12.0
80 */
81 public void addDefaultEOP1980HistoryLoaders(final String rapidDataColumnsSupportedNames,
82 final String xmlSupportedNames,
83 final String eopC04SupportedNames,
84 final String bulletinBSupportedNames,
85 final String bulletinASupportedNames,
86 final String csvSupportedNames) {
87 lazyLoadedEop.addDefaultEOP1980HistoryLoaders(
88 rapidDataColumnsSupportedNames,
89 xmlSupportedNames,
90 eopC04SupportedNames,
91 bulletinBSupportedNames,
92 bulletinASupportedNames,
93 csvSupportedNames,
94 () -> getTimeScales().getUTC());
95 }
96
97 /** Add the default loaders for EOP history (IAU 2000/2006 precession/nutation).
98 * <p>
99 * The default loaders look for IERS EOP C04 and bulletins B files. They
100 * correspond to both {@link IERSConventions#IERS_2003 IERS 2003} and {@link
101 * IERSConventions#IERS_2010 IERS 2010} conventions.
102 * </p>
103 * @param rapidDataColumnsSupportedNames regular expression for supported
104 * rapid data columns EOP files names
105 * (may be null if the default IERS file names are used)
106 * @param xmlSupportedNames regular expression for supported XML EOP files names
107 * (may be null if the default IERS file names are used)
108 * @param eopC04SupportedNames regular expression for supported EOP C04 files names
109 * (may be null if the default IERS file names are used)
110 * @param bulletinBSupportedNames regular expression for supported bulletin B files names
111 * (may be null if the default IERS file names are used)
112 * @param bulletinASupportedNames regular expression for supported bulletin A files names
113 * (may be null if the default IERS file names are used)
114 * @param csvSupportedNames regular expression for supported csv files names
115 * (may be null if the default IERS file names are used)
116 * @see <a href="https://datacenter.iers.org/products/eop/">IERS https data download</a>
117 * @see #addEOPHistoryLoader(IERSConventions, EopHistoryLoader)
118 * @see #clearEOPHistoryLoaders()
119 * @see #addDefaultEOP1980HistoryLoaders(String, String, String, String, String, String)
120 * @since 12.0
121 */
122 public void addDefaultEOP2000HistoryLoaders(final String rapidDataColumnsSupportedNames,
123 final String xmlSupportedNames,
124 final String eopC04SupportedNames,
125 final String bulletinBSupportedNames,
126 final String bulletinASupportedNames,
127 final String csvSupportedNames) {
128 lazyLoadedEop.addDefaultEOP2000HistoryLoaders(
129 rapidDataColumnsSupportedNames,
130 xmlSupportedNames,
131 eopC04SupportedNames,
132 bulletinBSupportedNames,
133 bulletinASupportedNames,
134 csvSupportedNames,
135 () -> getTimeScales().getUTC());
136 }
137
138 /** Add a loader for Earth Orientation Parameters history.
139 * @param conventions IERS conventions to which EOP history applies
140 * @param loader custom loader to add for the EOP history
141 * @see #addDefaultEOP1980HistoryLoaders(String, String, String, String, String, String)
142 * @see #clearEOPHistoryLoaders()
143 */
144 public void addEOPHistoryLoader(final IERSConventions conventions, final EopHistoryLoader loader) {
145 lazyLoadedEop.addEOPHistoryLoader(conventions, loader);
146 }
147
148 /** Clear loaders for Earth Orientation Parameters history.
149 * @see #addEOPHistoryLoader(IERSConventions, EopHistoryLoader)
150 * @see #addDefaultEOP1980HistoryLoaders(String, String, String, String, String, String)
151 */
152 public void clearEOPHistoryLoaders() {
153 lazyLoadedEop.clearEOPHistoryLoaders();
154 }
155
156 /** Set the threshold to check EOP continuity.
157 * <p>
158 * The default threshold (used if this method is never called)
159 * is 5 Julian days. If after loading EOP entries some holes
160 * between entries exceed this threshold, an exception will
161 * be triggered.
162 * </p>
163 * <p>
164 * One case when calling this method is really useful is for
165 * applications that use a single Bulletin A, as these bulletins
166 * have a roughly one month wide hole for the first bulletin of
167 * each month, which contains older final data in addition to the
168 * rapid data and the predicted data.
169 * </p>
170 * @param threshold threshold to use for checking EOP continuity (in seconds)
171 */
172 public void setEOPContinuityThreshold(final double threshold) {
173 lazyLoadedEop.setEOPContinuityThreshold(threshold);
174 }
175
176 /** {@inheritDoc}
177 * <p>
178 * If no {@link EopHistoryLoader} has been added by calling {@link
179 * #addEOPHistoryLoader(IERSConventions, EopHistoryLoader) addEOPHistoryLoader}
180 * or if {@link #clearEOPHistoryLoaders() clearEOPHistoryLoaders} has been
181 * called afterwards, the {@link #addDefaultEOP1980HistoryLoaders(String, String,
182 * String, String, String, String)} and {@link #addDefaultEOP2000HistoryLoaders(String,
183 * String, String, String, String, String)} methods will be called automatically with
184 * supported file names parameters all set to null, in order to get the default
185 * loaders configuration.
186 * </p>
187 */
188 @Override
189 public EOPHistory getEOPHistory(final IERSConventions conventions, final boolean simpleEOP) {
190 return lazyLoadedEop.getEOPHistory(conventions, simpleEOP, getTimeScales());
191 }
192
193 }