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 GlobalMappingFunctionModelTest {
32
33 @BeforeClass
34 public static void setUpGlobal() {
35 Utils.setDataRoot("atmosphere");
36 }
37
38 @Before
39 public void setUp() throws OrekitException {
40 Utils.setDataRoot("regular-data:potential/shm-format");
41 }
42
43 @Test
44 public void testMappingFactors() {
45
46
47
48
49
50
51
52
53
54
55
56
57
58 final AbsoluteDate date = AbsoluteDate.createMJDDate(55055, 0, TimeScalesFactory.getUTC());
59
60 final double latitude = 0.6708665767;
61 final double longitude = -1.393397187;
62 final double height = 844.715;
63 final GeodeticPoint point = new GeodeticPoint(latitude, longitude, height);
64
65 final double elevation = 0.5 * FastMath.PI - 1.278564131;
66 final double expectedHydro = 3.425246;
67 final double expectedWet = 3.449589;
68
69 final MappingFunction model = new GlobalMappingFunctionModel();
70
71 final double[] computedMapping = model.mappingFactors(elevation, point, date);
72
73 Assert.assertEquals(expectedHydro, computedMapping[0], 1.0e-6);
74 Assert.assertEquals(expectedWet, computedMapping[1], 1.0e-6);
75 }
76
77 @Test
78 public void testFixedHeight() {
79 final AbsoluteDate date = new AbsoluteDate();
80 MappingFunction model = new GlobalMappingFunctionModel();
81 double[] lastFactors = new double[] {
82 Double.MAX_VALUE,
83 Double.MAX_VALUE
84 };
85 GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(45.0), FastMath.toRadians(45.0), 350.0);
86
87 for (double elev = 10d; elev < 90d; elev += 8d) {
88 final double[] factors = model.mappingFactors(FastMath.toRadians(elev), point, date);
89 Assert.assertTrue(Precision.compareTo(factors[0], lastFactors[0], 1.0e-6) < 0);
90 Assert.assertTrue(Precision.compareTo(factors[1], lastFactors[1], 1.0e-6) < 0);
91 lastFactors[0] = factors[0];
92 lastFactors[1] = factors[1];
93 }
94 }
95
96 }