1   /* Copyright 2002-2024 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.orekit.data.DataProvidersManager;
22  import org.orekit.data.DataSource;
23  import org.orekit.time.TimeScale;
24  
25  /** The Global Pressure and Temperature 2 (GPT2) model.
26   * @author Luc Maisonobe
27   * @since 12.1
28   */
29  public class GlobalPressureTemperature2 extends AbstractGlobalPressureTemperature {
30  
31      /**
32       * Constructor with source of GPT2 auxiliary data given by user.
33       *
34       * @param source grid data source (files with extra columns like GPT2w or GPT3 can be used here)
35       * @param utc UTC time scale.
36       * @exception IOException if grid data cannot be read
37       */
38      public GlobalPressureTemperature2(final DataSource source, final TimeScale utc)
39          throws IOException {
40          super(source, utc,
41                SeasonalModelType.PRESSURE,
42                SeasonalModelType.TEMPERATURE,
43                SeasonalModelType.QV,
44                SeasonalModelType.DT,
45                SeasonalModelType.AH,
46                SeasonalModelType.AW);
47      }
48  
49      /**
50       * Constructor with supported names and source of GPT2 auxiliary data given by user.
51       *
52       * @param supportedNames supported names (files with extra columns like GPT2w or GPT3 can be used here)
53       * @param dataProvidersManager provides access to auxiliary data.
54       * @param utc UTC time scale.
55       * @deprecated as of 12.1 used only by {@link GlobalPressureTemperature2Model}
56       */
57      @Deprecated
58      protected GlobalPressureTemperature2(final String supportedNames,
59                                           final DataProvidersManager dataProvidersManager,
60                                           final TimeScale utc) {
61          super(buildGrid(supportedNames, dataProvidersManager), utc);
62      }
63  
64      /** Builder for grid provided as supported names and source of GPT2 auxiliary data given by user.
65       *
66       * @param supportedNames supported names (files with extra columns like GPT2w or GPT3 can be used here)
67       * @param dataProvidersManager provides access to auxiliary data.
68       * @return built grid
69       * @deprecated as of 12.1 used only by {@link GlobalPressureTemperature2Model}
70       */
71      @Deprecated
72      private static Grid buildGrid(final String supportedNames,
73                                    final DataProvidersManager dataProvidersManager) {
74          final GptNParser parser = new GptNParser(SeasonalModelType.PRESSURE,
75                                                   SeasonalModelType.TEMPERATURE,
76                                                   SeasonalModelType.QV,
77                                                   SeasonalModelType.DT,
78                                                   SeasonalModelType.AH,
79                                                   SeasonalModelType.AW);
80          dataProvidersManager.feed(supportedNames, parser);
81          return parser.getGrid();
82      }
83  
84  }