GlobalPressureTemperature2w.java

  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. import java.io.IOException;

  19. import org.hipparchus.CalculusFieldElement;
  20. import org.orekit.data.DataSource;
  21. import org.orekit.time.AbsoluteDate;
  22. import org.orekit.time.FieldAbsoluteDate;
  23. import org.orekit.time.TimeScales;

  24. /** The Global Pressure and Temperature 2w (GPT2w) model.
  25.  * <p>
  26.  * This model adds humidity data to {@link GlobalPressureTemperature2 GPT2}.
  27.  * </p>
  28.  * @author Luc Maisonobe
  29.  * @since 12.1
  30.  */
  31. public class GlobalPressureTemperature2w extends AbstractGlobalPressureTemperature {

  32.     /** Reference epoch. */
  33.     private final AbsoluteDate referenceEpoch;

  34.     /**
  35.      * Constructor with supported names and source of GPT2w auxiliary data given by user.
  36.      *
  37.      * @param source grid data source (files with extra columns like GPT3 can be used here)
  38.      * @param timeScales known time scales
  39.      * @exception IOException if grid data cannot be read
  40.      * @since 13.0
  41.      */
  42.     public GlobalPressureTemperature2w(final DataSource source, final TimeScales timeScales)
  43.         throws IOException {
  44.         super(source,
  45.               SeasonalModelType.PRESSURE,
  46.               SeasonalModelType.TEMPERATURE,
  47.               SeasonalModelType.QV,
  48.               SeasonalModelType.DT,
  49.               SeasonalModelType.AH,
  50.               SeasonalModelType.AW,
  51.               SeasonalModelType.LAMBDA,
  52.               SeasonalModelType.TM);
  53.         referenceEpoch = timeScales.getJ2000Epoch();
  54.     }

  55.     /** {@inheritDoc} */
  56.     @Override
  57.     protected double deltaRef(final AbsoluteDate date) {
  58.         return date.durationFrom(referenceEpoch);
  59.     }

  60.     /** {@inheritDoc} */
  61.     @Override
  62.     protected <T extends CalculusFieldElement<T>> T deltaRef(final FieldAbsoluteDate<T> date) {
  63.         return date.durationFrom(referenceEpoch);
  64.     }

  65. }