1   /* Copyright 2002-2024 CS GROUP
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 org.hipparchus.CalculusFieldElement;
20  import org.hipparchus.Field;
21  import org.hipparchus.util.MathArrays;
22  import org.orekit.annotation.DefaultDataContext;
23  import org.orekit.bodies.FieldGeodeticPoint;
24  import org.orekit.bodies.GeodeticPoint;
25  import org.orekit.data.DataContext;
26  import org.orekit.models.earth.weather.FieldPressureTemperatureHumidity;
27  import org.orekit.time.AbsoluteDate;
28  import org.orekit.time.FieldAbsoluteDate;
29  import org.orekit.time.TimeScale;
30  import org.orekit.utils.FieldTrackingCoordinates;
31  import org.orekit.utils.TrackingCoordinates;
32  
33  /** The Vienna3 tropospheric delay model for radio techniques.
34   *  The Vienna model data are given with a time interval of 6 hours.
35   *  <p>
36   *  The empirical coefficients b<sub>h</sub>, b<sub>w</sub>, c<sub>h</sub>
37   *  and c<sub>w</sub> are computed with spherical harmonics.
38   *  In that respect, they are considerably more advanced than those of
39   *  {@link ViennaOneModel VMF1} model.
40   *  </p>
41   *
42   * @see "Landskron, D. & Böhm, J. J Geod (2018)
43   *      VMF3/GPT3: refined discrete and empirical troposphere mapping functions
44   *      92: 349. https://doi.org/10.1007/s00190-017-1066-2"
45   *
46   * @see "Landskron D (2017) Modeling tropospheric delays for space geodetic
47   *      techniques. Dissertation, Department of Geodesy and Geoinformation, TU Wien, Supervisor: J. Böhm.
48   *      http://repositum.tuwien.ac.at/urn:nbn:at:at-ubtuw:1-100249"
49   *
50   * @author Bryan Cazabonne
51   * @deprecated as of 12.1, replaced by {@link ViennaThree}
52   */
53  @Deprecated
54  public class ViennaThreeModel extends ViennaThree implements DiscreteTroposphericModel, MappingFunction {
55  
56      /** Values of hydrostatic and wet delays as provided by the Vienna model. */
57      private final double[] zenithDelay;
58  
59      /** Build a new instance.
60       *
61       * <p>This constructor uses the {@link DataContext#getDefault() default data context}.
62       *
63       * @param coefficientA The a coefficients for the computation of the wet and hydrostatic mapping functions.
64       * @param zenithDelay Values of hydrostatic and wet delays
65       * @see #ViennaThreeModel(double[], double[], TimeScale)
66       */
67      @DefaultDataContext
68      public ViennaThreeModel(final double[] coefficientA, final double[] zenithDelay) {
69          this(coefficientA, zenithDelay,
70               DataContext.getDefault().getTimeScales().getUTC());
71      }
72  
73      /** Build a new instance.
74       * @param coefficientA The a coefficients for the computation of the wet and hydrostatic mapping functions.
75       * @param zenithDelay Values of hydrostatic and wet delays
76       * @param utc UTC time scale.
77       * @since 10.1
78       */
79      public ViennaThreeModel(final double[] coefficientA,
80                              final double[] zenithDelay,
81                              final TimeScale utc) {
82          super(new ConstantViennaAProvider(new ViennaACoefficients(coefficientA[0], coefficientA[1])),
83                new ConstantAzimuthalGradientProvider(null),
84                new ConstantTroposphericModel(new TroposphericDelay(zenithDelay[0], zenithDelay[1],
85                                                                    zenithDelay[0], zenithDelay[1])),
86                utc);
87          this.zenithDelay = zenithDelay.clone();
88      }
89  
90      /** {@inheritDoc} */
91      @Override
92      @Deprecated
93      public double[] mappingFactors(final double elevation, final GeodeticPoint point,
94                                     final AbsoluteDate date) {
95          return mappingFactors(new TrackingCoordinates(0.0, elevation, 0.0), point,
96                                TroposphericModelUtils.STANDARD_ATMOSPHERE,
97                                date);
98      }
99  
100     /** {@inheritDoc} */
101     @Override
102     @Deprecated
103     public <T extends CalculusFieldElement<T>> T[] mappingFactors(final T elevation, final FieldGeodeticPoint<T> point,
104                                                                   final FieldAbsoluteDate<T> date) {
105         return mappingFactors(new FieldTrackingCoordinates<>(date.getField().getZero(), elevation, date.getField().getZero()),
106                               point,
107                               new FieldPressureTemperatureHumidity<>(date.getField(),
108                                                                      TroposphericModelUtils.STANDARD_ATMOSPHERE),
109                               date);
110     }
111 
112     /** {@inheritDoc} */
113     @Override
114     @Deprecated
115     public double pathDelay(final double elevation, final GeodeticPoint point,
116                             final double[] parameters, final AbsoluteDate date) {
117         return pathDelay(new TrackingCoordinates(0.0, elevation, 0.0), point,
118                          TroposphericModelUtils.STANDARD_ATMOSPHERE, parameters, date).
119                getDelay();
120     }
121 
122     /** {@inheritDoc} */
123     @Override
124     @Deprecated
125     public <T extends CalculusFieldElement<T>> T pathDelay(final T elevation, final FieldGeodeticPoint<T> point,
126                                                            final T[] parameters, final FieldAbsoluteDate<T> date) {
127         return pathDelay(new FieldTrackingCoordinates<>(date.getField().getZero(), elevation, date.getField().getZero()),
128                          point,
129                          new FieldPressureTemperatureHumidity<>(date.getField(), TroposphericModelUtils.STANDARD_ATMOSPHERE),
130                          parameters, date).
131                getDelay();
132     }
133 
134     /** This method allows the  computation of the zenith hydrostatic and
135      * zenith wet delay. The resulting element is an array having the following form:
136      * <ul>
137      * <li>T[0] = D<sub>hz</sub> → zenith hydrostatic delay
138      * <li>T[1] = D<sub>wz</sub> → zenith wet delay
139      * </ul>
140      * @param point station location
141      * @param parameters tropospheric model parameters
142      * @param date current date
143      * @return a two components array containing the zenith hydrostatic and wet delays.
144      */
145     public double[] computeZenithDelay(final GeodeticPoint point, final double[] parameters, final AbsoluteDate date) {
146         return zenithDelay.clone();
147     }
148 
149     /** This method allows the  computation of the zenith hydrostatic and
150      * zenith wet delay. The resulting element is an array having the following form:
151      * <ul>
152      * <li>T[0] = D<sub>hz</sub> → zenith hydrostatic delay
153      * <li>T[1] = D<sub>wz</sub> → zenith wet delay
154      * </ul>
155      * @param <T> type of the elements
156      * @param point station location
157      * @param parameters tropospheric model parameters
158      * @param date current date
159      * @return a two components array containing the zenith hydrostatic and wet delays.
160      */
161     public <T extends CalculusFieldElement<T>> T[] computeZenithDelay(final FieldGeodeticPoint<T> point, final T[] parameters,
162                                                                   final FieldAbsoluteDate<T> date) {
163         final Field<T> field = date.getField();
164         final T zero = field.getZero();
165         final T[] delays = MathArrays.buildArray(field, 2);
166         delays[0] = zero.newInstance(zenithDelay[0]);
167         delays[1] = zero.newInstance(zenithDelay[1]);
168         return delays;
169     }
170 
171 }