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 NiellMappingFunctionModelTest {
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 final AbsoluteDate date = new AbsoluteDate(1994, 1, 1, TimeScalesFactory.getUTC());
58
59 final double latitude = FastMath.toRadians(48.0);
60 final double longitude = FastMath.toRadians(0.20);
61 final double height = 68.0;
62 final GeodeticPoint point = new GeodeticPoint(latitude, longitude, height);
63
64 final double elevation = FastMath.toRadians(5.0);
65 final double expectedHydro = 10.16;
66 final double expectedWet = 10.75;
67
68 final MappingFunction model = new NiellMappingFunctionModel();
69
70 final double[] computedMapping = model.mappingFactors(elevation, point, date);
71
72 Assert.assertEquals(expectedHydro, computedMapping[0], 1.0e-2);
73 Assert.assertEquals(expectedWet, computedMapping[1], 1.0e-2);
74 }
75
76 @Test
77 public void testFixedHeight() {
78 final AbsoluteDate date = new AbsoluteDate();
79 final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(45.0), FastMath.toRadians(45.0), 350.0);
80 MappingFunction model = new NiellMappingFunctionModel();
81 double[] lastFactors = new double[] {
82 Double.MAX_VALUE,
83 Double.MAX_VALUE
84 };
85
86 for (double elev = 10d; elev < 90d; elev += 8d) {
87 final double[] factors = model.mappingFactors(FastMath.toRadians(elev), point, date);
88 Assert.assertTrue(Precision.compareTo(factors[0], lastFactors[0], 1.0e-6) < 0);
89 Assert.assertTrue(Precision.compareTo(factors[1], lastFactors[1], 1.0e-6) < 0);
90 lastFactors[0] = factors[0];
91 lastFactors[1] = factors[1];
92 }
93 }
94
95 }