GlobalPressureTemperature3.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.TimeScale;

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

  32.     /** UTC time scale. */
  33.     private final TimeScale utc;

  34.     /**
  35.      * Constructor with source of GPT3 auxiliary data given by user.
  36.      *
  37.      * @param source grid data source
  38.      * @param utc UTC time scale.
  39.      * @exception IOException if grid data cannot be read
  40.      */
  41.     public GlobalPressureTemperature3(final DataSource source, final TimeScale utc)
  42.         throws IOException {
  43.         super(source,
  44.               SeasonalModelType.PRESSURE,
  45.               SeasonalModelType.TEMPERATURE,
  46.               SeasonalModelType.QV,
  47.               SeasonalModelType.DT,
  48.               SeasonalModelType.AH,
  49.               SeasonalModelType.AW,
  50.               SeasonalModelType.LAMBDA,
  51.               SeasonalModelType.TM,
  52.               SeasonalModelType.GN_H,
  53.               SeasonalModelType.GE_H,
  54.               SeasonalModelType.GN_W,
  55.               SeasonalModelType.GE_W);

  56.         this.utc = utc;

  57.     }

  58.     /** {@inheritDoc} */
  59.     @Override
  60.     protected double deltaRef(final AbsoluteDate date) {
  61.         final AbsoluteDate reference =
  62.             new AbsoluteDate(date.getComponents(utc).getDate().getYear() - 1, 12, 31, utc);
  63.         return date.durationFrom(reference);
  64.     }

  65.     /** {@inheritDoc} */
  66.     @Override
  67.     protected <T extends CalculusFieldElement<T>> T deltaRef(final FieldAbsoluteDate<T> date) {
  68.         final FieldAbsoluteDate<T> reference =
  69.             new FieldAbsoluteDate<>(date.getField(), date.getComponents(utc).getDate().getYear() - 1, 12, 31, utc);
  70.         return date.durationFrom(reference);
  71.     }

  72. }