EOPFitter.java

  1. /* Copyright 2022-2025 Luc Maisonobe
  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.Serializable;

  19. /** Earth Orientation Parameters fitter for {@link PredictedEOPHistory EOP prediction}.
  20.  * @see PredictedEOPHistory
  21.  * @see SingleParameterFitter
  22.  * @since 12.0
  23.  * @author Luc Maisonobe
  24.  */
  25. public class EOPFitter implements Serializable {

  26.     /** Serializable UID. */
  27.     private static final long serialVersionUID = 20230309L;

  28.     /** Fitter for dut1 and LOD. */
  29.     private final SingleParameterFitter dut1Fitter;

  30.     /** Fitter for pole x component. */
  31.     private final SingleParameterFitter xPFitter;

  32.     /** Fitter for pole y component. */
  33.     private final SingleParameterFitter yPFitter;

  34.     /** Fitter for nutation x component. */
  35.     private final SingleParameterFitter dxFitter;

  36.     /** Fitter for nutation y component. */
  37.     private final SingleParameterFitter dyFitter;

  38.     /** Simple constructor.
  39.      * @param dut1Fitter fitter for dut1 and LOD
  40.      * @param xPFitter fitter for pole x component
  41.      * @param yPFitter fitter for pole y component
  42.      * @param dxFitter fitter for nutation x component
  43.      * @param dyFitter fitter for nutation y component
  44.      */
  45.     public EOPFitter(final SingleParameterFitter dut1Fitter,
  46.                      final SingleParameterFitter xPFitter, final SingleParameterFitter yPFitter,
  47.                      final SingleParameterFitter dxFitter, final SingleParameterFitter dyFitter) {
  48.         this.dut1Fitter = dut1Fitter;
  49.         this.xPFitter   = xPFitter;
  50.         this.yPFitter   = yPFitter;
  51.         this.dxFitter   = dxFitter;
  52.         this.dyFitter   = dyFitter;
  53.     }

  54.     /** Fit raw history.
  55.      * @param rawHistory raw EOP history to fit.
  56.      * @return fitted model
  57.      */
  58.     public EOPFittedModel fit(final EOPHistory rawHistory) {
  59.         return new EOPFittedModel(dut1Fitter.fit(rawHistory, EOPEntry::getUT1MinusUTC),
  60.                                   xPFitter.fit(rawHistory, EOPEntry::getX),
  61.                                   yPFitter.fit(rawHistory, EOPEntry::getY),
  62.                                   dxFitter.fit(rawHistory, EOPEntry::getDx),
  63.                                   dyFitter.fit(rawHistory, EOPEntry::getDy));
  64.     }

  65. }