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 2w (GPT2w) model.
28 * <p>
29 * This model adds humidity data to {@link GlobalPressureTemperature2 GPT2}.
30 * </p>
31 * @author Luc Maisonobe
32 * @since 12.1
33 */
34 public class GlobalPressureTemperature2w extends AbstractGlobalPressureTemperature {
35
36 /** Reference epoch. */
37 private final AbsoluteDate referenceEpoch;
38
39 /**
40 * Constructor with supported names and source of GPT2w auxiliary data given by user.
41 *
42 * @param source grid data source (files with extra columns like GPT3 can be used here)
43 * @param timeScales known time scales
44 * @exception IOException if grid data cannot be read
45 * @since 13.0
46 */
47 public GlobalPressureTemperature2w(final DataSource source, final TimeScales timeScales)
48 throws IOException {
49 super(source,
50 SeasonalModelType.PRESSURE,
51 SeasonalModelType.TEMPERATURE,
52 SeasonalModelType.QV,
53 SeasonalModelType.DT,
54 SeasonalModelType.AH,
55 SeasonalModelType.AW,
56 SeasonalModelType.LAMBDA,
57 SeasonalModelType.TM);
58 referenceEpoch = timeScales.getJ2000Epoch();
59 }
60
61 /** {@inheritDoc} */
62 @Override
63 protected double deltaRef(final AbsoluteDate date) {
64 return date.durationFrom(referenceEpoch);
65 }
66
67 /** {@inheritDoc} */
68 @Override
69 protected <T extends CalculusFieldElement<T>> T deltaRef(final FieldAbsoluteDate<T> date) {
70 return date.durationFrom(referenceEpoch);
71 }
72
73 }