1   /* Copyright 2022-2025 Thales Alenia Space
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.models.earth.weather;
18  
19  import java.io.IOException;
20  
21  import org.hipparchus.CalculusFieldElement;
22  import org.orekit.data.DataSource;
23  import org.orekit.time.AbsoluteDate;
24  import org.orekit.time.FieldAbsoluteDate;
25  import org.orekit.time.TimeScales;
26  
27  /** The Global Pressure and Temperature 2 (GPT2) model.
28   * @author Luc Maisonobe
29   * @since 12.1
30   */
31  public class GlobalPressureTemperature2 extends AbstractGlobalPressureTemperature {
32  
33      /** Reference epoch. */
34      private final AbsoluteDate referenceEpoch;
35  
36      /**
37       * Constructor with source of GPT2 auxiliary data given by user.
38       *
39       * @param source grid data source (files with extra columns like GPT2w or GPT3 can be used here)
40       * @param timeScales known time scales
41       * @exception IOException if grid data cannot be read
42       * @since 13.0
43       */
44      public GlobalPressureTemperature2(final DataSource source, final TimeScales timeScales)
45          throws IOException {
46          super(source,
47                SeasonalModelType.PRESSURE,
48                SeasonalModelType.TEMPERATURE,
49                SeasonalModelType.QV,
50                SeasonalModelType.DT,
51                SeasonalModelType.AH,
52                SeasonalModelType.AW);
53          referenceEpoch = timeScales.getJ2000Epoch();
54      }
55  
56      /** {@inheritDoc} */
57      @Override
58      protected double deltaRef(final AbsoluteDate date) {
59          return date.durationFrom(referenceEpoch);
60      }
61  
62      /** {@inheritDoc} */
63      @Override
64      protected <T extends CalculusFieldElement<T>> T deltaRef(final FieldAbsoluteDate<T> date) {
65          return date.durationFrom(referenceEpoch);
66      }
67  
68  }