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 Vienna1 tropospheric delay model for radio techniques.
34   * The Vienna model data are given with a time interval of 6 hours
35   * as well as on a global 2.5° * 2.0° grid.
36   *
37   * This version considered the height correction for the hydrostatic part
38   * developed by Niell, 1996.
39   *
40   * @see "Boehm, J., Werl, B., and Schuh, H., (2006),
41   *       Troposhere mapping functions for GPS and very long baseline
42   *       interferometry from European Centre for Medium-Range Weather
43   *       Forecasts operational analysis data, J. Geophy. Res., Vol. 111,
44   *       B02406, doi:10.1029/2005JB003629"
45   *
46   * @author Bryan Cazabonne
47   * @deprecated as of 12.1, replaced by {@link ViennaOne}
48   */
49  @Deprecated
50  public class ViennaOneModel extends ViennaOne implements DiscreteTroposphericModel, MappingFunction {
51  
52      /** Values of hydrostatic and wet delays as provided by the Vienna model. */
53      private final double[] zenithDelay;
54  
55      /** Build a new instance.
56       *
57       * <p>This constructor uses the {@link DataContext#getDefault() default data context}.
58       *
59       * @param coefficientA The a coefficients for the computation of the wet and hydrostatic mapping functions.
60       * @param zenithDelay Values of hydrostatic and wet delays
61       * @see #ViennaOneModel(double[], double[], TimeScale)
62       */
63      @DefaultDataContext
64      public ViennaOneModel(final double[] coefficientA, final double[] zenithDelay) {
65          this(coefficientA, zenithDelay,
66               DataContext.getDefault().getTimeScales().getUTC());
67      }
68  
69      /**
70       * Build a new instance.
71       *
72       * @param coefficientA The a coefficients for the computation of the wet and
73       *                     hydrostatic mapping functions.
74       * @param zenithDelay  Values of hydrostatic and wet delays
75       * @param utc          UTC time scale.
76       * @since 10.1
77       */
78      public ViennaOneModel(final double[] coefficientA,
79                            final double[] zenithDelay,
80                            final TimeScale utc) {
81          super(new ConstantViennaAProvider(new ViennaACoefficients(coefficientA[0], coefficientA[1])),
82                new ConstantAzimuthalGradientProvider(null),
83                new ConstantTroposphericModel(new TroposphericDelay(zenithDelay[0], zenithDelay[1],
84                                                                    zenithDelay[0], zenithDelay[1])),
85                utc);
86          this.zenithDelay = zenithDelay.clone();
87      }
88  
89      /** {@inheritDoc} */
90      @Override
91      @Deprecated
92      public double pathDelay(final double elevation, final GeodeticPoint point,
93                              final double[] parameters, final AbsoluteDate date) {
94          return pathDelay(new TrackingCoordinates(0.0, elevation, 0.0),
95                           point, TroposphericModelUtils.STANDARD_ATMOSPHERE, parameters, date).
96                 getDelay();
97      }
98  
99      /** {@inheritDoc} */
100     @Override
101     @Deprecated
102     public <T extends CalculusFieldElement<T>> T pathDelay(final T elevation, final FieldGeodeticPoint<T> point,
103                                                            final T[] parameters, final FieldAbsoluteDate<T> date) {
104         return pathDelay(new FieldTrackingCoordinates<>(date.getField().getZero(), elevation, date.getField().getZero()),
105                          point,
106                          new FieldPressureTemperatureHumidity<>(date.getField(), TroposphericModelUtils.STANDARD_ATMOSPHERE),
107                          parameters, date).
108                getDelay();
109     }
110 
111     /** This method allows the  computation of the zenith hydrostatic and
112      * zenith wet delay. The resulting element is an array having the following form:
113      * <ul>
114      * <li>T[0] = D<sub>hz</sub> → zenith hydrostatic delay
115      * <li>T[1] = D<sub>wz</sub> → zenith wet delay
116      * </ul>
117      * @param point station location
118      * @param parameters tropospheric model parameters
119      * @param date current date
120      * @return a two components array containing the zenith hydrostatic and wet delays.
121      */
122     public double[] computeZenithDelay(final GeodeticPoint point, final double[] parameters, final AbsoluteDate date) {
123         return zenithDelay.clone();
124     }
125 
126     /** This method allows the  computation of the zenith hydrostatic and
127      * zenith wet delay. The resulting element is an array having the following form:
128      * <ul>
129      * <li>T[0] = D<sub>hz</sub> → zenith hydrostatic delay
130      * <li>T[1] = D<sub>wz</sub> → zenith wet delay
131      * </ul>
132      * @param <T> type of the elements
133      * @param point station location
134      * @param parameters tropospheric model parameters
135      * @param date current date
136      * @return a two components array containing the zenith hydrostatic and wet delays.
137      */
138     public <T extends CalculusFieldElement<T>> T[] computeZenithDelay(final FieldGeodeticPoint<T> point, final T[] parameters,
139                                                                       final FieldAbsoluteDate<T> date) {
140         final Field<T> field = date.getField();
141         final T zero = field.getZero();
142         final T[] delays = MathArrays.buildArray(field, 2);
143         delays[0] = zero.newInstance(zenithDelay[0]);
144         delays[1] = zero.newInstance(zenithDelay[1]);
145         return delays;
146     }
147 
148     /** {@inheritDoc} */
149     @Override
150     @Deprecated
151     public double[] mappingFactors(final double elevation, final GeodeticPoint point,
152                                    final AbsoluteDate date) {
153         return mappingFactors(new TrackingCoordinates(0.0, elevation, 0.0),
154                               point,
155                               TroposphericModelUtils.STANDARD_ATMOSPHERE,
156                               date);
157     }
158 
159     /** {@inheritDoc} */
160     @Override
161     @Deprecated
162     public <T extends CalculusFieldElement<T>> T[] mappingFactors(final T elevation, final FieldGeodeticPoint<T> point,
163                                                                   final FieldAbsoluteDate<T> date) {
164         return mappingFactors(new FieldTrackingCoordinates<>(date.getField().getZero(), elevation, date.getField().getZero()),
165                               point,
166                               new FieldPressureTemperatureHumidity<>(date.getField(),
167                                                                      TroposphericModelUtils.STANDARD_ATMOSPHERE),
168                               date);
169     }
170 
171 }