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.troposphere;
18  
19  import java.util.List;
20  
21  import org.hipparchus.CalculusFieldElement;
22  import org.hipparchus.util.MathUtils;
23  import org.orekit.bodies.FieldGeodeticPoint;
24  import org.orekit.bodies.GeodeticPoint;
25  import org.orekit.models.earth.weather.FieldPressureTemperatureHumidity;
26  import org.orekit.models.earth.weather.PressureTemperatureHumidity;
27  import org.orekit.time.AbsoluteDate;
28  import org.orekit.time.FieldAbsoluteDate;
29  import org.orekit.utils.FieldTrackingCoordinates;
30  import org.orekit.utils.ParameterDriver;
31  import org.orekit.utils.TrackingCoordinates;
32  
33  /** Adapter between {@link DiscreteTroposphericModel} and {@link TroposphericModel}.
34   * <p>
35   * This class is a temporary adapter, it will be removed when
36   * {@link DiscreteTroposphericModel} is removed.
37   * </p>
38   * @author Luc Maisonobe
39   * @since 12.1
40   * @deprecated temporary adapter to be removed when {@link DiscreteTroposphericModel} is removed
41   */
42  @Deprecated
43  public class TroposphericModelAdapter implements TroposphericModel {
44  
45      /** Underlying model. */
46      private final DiscreteTroposphericModel model;
47  
48      /** Simple constructor.
49       * @param model underlying model
50       */
51      public TroposphericModelAdapter(final DiscreteTroposphericModel model) {
52          this.model = model;
53      }
54  
55      /** {@inheritDoc}
56       * <p>
57       * All delays are affected to {@link TroposphericDelay#getZh() hydrostatic zenith}
58       * and {@link TroposphericDelay#getSh() hydrostatic slanted} delays, the wet delays
59       * are arbitrarily set to 0.
60       * </p>
61       */
62      @Override
63      public TroposphericDelay pathDelay(final TrackingCoordinates trackingCoordinates,
64                                         final GeodeticPoint point,
65                                         final PressureTemperatureHumidity weather,
66                                         final double[] parameters,
67                                         final AbsoluteDate date) {
68          return new TroposphericDelay(model.pathDelay(MathUtils.SEMI_PI,
69                                                       point, parameters, date),
70                                       0.0,
71                                       model.pathDelay(trackingCoordinates.getElevation(),
72                                                       point, parameters, date),
73                                       0.0);
74      }
75  
76      /** {@inheritDoc}
77       * <p>
78       * All delays are affected to {@link FieldTroposphericDelay#getZh() hydrostatic zenith}
79       * and {@link FieldTroposphericDelay#getSh() hydrostatic slanted} delays, the wet delays
80       * are arbitrarily set to 0.
81       * </p>
82       */
83      @Override
84      public <T extends CalculusFieldElement<T>> FieldTroposphericDelay<T> pathDelay(final FieldTrackingCoordinates<T> trackingCoordinates,
85                                                                                     final FieldGeodeticPoint<T> point,
86                                                                                     final FieldPressureTemperatureHumidity<T> weather,
87                                                                                     final T[] parameters,
88                                                                                     final FieldAbsoluteDate<T> date) {
89          return new FieldTroposphericDelay<>(model.pathDelay(date.getField().getZero().newInstance(MathUtils.SEMI_PI),
90                                                              point, parameters, date),
91                                              date.getField().getZero(),
92                                              model.pathDelay(trackingCoordinates.getElevation(),
93                                                              point, parameters, date),
94                                              date.getField().getZero());
95      }
96  
97      /** {@inheritDoc} */
98      @Override
99      public List<ParameterDriver> getParametersDrivers() {
100         return model.getParametersDrivers();
101     }
102 
103 }