1   /* Copyright 2002-2025 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.util.FastMath;
20  import org.junit.jupiter.api.Test;
21  import org.orekit.bodies.GeodeticPoint;
22  import org.orekit.time.AbsoluteDate;
23  import org.orekit.time.TimeScalesFactory;
24  import org.orekit.utils.TrackingCoordinates;
25  
26  public class ViennaThreeMappingFunctionTest extends AbstractMappingFunctionTest<ViennaThree> {
27  
28      protected ViennaThree buildMappingFunction() {
29          return new ViennaThree(new ConstantViennaAProvider(new ViennaACoefficients(0.00123462, 0.00047101)),
30                                 new ConstantAzimuthalGradientProvider(null),
31                                 new ConstantTroposphericModel(new TroposphericDelay(2.1993, 0.0690, 0, 0)),
32                                 TimeScalesFactory.getUTC());
33      }
34  
35      @Test
36      public void testMappingFactors() {
37  
38          // Site:     latitude:  37.5°
39          //           longitude: 277.5°
40          //           height:    824 m
41          //
42          // Date:     25 November 2018 at 12h UT
43          //
44          // Values: ah  = 0.00123462
45          //         aw  = 0.00047101
46          //         zhd = 2.1993 m
47          //         zwd = 0.0690 m
48          //
49          // Values taken from: http://vmf.geo.tuwien.ac.at/trop_products/GRID/5x5/VMF3/VMF3_OP/2018/VMF3_20181125.H00
50          //
51          // Expected mapping factors : hydrostatic -> 1.621024
52          //                                    wet -> 1.623023
53          //
54          // Expected outputs are obtained by performing the Matlab script vmf3.m provided by TU WIEN:
55          // http://vmf.geo.tuwien.ac.at/codes/
56          //
57          doTestMappingFactors(new AbsoluteDate(2018, 11, 25, 12, 0, 0, TimeScalesFactory.getUTC()),
58                               new GeodeticPoint(FastMath.toRadians(37.5), FastMath.toRadians(277.5), 824.0),
59                               new TrackingCoordinates(0.0, FastMath.toRadians(38.0), 0.0),
60                               1.621024, 1.623023);
61      }
62  
63      @Test
64      public void testLowElevation() {
65  
66          // Site:     latitude:  37.5°
67          //           longitude: 277.5°
68          //           height:    824 m
69          //
70          // Date:     25 November 2018 at 12h UT
71          //
72          // Values: ah  = 0.00123462
73          //         aw  = 0.00047101
74          //         zhd = 2.1993 m
75          //         zwd = 0.0690 m
76          //
77          // Values taken from: http://vmf.geo.tuwien.ac.at/trop_products/GRID/5x5/VMF3/VMF3_OP/2018/VMF3_20181125.H00
78          //
79          // Expected mapping factors : hydrostatic -> 10.132802
80          //                                    wet -> 10.879154
81          //
82          // Expected outputs are obtained by performing the Matlab script vmf3.m provided by TU WIEN:
83          // http://vmf.geo.tuwien.ac.at/codes/
84          //
85          doTestMappingFactors(new AbsoluteDate(2018, 11, 25, 12, 0, 0, TimeScalesFactory.getUTC()),
86                               new GeodeticPoint(FastMath.toRadians(37.5), FastMath.toRadians(277.5), 824.0),
87                               new TrackingCoordinates(0.0, FastMath.toRadians(5.0), 0.0),
88                               10.132802, 10.879154);
89      }
90  
91      @Test
92      public void testHightElevation() {
93  
94          // Site:     latitude:  37.5°
95          //           longitude: 277.5°
96          //           height:    824 m
97          //
98          // Date:     25 November 2018 at 0h UT
99          //
100         // Values: ah  = 0.00123462
101         //         aw  = 0.00047101
102         //         zhd = 2.1993 m
103         //         zwd = 0.0690 m
104         //
105         // Values taken from: http://vmf.geo.tuwien.ac.at/trop_products/GRID/5x5/VMF3/VMF3_OP/2018/VMF3_20181125.H00
106         //
107         // Expected mapping factors : hydrostatic -> 1.003810
108         //                                    wet -> 1.003816
109         //
110         // Expected outputs are obtained by performing the Matlab script vmf3.m provided by TU WIEN:
111         // http://vmf.geo.tuwien.ac.at/codes/
112         //
113         doTestMappingFactors(new AbsoluteDate(2018, 11, 25, 12, 0, 0, TimeScalesFactory.getUTC()),
114                              new GeodeticPoint(FastMath.toRadians(37.5), FastMath.toRadians(277.5), 824.0),
115                              new TrackingCoordinates(0.0, FastMath.toRadians(85.0), 0.0),
116                              1.003810, 1.003816);
117     }
118 
119     @Test
120     @Override
121     public void testDerivatives() {
122         doTestDerivatives(5.0e-16, 1.0e-18, 1.0e-100, 3.0e-8, 1.0e-100);
123     }
124 
125 }