1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.models.earth.troposphere;
18
19 import org.hipparchus.util.FastMath;
20 import org.hipparchus.util.Precision;
21 import org.junit.Assert;
22 import org.junit.Before;
23 import org.junit.BeforeClass;
24 import org.junit.Test;
25 import org.orekit.Utils;
26 import org.orekit.bodies.GeodeticPoint;
27 import org.orekit.errors.OrekitException;
28 import org.orekit.time.AbsoluteDate;
29 import org.orekit.time.TimeScalesFactory;
30
31 public class ViennaThreeModelTest {
32
33 private static double epsilon = 1e-6;
34
35 @BeforeClass
36 public static void setUpGlobal() {
37 Utils.setDataRoot("atmosphere");
38 }
39
40 @Before
41 public void setUp() throws OrekitException {
42 Utils.setDataRoot("regular-data:potential/shm-format");
43 }
44
45 @Test
46 public void testMappingFactors() {
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 final AbsoluteDate date = new AbsoluteDate(2018, 11, 25, TimeScalesFactory.getUTC());
69
70 final double latitude = FastMath.toRadians(37.5);
71 final double longitude = FastMath.toRadians(277.5);
72 final double height = 824.0;
73 final GeodeticPoint point = new GeodeticPoint(latitude, longitude, height);
74
75 final double elevation = FastMath.toRadians(38.0);
76 final double expectedHydro = 1.621024;
77 final double expectedWet = 1.623023;
78
79 final double[] a = {0.00123462, 0.00047101};
80 final double[] z = {2.1993, 0.0690};
81
82 final ViennaThreeModel model = new ViennaThreeModel(a, z);
83
84 final double[] computedMapping = model.mappingFactors(elevation, point, date);
85
86 Assert.assertEquals(expectedHydro, computedMapping[0], epsilon);
87 Assert.assertEquals(expectedWet, computedMapping[1], epsilon);
88 }
89
90 @Test
91 public void testLowElevation() {
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113 final AbsoluteDate date = new AbsoluteDate(2018, 11, 25, TimeScalesFactory.getUTC());
114
115 final double latitude = FastMath.toRadians(37.5);
116 final double longitude = FastMath.toRadians(277.5);
117 final double height = 824.0;
118 final GeodeticPoint point = new GeodeticPoint(latitude, longitude, height);
119
120 final double elevation = FastMath.toRadians(5.0);
121 final double expectedHydro = 10.132802;
122 final double expectedWet = 10.879154;
123
124 final double[] a = {0.00123462, 0.00047101};
125 final double[] z = {2.1993, 0.0690};
126
127 final ViennaThreeModel model = new ViennaThreeModel(a, z);
128
129 final double[] computedMapping = model.mappingFactors(elevation, point, date);
130
131 Assert.assertEquals(expectedHydro, computedMapping[0], epsilon);
132 Assert.assertEquals(expectedWet, computedMapping[1], epsilon);
133 }
134
135 @Test
136 public void testHightElevation() {
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158 final AbsoluteDate date = new AbsoluteDate(2018, 11, 25, TimeScalesFactory.getUTC());
159
160 final double latitude = FastMath.toRadians(37.5);
161 final double longitude = FastMath.toRadians(277.5);
162 final double height = 824.0;
163 final GeodeticPoint point = new GeodeticPoint(latitude, longitude, height);
164
165 final double elevation = FastMath.toRadians(85.0);
166 final double expectedHydro = 1.003810;
167 final double expectedWet = 1.003816;
168
169 final double[] a = {0.00123462, 0.00047101};
170 final double[] z = {2.1993, 0.0690};
171
172 final ViennaThreeModel model = new ViennaThreeModel(a, z);
173
174 final double[] computedMapping = model.mappingFactors(elevation, point, date);
175
176 Assert.assertEquals(expectedHydro, computedMapping[0], epsilon);
177 Assert.assertEquals(expectedWet, computedMapping[1], epsilon);
178 }
179
180 @Test
181 public void testDelay() {
182 final double elevation = 10d;
183 final double height = 100d;
184 final AbsoluteDate date = new AbsoluteDate();
185 final double[] a = { 0.00123462, 0.00047101};
186 final double[] z = {2.1993, 0.0690};
187 final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(37.5), FastMath.toRadians(277.5), height);
188 ViennaThreeModel model = new ViennaThreeModel(a, z);
189 final double path = model.pathDelay(FastMath.toRadians(elevation), point, model.getParameters(), date);
190 Assert.assertTrue(Precision.compareTo(path, 20d, epsilon) < 0);
191 Assert.assertTrue(Precision.compareTo(path, 0d, epsilon) > 0);
192 }
193
194 @Test
195 public void testFixedHeight() {
196 final AbsoluteDate date = new AbsoluteDate();
197 final double[] a = { 0.00123462, 0.00047101};
198 final double[] z = {2.1993, 0.0690};
199 final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(37.5), FastMath.toRadians(277.5), 350.0);
200 ViennaThreeModel model = new ViennaThreeModel(a, z);
201 double lastDelay = Double.MAX_VALUE;
202
203 for (double elev = 10d; elev < 90d; elev += 8d) {
204 final double delay = model.pathDelay(FastMath.toRadians(elev), point, model.getParameters(), date);
205 Assert.assertTrue(Precision.compareTo(delay, lastDelay, epsilon) < 0);
206 lastDelay = delay;
207 }
208 }
209
210 }