...
 
Commits (18)
/* Contributed in the public domain.
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.bodies;
/**
......
/* Contributed in the public domain.
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.bodies;
import java.util.ArrayList;
......
......@@ -101,7 +101,7 @@ public abstract class AbstractListCrawler<T> implements DataProvider {
@Deprecated
@DefaultDataContext
public boolean feed(final Pattern supported, final DataLoader visitor) {
return feed(supported, visitor, DataProvidersManager.getInstance());
return feed(supported, visitor, DataContext.getDefault().getDataProvidersManager());
}
/** {@inheritDoc} */
......
/* Contributed in the public domain.
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.data;
/**
......
......@@ -114,7 +114,7 @@ public class ClasspathCrawler implements DataProvider {
@Deprecated
@DefaultDataContext
public boolean feed(final Pattern supported, final DataLoader visitor) {
return feed(supported, visitor, DataProvidersManager.getInstance());
return feed(supported, visitor, DataContext.getDefault().getDataProvidersManager());
}
/** {@inheritDoc} */
......
/* Contributed in the public domain.
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.data;
import org.orekit.annotation.DefaultDataContext;
import org.orekit.bodies.CelestialBodies;
import org.orekit.bodies.CelestialBody;
import org.orekit.forces.gravity.potential.GravityFields;
import org.orekit.frames.Frames;
import org.orekit.frames.FramesFactory;
import org.orekit.models.earth.GeoMagneticFields;
import org.orekit.models.earth.ionosphere.KlobucharIonoCoefficientsLoader;
import org.orekit.time.TimeScale;
import org.orekit.time.TimeScales;
import org.orekit.time.TimeScalesFactory;
......@@ -30,7 +44,7 @@ public interface DataContext {
*/
@DefaultDataContext
static LazyLoadedDataContext getDefault() {
return DefaultDataContextHolder.INSTANCE;
return DefaultDataContextHolder.getInstance();
}
/**
......@@ -44,11 +58,11 @@ public interface DataContext {
* @see #getDefault()
*/
static void setDefault(final LazyLoadedDataContext context) {
DefaultDataContextHolder.INSTANCE = context;
DefaultDataContextHolder.setInstance(context);
}
/**
* Get a factory for constructing {@link TimeScale}s based on the auxiliary data in
* Get a factory for constructing {@link org.orekit.time.TimeScale}s based on the auxiliary data in
* this context.
*
* @return the set of common time scales using this data context.
......@@ -56,7 +70,7 @@ public interface DataContext {
TimeScales getTimeScales();
/**
* Get a factory constructing {@link Frame}s based on the auxiliary data in this
* Get a factory constructing {@link org.orekit.frames.Frame}s based on the auxiliary data in this
* context.
*
* @return the set of common reference frames using this data context.
......@@ -64,7 +78,7 @@ public interface DataContext {
Frames getFrames();
/**
* Get a factory constructing {@link CelestialBody}s based on the auxiliary data in
* Get a factory constructing {@link org.orekit.bodies.CelestialBody}s based on the auxiliary data in
* this context.
*
* @return the set of common celestial bodies using this data context.
......@@ -80,8 +94,8 @@ public interface DataContext {
GravityFields getGravityFields();
/**
* Get a factory constructing geomagnetic fields based on the auxiliary data in this
* context.
* Get a factory constructing {@link org.orekit.models.earth.GeoMagneticField}s based on the auxiliary
* data in this context.
*
* @return the geomagnetic fields using this data context.
*/
......
/* Contributed in the public domain.
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.data;
/**
......@@ -9,10 +25,24 @@ package org.orekit.data;
class DefaultDataContextHolder {
/** The default Orekit data context. */
static LazyLoadedDataContext INSTANCE = new LazyLoadedDataContext();
private static volatile LazyLoadedDataContext INSTANCE = new LazyLoadedDataContext();
/** Private Constructor. */
private DefaultDataContextHolder() {
}
/** Get the default Orekit data context.
* @return Orekit's default data context.
*/
static LazyLoadedDataContext getInstance() {
return INSTANCE;
}
/** Set the default Orekit data context.
* @param context the new data context.
*/
static void setInstance(final LazyLoadedDataContext context) {
INSTANCE = context;
}
}
......@@ -70,7 +70,7 @@ public class DirectoryCrawler implements DataProvider {
@Deprecated
@DefaultDataContext
public boolean feed(final Pattern supported, final DataLoader visitor) {
return feed(supported, visitor, DataProvidersManager.getInstance());
return feed(supported, visitor, DataContext.getDefault().getDataProvidersManager());
}
/** {@inheritDoc} */
......
/* Contributed in the public domain.
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.data;
import org.orekit.bodies.LazyLoadedCelestialBodies;
......
......@@ -135,7 +135,7 @@ public class ZipJarCrawler implements DataProvider {
@Deprecated
@DefaultDataContext
public boolean feed(final Pattern supported, final DataLoader visitor) {
return feed(supported, visitor, DataProvidersManager.getInstance());
return feed(supported, visitor, DataContext.getDefault().getDataProvidersManager());
}
/** {@inheritDoc} */
......
......@@ -184,7 +184,8 @@ public class GroundStation {
throw new OrekitException(OrekitMessages.NO_EARTH_ORIENTATION_PARAMETERS);
}
final UT1Scale baseUT1 = eopHistory.getTimeScales().getUT1(eopHistory);
final UT1Scale baseUT1 = eopHistory.getTimeScales()
.getUT1(eopHistory.getConventions(), eopHistory.isSimpleEop());
this.estimatedEarthFrameProvider = new EstimatedEarthFrameProvider(baseUT1);
this.estimatedEarthFrame = new Frame(baseFrame.getParent(), estimatedEarthFrameProvider,
baseFrame.getParent() + "-estimated");
......
......@@ -29,7 +29,6 @@ import org.orekit.estimation.measurements.Range;
import org.orekit.frames.TopocentricFrame;
import org.orekit.models.earth.ionosphere.IonosphericModel;
import org.orekit.propagation.FieldSpacecraftState;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.utils.Differentiation;
import org.orekit.utils.ParameterDriver;
......
......@@ -29,7 +29,6 @@ import org.orekit.estimation.measurements.RangeRate;
import org.orekit.frames.TopocentricFrame;
import org.orekit.models.earth.ionosphere.IonosphericModel;
import org.orekit.propagation.FieldSpacecraftState;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.utils.Differentiation;
import org.orekit.utils.ParameterDriver;
......
......@@ -31,7 +31,6 @@ import org.orekit.estimation.measurements.GroundStation;
import org.orekit.estimation.measurements.RangeRate;
import org.orekit.models.earth.troposphere.DiscreteTroposphericModel;
import org.orekit.propagation.FieldSpacecraftState;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.utils.Differentiation;
import org.orekit.utils.ParameterDriver;
......
......@@ -31,7 +31,6 @@ import org.orekit.estimation.measurements.GroundStation;
import org.orekit.estimation.measurements.Range;
import org.orekit.models.earth.troposphere.DiscreteTroposphericModel;
import org.orekit.propagation.FieldSpacecraftState;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.utils.Differentiation;
import org.orekit.utils.ParameterDriver;
......
......@@ -29,7 +29,6 @@ import org.orekit.estimation.measurements.TurnAroundRange;
import org.orekit.frames.TopocentricFrame;
import org.orekit.models.earth.ionosphere.IonosphericModel;
import org.orekit.propagation.FieldSpacecraftState;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.utils.Differentiation;
import org.orekit.utils.ParameterDriver;
......
......@@ -31,7 +31,6 @@ import org.orekit.estimation.measurements.GroundStation;
import org.orekit.estimation.measurements.TurnAroundRange;
import org.orekit.models.earth.troposphere.DiscreteTroposphericModel;
import org.orekit.propagation.FieldSpacecraftState;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.utils.Differentiation;
import org.orekit.utils.ParameterDriver;
......
......@@ -40,7 +40,6 @@ import org.orekit.files.sp3.SP3File.SP3Coordinate;
import org.orekit.files.sp3.SP3File.SP3FileType;
import org.orekit.files.sp3.SP3File.TimeSystem;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScale;
import org.orekit.time.TimeScales;
......
......@@ -33,7 +33,6 @@ import org.orekit.propagation.FieldSpacecraftState;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.events.EventDetector;
import org.orekit.propagation.events.FieldEventDetector;
import org.orekit.time.TimeScale;
import org.orekit.time.TimeScales;
import org.orekit.time.UT1Scale;
import org.orekit.utils.Constants;
......
/* Contributed in the public domain.
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.forces.gravity.potential;
import java.util.List;
......
/* Contributed in the public domain.
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.forces.gravity.potential;
import java.util.ArrayList;
......
/* Contributed in the public domain.
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.frames;
import org.orekit.data.AbstractSelfFeedingLoader;
......
package org.orekit.frames;
import org.orekit.frames.EOPHistoryLoader.Parser;
import org.orekit.time.TimeScale;
import org.orekit.utils.IERSConventions;
import org.orekit.utils.IERSConventions.NutationCorrectionConverter;
/**
* Abstract class that holds common data used by several implementations of {@link
* Parser}.
*
* @author Evan Ward
* @since 10.1
*/
abstract class AbstractEopParser implements Parser {
/** Converter for nutation corrections. */
private final IERSConventions.NutationCorrectionConverter converter;
/** Configuration for ITRF versions. */
private final ItrfVersionProvider itrfVersionProvider;
/** UTC time scale. */
private final TimeScale utc;
/**
* Simple constructor.
*
* @param converter converter to use
* @param itrfVersionProvider to use for determining the ITRF version of the EOP.
* @param utc time scale for parsing dates.
*/
protected AbstractEopParser(final NutationCorrectionConverter converter,
final ItrfVersionProvider itrfVersionProvider,
final TimeScale utc) {
this.converter = converter;
this.itrfVersionProvider = itrfVersionProvider;
this.utc = utc;
}
/**
* Get the nutation converter.
*
* @return the nutation converter.
*/
protected NutationCorrectionConverter getConverter() {
return converter;
}
/**
* Get the ITRF version loader.
*
* @return ITRF version loader.
*/
protected ItrfVersionProvider getItrfVersionProvider() {
return itrfVersionProvider;
}
/**
* Get the UTC time scale.
*
* @return UTC time scale.
*/
protected TimeScale getUtc() {
return utc;
}
}
This diff is collapsed.
......@@ -378,7 +378,7 @@ class BulletinAFilesLoader extends AbstractEopLoader implements EOPHistoryLoader
private final Map<Integer, double[]> poleOffsetsFieldsMap;
/** Configuration for ITRF versions. */
private final ITRFVersionLoader itrfVersionLoader;
private final ItrfVersionProvider itrfVersionProvider;
/** ITRF version configuration. */
private ITRFVersionLoader.ITRFVersionConfiguration configuration;
......@@ -406,7 +406,7 @@ class BulletinAFilesLoader extends AbstractEopLoader implements EOPHistoryLoader
Parser() {
this.eopFieldsMap = new HashMap<>();
this.poleOffsetsFieldsMap = new HashMap<>();
this.itrfVersionLoader = new ITRFVersionLoader(
this.itrfVersionProvider = new ITRFVersionLoader(
ITRFVersionLoader.SUPPORTED_NAMES,
getDataProvidersManager());
this.lineNumber = 0;
......@@ -495,7 +495,7 @@ class BulletinAFilesLoader extends AbstractEopLoader implements EOPHistoryLoader
// we have only pole offsets for this date
if (configuration == null || !configuration.isValid(mjd)) {
// get a configuration for current name and date range
configuration = itrfVersionLoader.getConfiguration(fileName, mjd);
configuration = itrfVersionProvider.getConfiguration(fileName, mjd);
}
history.add(new EOPEntry(mjd,
0.0, 0.0, 0.0, 0.0,
......@@ -530,7 +530,7 @@ class BulletinAFilesLoader extends AbstractEopLoader implements EOPHistoryLoader
if (configuration == null || !configuration.isValid(mjd)) {
// get a configuration for current name and date range
configuration = itrfVersionLoader.getConfiguration(fileName, mjd);
configuration = itrfVersionProvider.getConfiguration(fileName, mjd);
}
if (currentPole == null) {
// we have only EOP for this date
......
......@@ -22,6 +22,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -30,7 +31,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.hipparchus.util.FastMath;
import org.orekit.data.DataLoader;
import org.orekit.data.DataProvidersManager;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
......@@ -40,6 +40,7 @@ import org.orekit.time.Month;
import org.orekit.time.TimeScale;
import org.orekit.utils.Constants;
import org.orekit.utils.IERSConventions;
import org.orekit.utils.IERSConventions.NutationCorrectionConverter;
/** Loader for bulletin B files.
* <p>Bulletin B files contain {@link EOPEntry
......@@ -235,25 +236,23 @@ class BulletinBFilesLoader extends AbstractEopLoader implements EOPHistoryLoader
/** {@inheritDoc} */
public void fillHistory(final IERSConventions.NutationCorrectionConverter converter,
final SortedSet<EOPEntry> history) {
final Parser parser = new Parser(converter);
this.feed(parser);
history.addAll(parser.history);
final ItrfVersionProvider itrfVersionProvider = new ITRFVersionLoader(
ITRFVersionLoader.SUPPORTED_NAMES,
getDataProvidersManager());
final Parser parser = new Parser(converter, itrfVersionProvider, getUtc());
final EopParserLoader loader = new EopParserLoader(parser);
this.feed(loader);
history.addAll(loader.getEop());
}
/** Internal class performing the parsing. */
private class Parser implements DataLoader {
/** Converter for nutation corrections. */
private final IERSConventions.NutationCorrectionConverter converter;
/** Configuration for ITRF versions. */
private final ITRFVersionLoader itrfVersionLoader;
static class Parser extends AbstractEopParser {
/** ITRF version configuration. */
private ITRFVersionLoader.ITRFVersionConfiguration configuration;
/** History entries. */
private final List<EOPEntry> history;
private List<EOPEntry> history;
/** Map for fields read in different sections. */
private final Map<Integer, double[]> fieldsMap;
......@@ -270,15 +269,17 @@ class BulletinBFilesLoader extends AbstractEopLoader implements EOPHistoryLoader
/** End of final data. */
private int mjdMax;
/** Simple constructor.
* @param converter converter to use
/**
* Simple constructor.
*
* @param converter converter to use
* @param itrfVersionProvider to use for determining the ITRF version of the EOP.
* @param utc time scale for parsing dates.
*/
Parser(final IERSConventions.NutationCorrectionConverter converter) {
this.converter = converter;
this.itrfVersionLoader = new ITRFVersionLoader(
ITRFVersionLoader.SUPPORTED_NAMES,
getDataProvidersManager());
this.history = new ArrayList<>();
Parser(final NutationCorrectionConverter converter,
final ItrfVersionProvider itrfVersionProvider,
final TimeScale utc) {
super(converter, itrfVersionProvider, utc);
this.fieldsMap = new HashMap<>();
this.lineNumber = 0;
this.mjdMin = Integer.MAX_VALUE;
......@@ -286,24 +287,20 @@ class BulletinBFilesLoader extends AbstractEopLoader implements EOPHistoryLoader
}
/** {@inheritDoc} */
public boolean stillAcceptsData() {
return true;
}
/** {@inheritDoc} */
public void loadData(final InputStream input, final String name)
@Override
public Collection<EOPEntry> parse(final InputStream input, final String name)
throws IOException {
configuration = null;
// set up a reader for line-oriented bulletin B files
final BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
// reset parse info to start new file (do not clear history!)
// reset parse info to start new file
fieldsMap.clear();
lineNumber = 0;
mjdMin = Integer.MAX_VALUE;
mjdMax = Integer.MIN_VALUE;
history = new ArrayList<>();
configuration = null;
// skip header up to section 1 and check if we are parsing an old or new format file
final Matcher section1Matcher = seekToLine(SECTION_1_HEADER, reader, name);
......@@ -339,10 +336,10 @@ class BulletinBFilesLoader extends AbstractEopLoader implements EOPHistoryLoader
final AbsoluteDate mjdDate =
new AbsoluteDate(new DateComponents(DateComponents.MODIFIED_JULIAN_EPOCH, mjd),
getUtc());
final double[] equinox = converter.toEquinox(mjdDate, array[4], array[5]);
final double[] equinox = getConverter().toEquinox(mjdDate, array[4], array[5]);
if (configuration == null || !configuration.isValid(mjd)) {
// get a configuration for current name and date range
configuration = itrfVersionLoader.getConfiguration(name, mjd);
configuration = getItrfVersionProvider().getConfiguration(name, mjd);
}
history.add(new EOPEntry(mjd, array[0], array[1], array[2], array[3],
equinox[0], equinox[1], array[4], array[5],
......@@ -351,6 +348,8 @@ class BulletinBFilesLoader extends AbstractEopLoader implements EOPHistoryLoader
}
return history;
}
/** Read until a line matching a pattern is found.
......@@ -447,17 +446,17 @@ class BulletinBFilesLoader extends AbstractEopLoader implements EOPHistoryLoader
Double.parseDouble(matcher.group(6)) * MILLI_ARC_SECONDS_TO_RADIANS,
Double.parseDouble(matcher.group(7)) * MILLI_ARC_SECONDS_TO_RADIANS
};
equinox = converter.toEquinox(mjdDate, nro[0], nro[1]);
equinox = getConverter().toEquinox(mjdDate, nro[0], nro[1]);
} else {
equinox = new double[] {
Double.parseDouble(matcher.group(6)) * MILLI_ARC_SECONDS_TO_RADIANS,
Double.parseDouble(matcher.group(7)) * MILLI_ARC_SECONDS_TO_RADIANS
};
nro = converter.toNonRotating(mjdDate, equinox[0], equinox[1]);
nro = getConverter().toNonRotating(mjdDate, equinox[0], equinox[1]);
}
if (configuration == null || !configuration.isValid(mjd)) {
// get a configuration for current name and date range
configuration = itrfVersionLoader.getConfiguration(name, mjd);
configuration = getItrfVersionProvider().getConfiguration(name, mjd);
}
history.add(new EOPEntry(mjd, dtu1, lod, x, y, equinox[0], equinox[1], nro[0], nro[1],
configuration.getVersion(), mjdDate));
......
......@@ -22,12 +22,12 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.SortedSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.orekit.data.DataLoader;
import org.orekit.data.DataProvidersManager;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
......@@ -36,6 +36,7 @@ import org.orekit.time.DateComponents;
import org.orekit.time.TimeScale;
import org.orekit.utils.Constants;
import org.orekit.utils.IERSConventions;
import org.orekit.utils.IERSConventions.NutationCorrectionConverter;
/** Loader for EOP xx C04 files.
* <p>EOP xx C04 files contain {@link EOPEntry
......@@ -155,43 +156,36 @@ class EOPC04FilesLoader extends AbstractEopLoader implements EOPHistoryLoader {
/** {@inheritDoc} */
public void fillHistory(final IERSConventions.NutationCorrectionConverter converter,
final SortedSet<EOPEntry> history) {
final Parser parser = new Parser(converter);
this.feed(parser);
history.addAll(parser.history);
final ItrfVersionProvider itrfVersionProvider = new ITRFVersionLoader(
ITRFVersionLoader.SUPPORTED_NAMES,
getDataProvidersManager());
final Parser parser = new Parser(converter, itrfVersionProvider, getUtc());
final EopParserLoader loader = new EopParserLoader(parser);
this.feed(loader);
history.addAll(loader.getEop());
}
/** Internal class performing the parsing. */
private class Parser implements DataLoader {
/** Converter for nutation corrections. */
private final IERSConventions.NutationCorrectionConverter converter;
/** Configuration for ITRF versions. */
private final ITRFVersionLoader itrfVersionLoader;
/** History entries. */
private final List<EOPEntry> history;
/** Simple constructor.
* @param converter converter to use
static class Parser extends AbstractEopParser {
/**
* Simple constructor.
*
* @param converter converter to use
* @param itrfVersionProvider to use for determining the ITRF version of the EOP.
* @param utc time scale for parsing dates.
*/
Parser(final IERSConventions.NutationCorrectionConverter converter) {
this.converter = converter;
this.itrfVersionLoader = new ITRFVersionLoader(
ITRFVersionLoader.SUPPORTED_NAMES,
getDataProvidersManager());
this.history = new ArrayList<>();
}
/** {@inheritDoc} */
public boolean stillAcceptsData() {
return true;
Parser(final NutationCorrectionConverter converter,
final ItrfVersionProvider itrfVersionProvider,
final TimeScale utc) {
super(converter, itrfVersionProvider, utc);
}
/** {@inheritDoc} */
public void loadData(final InputStream input, final String name)
public Collection<EOPEntry> parse(final InputStream input, final String name)
throws IOException, OrekitException {
final List<EOPEntry> history = new ArrayList<>();
ITRFVersionLoader.ITRFVersionConfiguration configuration = null;
// set up a reader for line-oriented bulletin B files
......@@ -242,17 +236,17 @@ class EOPC04FilesLoader extends AbstractEopLoader implements EOPHistoryLoader {
Double.parseDouble(fields[NUT_0_FIELD]) * Constants.ARC_SECONDS_TO_RADIANS,
Double.parseDouble(fields[NUT_1_FIELD]) * Constants.ARC_SECONDS_TO_RADIANS
};
equinox = converter.toEquinox(date, nro[0], nro[1]);
equinox = getConverter().toEquinox(date, nro[0], nro[1]);
} else {
equinox = new double[] {
Double.parseDouble(fields[NUT_0_FIELD]) * Constants.ARC_SECONDS_TO_RADIANS,
Double.parseDouble(fields[NUT_1_FIELD]) * Constants.ARC_SECONDS_TO_RADIANS
};
nro = converter.toNonRotating(date, equinox[0], equinox[1]);
nro = getConverter().toNonRotating(date, equinox[0], equinox[1]);
}
if (configuration == null || !configuration.isValid(mjd)) {
// get a configuration for current name and date range
configuration = itrfVersionLoader.getConfiguration(name, mjd);
configuration = getItrfVersionProvider().getConfiguration(name, mjd);
}
history.add(new EOPEntry(mjd, dtu1, lod, x, y, equinox[0], equinox[1], nro[0], nro[1],
configuration.getVersion(), date));
......@@ -270,6 +264,7 @@ class EOPC04FilesLoader extends AbstractEopLoader implements EOPHistoryLoader {
throw new OrekitException(OrekitMessages.NOT_A_SUPPORTED_IERS_DATA_FILE, name);
}
return history;
}
}
......
......@@ -90,7 +90,7 @@ public class EOPHistory implements Serializable {
*/
@DefaultDataContext
protected EOPHistory(final IERSConventions conventions,
final Collection<EOPEntry> data,
final Collection<? extends EOPEntry> data,
final boolean simpleEOP) {
this(conventions, data, simpleEOP, DataContext.getDefault().getTimeScales());
}
......@@ -102,10 +102,10 @@ public class EOPHistory implements Serializable {
* @param timeScales to use when computing EOP corrections.
* @since 10.1
*/
protected EOPHistory(final IERSConventions conventions,
final Collection<EOPEntry> data,
final boolean simpleEOP,
final TimeScales timeScales) {
public EOPHistory(final IERSConventions conventions,
final Collection<? extends EOPEntry> data,
final boolean simpleEOP,
final TimeScales timeScales) {
this(conventions,
data,
simpleEOP ? null : new CachedCorrection(conventions.getEOPTidalCorrection(timeScales)),
......@@ -120,7 +120,7 @@ public class EOPHistory implements Serializable {
* @since 10.1
*/
private EOPHistory(final IERSConventions conventions,
final Collection<EOPEntry> data,
final Collection<? extends EOPEntry> data,
final TimeVectorFunction tidalCorrection,
final TimeScales timeScales) {
this.conventions = conventions;
......@@ -137,6 +137,15 @@ public class EOPHistory implements Serializable {
}
}
/**
* Determine if this history uses simplified EOP corrections.
*
* @return {@code true} if tidal corrections are ignored, {@code false} otherwise.
*/
public boolean isSimpleEop() {
return tidalCorrection == null;
}
/**
* Get the time scales used in computing EOP corrections.
*
......
......@@ -16,8 +16,12 @@
*/
package org.orekit.frames;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.SortedSet;
import org.orekit.time.TimeScales;
import org.orekit.utils.IERSConventions;
/** Interface for loading Earth Orientation Parameters history.
......@@ -33,4 +37,124 @@ public interface EOPHistoryLoader {
void fillHistory(IERSConventions.NutationCorrectionConverter converter,
SortedSet<EOPEntry> history);
/**
* Interface for parsing EOP data files.
*
* @author Evan Ward
* @since 10.1
*/
interface Parser {
/**
* Parse EOP from the given input stream.
*
* @param input stream to parse.
* @param name of the stream for error messages.
* @return parsed EOP entries.
* @throws IOException if {@code input} throws one during parsing.
*/
Collection<EOPEntry> parse(InputStream input, String name) throws IOException;
/**
* Create a new parser for EOP data in the rapid and predicted XML format.
*
* <p>The XML EOP files are recognized thanks to their base names, which
* match one of the the patterns <code>finals.2000A.*.xml</code> or
* <code>finals.*.xml</code> where * stands for a word like "all", "daily", or
* "data".
*
* @param conventions used to convert between equinox-based and
* non-rotating-origin-based paradigms.
* @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
* @param timeScales used to parse the EOP data.
* @return a new parser.
*/
static Parser newFinalsXmlParser(
final IERSConventions conventions,
final ItrfVersionProvider itrfVersionProvider,
final TimeScales timeScales) {
return new RapidDataAndPredictionXMLLoader.Parser(
conventions.getNutationCorrectionConverter(timeScales),
itrfVersionProvider,
timeScales.getUTC());
}
/**
* Create a new parser for EOP data in the rapid and predicted columnar format.
*
* <p>The rapid data and prediction file is recognized thanks to its base name,
* which match one of the the patterns <code>finals.*</code> or
* <code>finals2000A.*</code> where * stands for a word like "all", "daily", or
* "data". The file with 2000A in their name correspond to the IAU-2000
* precession-nutation model whereas the files without any identifier correspond
* to the IAU-1980 precession-nutation model. The files with the all suffix start
* from 1973-01-01, and the files with the data suffix start from 1992-01-01.
*
* @param conventions used to convert between equinox-based and
* non-rotating-origin-based paradigms.
* @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
* @param timeScales used to parse the EOP data.
* @param isNonRotatingOrigin if true the supported files <em>must</em> contain
* δX/δY nutation corrections, otherwise they
* <em>must</em> contain δΔψ/δΔε nutation
* corrections
* @return a new parser.
*/
static Parser newFinalsColumnsParser(
final IERSConventions conventions,
final ItrfVersionProvider itrfVersionProvider,
final TimeScales timeScales,
final boolean isNonRotatingOrigin) {
return new RapidDataAndPredictionColumnsLoader.Parser(
conventions.getNutationCorrectionConverter(timeScales),
itrfVersionProvider,
timeScales.getUTC(),
isNonRotatingOrigin);
}
/**
* Create a new parser for EOP data in the EOP C04 format.
*
* <p>The EOP xx C04 files are recognized thanks to their base names, which
* match one of the patterns {@code eopc04_##_IAU2000.##} or {@code eopc04_##.##}
* where # stands for a digit character.
*
* @param conventions used to convert between equinox-based and
* non-rotating-origin-based paradigms.
* @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
* @param timeScales used to parse the EOP data.
* @return a new parser.
*/
static Parser newEopC04Parser(
final IERSConventions conventions,
final ItrfVersionProvider itrfVersionProvider,
final TimeScales timeScales) {
return new EOPC04FilesLoader.Parser(
conventions.getNutationCorrectionConverter(timeScales),
itrfVersionProvider,
timeScales.getUTC());
}
/**
* Create a new parser for EOP data in the Bulletin B format.
*
* @param conventions used to convert between equinox-based and
* non-rotating-origin-based paradigms.
* @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
* @param timeScales used to parse the EOP data.
* @return a new parser.
*/
static Parser newBulletinBParser(
final IERSConventions conventions,
final ItrfVersionProvider itrfVersionProvider,
final TimeScales timeScales) {
return new BulletinBFilesLoader.Parser(
conventions.getNutationCorrectionConverter(timeScales),
itrfVersionProvider,
timeScales.getUTC());
}
}
}
package org.orekit.frames;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.orekit.data.DataLoader;
/**
* Implementation of {@link DataLoader} based on {@link EOPHistoryLoader.Parser} that
* loads all files and compiles the results into one data structure.
*
* @author Evan Ward
* @since 10.1
*/
class EopParserLoader implements DataLoader {
/** Parser for EOP data files. */
private final EOPHistoryLoader.Parser parser;
/** History entries. */
private final List<EOPEntry> history;
/**
* Create a {@link DataLoader} based on a {@link EOPHistoryLoader.Parser}. Loads
* all EOP data into a single collection.
*
* @param parser for the EOP data files.
*/
EopParserLoader(final EOPHistoryLoader.Parser parser) {
this.parser = parser;
this.history = new ArrayList<>();
}
/**
* Get the parsed EOP entries.
*
* @return the parsed EOP data. The returned collection is a reference, not a
* copy. It is not guaranteed to be sorted.
*/
public Collection<EOPEntry> getEop() {
return history;
}
/** {@inheritDoc} */
public boolean stillAcceptsData() {
return true;
}
@Override
public void loadData(final InputStream input, final String name)
throws IOException, ParseException {
history.addAll(parser.parse(input, name));
}
}
/* Contributed in the public domain.
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.frames;
import java.util.Collection;
import java.util.function.BiFunction;
import java.util.function.Supplier;
import org.orekit.bodies.CelestialBodies;
import org.orekit.time.TimeScales;
import org.orekit.utils.IERSConventions;
/**
......@@ -240,4 +262,42 @@ public interface Frames {
FactoryManagedFrame getPZ9011(IERSConventions convention,
boolean simpleEOP);
/* Helpers for creating instances */
/**
* Create a set of frames from the given data.
*
* @param timeScales used to build the frames as well as the EOP data set.
* @param celestialBodies used to get {@link #getICRF()} which is the inertial frame
* of the solar system barycenter.
* @return a set of reference frame constructed from the given data.
* @see #of(TimeScales, Supplier)
*/
static Frames of(final TimeScales timeScales,
final CelestialBodies celestialBodies) {
return of(timeScales, () -> celestialBodies.getSolarSystemBarycenter()
.getInertiallyOrientedFrame());
}
/**
* Create a set of frames from the given data.
*
* @param timeScales used to build the frames as well as the EOP data set.
* @param icrfSupplier used to get {@link #getICRF()}. For example, {@code
* celestialBodies.getSolarSystemBarycenter().getInertiallyOrientedFrame()}
* @return a set of reference frame constructed from the given data.
* @see CelestialBodies
* @see TimeScales#of(Collection, BiFunction)
*/
static Frames of(final TimeScales timeScales,
final Supplier<Frame> icrfSupplier) {
return new AbstractFrames(timeScales, icrfSupplier) {
@Override
public EOPHistory getEOPHistory(final IERSConventions conventions,
final boolean simpleEOP) {
return getTimeScales().getUT1(conventions, simpleEOP).getEOPHistory();
}
};
}
}
......@@ -31,6 +31,7 @@ import org.orekit.errors.OrekitInternalError;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.FieldAbsoluteDate;
import org.orekit.time.TimeScalarFunction;
import org.orekit.time.TimeScale;
import org.orekit.time.TimeScales;
import org.orekit.time.UT1Scale;
import org.orekit.utils.Constants;
......@@ -63,7 +64,8 @@ public class GTODProvider implements EOPBasedTransformProvider {
/** Simple constructor.
*
* <p>This method uses the {@link DataContext#getDefault() default data context}.
* <p>This method uses the {@link DataContext#getDefault() default data context} if
* {@code eopHistory == null}.
*
* @param conventions IERS conventions to use
* @param eopHistory EOP history (may be null)
......@@ -74,7 +76,10 @@ public class GTODProvider implements EOPBasedTransformProvider {
@DefaultDataContext
protected GTODProvider(final IERSConventions conventions,
final EOPHistory eopHistory) {
this(conventions, eopHistory, DataContext.getDefault().getTimeScales());
this(conventions, eopHistory,
eopHistory == null ?
DataContext.getDefault().getTimeScales() :
eopHistory.getTimeScales());
}
/** Simple constructor.
......@@ -86,7 +91,9 @@ public class GTODProvider implements EOPBasedTransformProvider {
protected GTODProvider(final IERSConventions conventions,
final EOPHistory eopHistory,
final TimeScales timeScales) {
final UT1Scale ut1 = timeScales.getUT1(eopHistory);
final TimeScale ut1 = eopHistory == null ?
timeScales.getUTC() : // UT1 wihthout EOP is UTC
timeScales.getUT1(eopHistory.getConventions(), eopHistory.isSimpleEop());
this.conventions = conventions;
this.eopHistory = eopHistory;
this.gastFunction = conventions.getGASTFunction(ut1, eopHistory, timeScales);
......
......@@ -62,7 +62,7 @@ import org.orekit.time.DateComponents;
* @author Luc Maisonobe
* @since 9.2
*/
public class ITRFVersionLoader {
public class ITRFVersionLoader implements ItrfVersionProvider {
/** Regular expression for supported files names. */
public static final String SUPPORTED_NAMES = "itrf-versions.conf";
......@@ -115,11 +115,7 @@ public class ITRFVersionLoader {
this(SUPPORTED_NAMES);
}
/** Get the ITRF version configuration defined by a given file at specified date.
* @param name EOP file name
* @param mjd date of the EOP in modified Julian day
* @return configuration valid around specified date in the file
*/
@Override
public ITRFVersionConfiguration getConfiguration(final String name, final int mjd) {
for (final ITRFVersionConfiguration configuration : configurations) {
......@@ -275,10 +271,10 @@ public class ITRFVersionLoader {
* @param validityStart start of validity (included)
* @param validityEnd end of validity (excluded)
*/
ITRFVersionConfiguration(final String prefix,
final ITRFVersion version,
final int validityStart,
final int validityEnd) {
public ITRFVersionConfiguration(final String prefix,
final ITRFVersion version,
final int validityStart,
final int validityEnd) {
this.prefix = prefix;
this.version = version;
this.validityStart = validityStart;
......
package org.orekit.frames;
import org.orekit.frames.ITRFVersionLoader.ITRFVersionConfiguration;
/**
* Interface for retrieving the ITRF version for a given set of EOP data.
*
* @author Luc Maisonobe
* @author Evan Ward
* @see ITRFVersionLoader
* @since 10.1
*/
public interface ItrfVersionProvider {
/**
* Get the ITRF version configuration defined by a given file at specified date.
*
* @param name EOP file name
* @param mjd date of the EOP in modified Julian day
* @return configuration valid around specified date in the file
*/
ITRFVersionConfiguration getConfiguration(String name, int mjd);
}
/* Contributed in the public domain.
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.frames;
import java.util.ArrayList;
......@@ -14,11 +30,10 @@ import org.orekit.time.TimeScale;
import org.orekit.time.TimeScales;
import org.orekit.utils.Constants;
import org.orekit.utils.IERSConventions;
import org.orekit.utils.IERSConventions.NutationCorrectionConverter;
/**
* Loads Earth Orientation Parameters (EOP)from a configured set of {@link
* EOPHistoryLoader}s on demand. Methods are synchronized to it is safe for access from
* Loads Earth Orientation Parameters (EOP) from a configured set of {@link
* EOPHistoryLoader}s on demand. Methods are synchronized so it is safe for access from
* multiple threads.
*
* @author Guylaine Prat
......
......@@ -22,13 +22,13 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.SortedSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.hipparchus.util.MathUtils;
import org.orekit.data.DataLoader;
import org.orekit.data.DataProvidersManager;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
......@@ -36,6 +36,7 @@ import org.orekit.time.AbsoluteDate;
import org.orekit.time.DateComponents;
import org.orekit.time.TimeScale;
import org.orekit.utils.IERSConventions;
import org.orekit.utils.IERSConventions.NutationCorrectionConverter;
/** Loader for IERS rapid data and prediction files in columns format (finals file).
* <p>Rapid data and prediction files contain {@link EOPEntry
......@@ -153,49 +154,42 @@ class RapidDataAndPredictionColumnsLoader extends AbstractEopLoader
/** {@inheritDoc} */
public void fillHistory(final IERSConventions.NutationCorrectionConverter converter,
final SortedSet<EOPEntry> history) {
final Parser parser = new Parser(converter, isNonRotatingOrigin);
this.feed(parser);
history.addAll(parser.history);
final ItrfVersionProvider itrfVersionProvider = new ITRFVersionLoader(
ITRFVersionLoader.SUPPORTED_NAMES,
getDataProvidersManager());
final Parser parser =
new Parser(converter, itrfVersionProvider, getUtc(), isNonRotatingOrigin);
final EopParserLoader loader = new EopParserLoader(parser);
this.feed(loader);
history.addAll(loader.getEop());
}
/** Internal class performing the parsing. */
private class Parser implements DataLoader {
/** Converter for nutation corrections. */
private final IERSConventions.NutationCorrectionConverter converter;
/** Configuration for ITRF versions. */
private final ITRFVersionLoader itrfVersionLoader;
static class Parser extends AbstractEopParser {
/** Indicator for Non-Rotating Origin. */
private final boolean isNonRotatingOrigin;
/** History entries. */
private final List<EOPEntry> history;
/** Simple constructor.
* @param converter converter to use
* @param itrfVersionProvider to use for determining the ITRF version of the EOP.
* @param utc time scale for parsing dates.
* @param isNonRotatingOrigin type of nutation correction
*/
Parser(final IERSConventions.NutationCorrectionConverter converter,
Parser(final NutationCorrectionConverter converter,
final ItrfVersionProvider itrfVersionProvider,
final TimeScale utc,
final boolean isNonRotatingOrigin) {
this.converter = converter;
this.itrfVersionLoader = new ITRFVersionLoader(
ITRFVersionLoader.SUPPORTED_NAMES,
getDataProvidersManager());
super(converter, itrfVersionProvider, utc);
this.isNonRotatingOrigin = isNonRotatingOrigin;
this.history = new ArrayList<>();
}
/** {@inheritDoc} */
public boolean stillAcceptsData() {
return true;
}
/** {@inheritDoc} */
public void loadData(final InputStream input, final String name)
@Override
public Collection<EOPEntry> parse(final InputStream input, final String name)
throws IOException {
final List<EOPEntry> history = new ArrayList<>();
ITRFVersionLoader.ITRFVersionConfiguration configuration = null;
// set up a reader for line-oriented bulletin B files
......@@ -301,13 +295,13 @@ class RapidDataAndPredictionColumnsLoader extends AbstractEopLoader
MILLI_ARC_SECONDS_TO_RADIANS * Double.parseDouble(nutationMatcher.group(1)),
MILLI_ARC_SECONDS_TO_RADIANS * Double.parseDouble(nutationMatcher.group(3))
};
equinox = converter.toEquinox(mjdDate, nro[0], nro[1]);
equinox = getConverter().toEquinox(mjdDate, nro[0], nro[1]);
} else {
equinox = new double[] {
MILLI_ARC_SECONDS_TO_RADIANS * Double.parseDouble(nutationMatcher.group(1)),
MILLI_ARC_SECONDS_TO_RADIANS * Double.parseDouble(nutationMatcher.group(3))
};
nro = converter.toNonRotating(mjdDate, equinox[0], equinox[1]);
nro = getConverter().toNonRotating(mjdDate, equinox[0], equinox[1]);
}
} else {
throw new OrekitException(OrekitMessages.UNABLE_TO_PARSE_LINE_IN_FILE,
......@@ -317,13 +311,14 @@ class RapidDataAndPredictionColumnsLoader extends AbstractEopLoader
if (configuration == null || !configuration.isValid(mjd)) {
// get a configuration for current name and date range
configuration = itrfVersionLoader.getConfiguration(name, mjd);
configuration = getItrfVersionProvider().getConfiguration(name, mjd);
}
history.add(new EOPEntry(mjd, dtu1, lod, x, y, equinox[0], equinox[1], nro[0], nro[1],
configuration.getVersion(), mjdDate));
}
return history;
}
}
......
......@@ -21,6 +21,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.SortedSet;
......@@ -28,7 +29,6 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import org.hipparchus.exception.LocalizedCoreFormats;
import org.orekit.data.DataLoader;
import org.orekit.data.DataProvidersManager;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
......@@ -84,43 +84,40 @@ class RapidDataAndPredictionXMLLoader extends AbstractEopLoader
/** {@inheritDoc} */
public void fillHistory(final IERSConventions.NutationCorrectionConverter converter,
final SortedSet<EOPEntry> history) {
final Parser parser = new Parser(converter);
this.feed(parser);
history.addAll(parser.history);
final ItrfVersionProvider itrfVersionProvider = new ITRFVersionLoader(
ITRFVersionLoader.SUPPORTED_NAMES,
getDataProvidersManager());
final Parser parser = new Parser(converter, itrfVersionProvider, getUtc());
final EopParserLoader loader = new EopParserLoader(parser);
this.feed(loader);
history.addAll(loader.getEop());
}
/** Internal class performing the parsing. */
private class Parser implements DataLoader {
/** Converter for nutation corrections. */
private final IERSConventions.NutationCorrectionConverter converter;
/** Configuration for ITRF versions. */
private final ITRFVersionLoader itrfVersionLoader;
static class Parser extends AbstractEopParser {
/** History entries. */
private final List<EOPEntry> history;
/** Simple constructor.
* @param converter converter to use
private List<EOPEntry> history;
/**
* Simple constructor.
*
* @param converter converter to use
* @param itrfVersionProvider to use for determining the ITRF version of the EOP.
* @param utc time scale for parsing dates.
*/
Parser(final IERSConventions.NutationCorrectionConverter converter) {
this.converter = converter;
this.itrfVersionLoader = new ITRFVersionLoader(
ITRFVersionLoader.SUPPORTED_NAMES,
getDataProvidersManager());
this.history = new ArrayList<>();
Parser(final IERSConventions.NutationCorrectionConverter converter,
final ItrfVersionProvider itrfVersionProvider,
final TimeScale utc) {
super(converter, itrfVersionProvider, utc);
}
/** {@inheritDoc} */
public boolean stillAcceptsData()