EopHistoryLoader.java

  1. /* Copyright 2002-2025 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. import java.io.IOException;
  19. import java.io.InputStream;
  20. import java.util.Collection;
  21. import java.util.SortedSet;

  22. import org.orekit.time.TimeScales;
  23. import org.orekit.utils.IERSConventions;

  24. /** Interface for loading Earth Orientation Parameters history.
  25.  * @author Luc Maisonobe
  26.  * @since 6.1
  27.  */
  28. public interface EopHistoryLoader {

  29.     /** Load celestial body.
  30.      * @param converter converter to use for nutation corrections
  31.      * @param history history to fill up
  32.      */
  33.     void fillHistory(IERSConventions.NutationCorrectionConverter converter,
  34.                      SortedSet<EOPEntry> history);

  35.     /**
  36.      * Interface for parsing EOP data files.
  37.      *
  38.      * @author Evan Ward
  39.      * @since 10.1
  40.      */
  41.     interface Parser {

  42.         /**
  43.          * Parse EOP from the given input stream.
  44.          *
  45.          * @param input stream to parse.
  46.          * @param name  of the stream for error messages.
  47.          * @return parsed EOP entries.
  48.          * @throws IOException if {@code input} throws one during parsing.
  49.          */
  50.         Collection<EOPEntry> parse(InputStream input, String name) throws IOException;

  51.         /**
  52.          * Create a new parser for EOP data in the rapid and predicted XML format.
  53.          *
  54.          * <p>The XML EOP files are recognized thanks to their base names, which
  55.          * match one of the the patterns <code>finals.2000A.*.xml</code> or
  56.          * <code>finals.*.xml</code> where * stands for a word like "all", "daily", or
  57.          * "data".
  58.          *
  59.          * @param conventions         used to convert between equinox-based and
  60.          *                            non-rotating-origin-based paradigms.
  61.          * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
  62.          * @param timeScales          used to parse the EOP data.
  63.          * @return a new parser.
  64.          */
  65.         static Parser newFinalsXmlParser(
  66.                 final IERSConventions conventions,
  67.                 final ItrfVersionProvider itrfVersionProvider,
  68.                 final TimeScales timeScales) {
  69.             return new EopXmlLoader.Parser(
  70.                     conventions.getNutationCorrectionConverter(timeScales),
  71.                     itrfVersionProvider,
  72.                     timeScales.getUTC());
  73.         }

  74.         /**
  75.          * Create a new parser for EOP data in the rapid and predicted columnar format.
  76.          *
  77.          * <p>The rapid data and prediction file is recognized thanks to its base name,
  78.          * which match one of the the patterns <code>finals.*</code> or
  79.          * <code>finals2000A.*</code> where * stands for a word like "all", "daily", or
  80.          * "data". The file with 2000A in their name correspond to the IAU-2000
  81.          * precession-nutation model whereas the files without any identifier correspond
  82.          * to the IAU-1980 precession-nutation model. The files with the all suffix start
  83.          * from 1973-01-01, and the files with the data suffix start from 1992-01-01.
  84.          *
  85.          * @param conventions         used to convert between equinox-based and
  86.          *                            non-rotating-origin-based paradigms.
  87.          * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
  88.          * @param timeScales          used to parse the EOP data.
  89.          * @param isNonRotatingOrigin if true the supported files <em>must</em> contain
  90.          *                            δX/δY nutation corrections, otherwise they
  91.          *                            <em>must</em> contain δΔψ/δΔε nutation
  92.          *                            corrections
  93.          * @return a new parser.
  94.          */
  95.         static Parser newFinalsColumnsParser(
  96.                 final IERSConventions conventions,
  97.                 final ItrfVersionProvider itrfVersionProvider,
  98.                 final TimeScales timeScales,
  99.                 final boolean isNonRotatingOrigin) {
  100.             return new RapidDataAndPredictionColumnsLoader.Parser(
  101.                     conventions.getNutationCorrectionConverter(timeScales),
  102.                     itrfVersionProvider,
  103.                     timeScales.getUTC(),
  104.                     isNonRotatingOrigin);
  105.         }

  106.         /**
  107.          * Create a new parser for EOP data in the EOP C04 format.
  108.          *
  109.          * <p>The EOP xx C04 files are recognized thanks to their base names, which
  110.          * match one of the patterns {@code eopc04_##_IAU2000.##} or {@code eopc04_##.##}
  111.          * where # stands for a digit character.
  112.          *
  113.          * @param conventions         used to convert between equinox-based and
  114.          *                            non-rotating-origin-based paradigms.
  115.          * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
  116.          * @param timeScales          used to parse the EOP data.
  117.          * @return a new parser.
  118.          */
  119.         static Parser newEopC04Parser(
  120.                 final IERSConventions conventions,
  121.                 final ItrfVersionProvider itrfVersionProvider,
  122.                 final TimeScales timeScales) {
  123.             return new EopC04FilesLoader.Parser(conventions.getNutationCorrectionConverter(timeScales),
  124.                                                 timeScales.getUTC());
  125.         }

  126.         /**
  127.          * Create a new parser for EOP data in the Bulletin B format.
  128.          *
  129.          * @param conventions         used to convert between equinox-based and
  130.          *                            non-rotating-origin-based paradigms.
  131.          * @param itrfVersionProvider used to determine the ITRF version of parsed EOP.
  132.          * @param timeScales          used to parse the EOP data.
  133.          * @return a new parser.
  134.          */
  135.         static Parser newBulletinBParser(
  136.                 final IERSConventions conventions,
  137.                 final ItrfVersionProvider itrfVersionProvider,
  138.                 final TimeScales timeScales) {
  139.             return new BulletinBFilesLoader.Parser(
  140.                     conventions.getNutationCorrectionConverter(timeScales),
  141.                     itrfVersionProvider,
  142.                     timeScales.getUTC());
  143.         }


  144.     }

  145. }