1 package org.orekit.models.earth;
2
3 import org.hipparchus.util.FastMath;
4 import org.junit.Assert;
5 import org.junit.Before;
6 import org.junit.Test;
7 import org.orekit.Utils;
8 import org.orekit.bodies.GeodeticPoint;
9 import org.orekit.bodies.OneAxisEllipsoid;
10 import org.orekit.frames.FramesFactory;
11 import org.orekit.frames.TopocentricFrame;
12 import org.orekit.utils.Constants;
13 import org.orekit.utils.IERSConventions;
14
15 public class EarthITU453AtmosphereRefractionTest {
16
17 private final double onehundredth = 1e-2;
18 private final double twohundredth = 2e-2;
19 private final double onethousandth = 1e-3;
20 private final double epsilon = 1e-15;
21
22
23
24
25 private final double[] ref_elevation = new double[] {0.00, 0.25, 0.50, 0.75, 1.00, 1.25, 1.50, 1.75, 2.00, 2.25, 2.50, 2.75, 3.00, 4.50, 5.00,
26 6.00, 7.00, 8.00, 9.00, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
27 25.0, 30.0, 35.0, 50.0, 55.0, 60.0, 65.0, 70.0, 80.0, 90.0};
28
29 private final double[] ref_refraction = new double[] {34.5, 31.4, 28.7, 26.4, 24.3, 22.5, 20.9, 19.5, 18.3, 17.2, 16.1, 15.2, 14.4, 10.7, 9.90,
30 8.50, 7.40, 6.60, 5.90, 5.30, 4.90, 4.50, 4.10, 3.80, 3.60, 3.30, 3.10, 2.90, 2.80, 2.60,
31 2.10, 1.70, 1.40, 0.80, 0.70, 0.60, 0.50, 0.40, 0.20, 0.00};
32
33
34
35 private TopocentricFrame stationk;
36 private String namek = "Kiruna-2";
37
38
39 private TopocentricFrame stationh;
40 private String nameh = "Hartebeesthoek";
41
42 private TopocentricFrame statione;
43 private String namee = "Everest";
44
45 private TopocentricFrame stationd;
46 private String named = "Dead Sea";
47
48 private TopocentricFrame stationa;
49 private String namea = "Alt0";
50
51 @Before
52 public void setUp() throws Exception {
53 Utils.setDataRoot("regular-data:potential:tides");
54 IERSConventions conventions = IERSConventions.IERS_2010;
55 OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
56 Constants.WGS84_EARTH_FLATTENING,
57 FramesFactory.getITRF(conventions, true));
58
59
60 final GeodeticPoint kir = new GeodeticPoint(FastMath.toRadians(67.858428),
61 FastMath.toRadians(20.966880),
62 385.8);
63
64
65 final GeodeticPoint har = new GeodeticPoint(FastMath.toRadians(-24.110243),
66 FastMath.toRadians(27.685308),
67 1415.821);
68
69
70 final GeodeticPoint eve = new GeodeticPoint(FastMath.toRadians(27.988333),
71 FastMath.toRadians(86.991944),
72 8848.0);
73
74
75 final GeodeticPoint des = new GeodeticPoint(FastMath.toRadians(31.500000),
76 FastMath.toRadians(35.500000),
77 -422.0);
78
79
80 final GeodeticPoint alt = new GeodeticPoint(FastMath.toRadians(31.500000),
81 FastMath.toRadians(35.500000),
82 0.0);
83 stationk = new TopocentricFrame(earth, kir, namek);
84 stationh = new TopocentricFrame(earth, har, nameh);
85 statione = new TopocentricFrame(earth, eve, namee);
86 stationd = new TopocentricFrame(earth, des, named);
87 stationa = new TopocentricFrame(earth, alt, namea);
88 }
89
90
91 @Test
92 public void testEarthITU453AtmosphereRefractionHighest() {
93
94
95 final double elevation = FastMath.toRadians(2.0);
96
97
98 final double altitude = statione.getPoint().getAltitude();
99 EarthITU453AtmosphereRefraction modelTropo = new EarthITU453AtmosphereRefraction(altitude);
100
101
102 double refraction = FastMath.toDegrees(modelTropo.getRefraction(elevation));
103 Assert.assertEquals(0.11458177523385392, refraction, epsilon);
104 }
105
106 @Test
107 public void testEarthITU453AtmosphereRefractionLowest() {
108
109
110 final double elevation = FastMath.toRadians(2.0);
111
112
113 final double altitude = stationd.getPoint().getAltitude();
114 EarthITU453AtmosphereRefraction modelTropo = new EarthITU453AtmosphereRefraction(altitude);
115
116
117 double refraction = FastMath.toDegrees(modelTropo.getRefraction(elevation));
118 Assert.assertEquals(0.3550620274090111, refraction, epsilon);
119 }
120
121 @Test
122 public void testEarthITU453AtmosphereRefraction2degree() {
123
124
125 final double elevation = FastMath.toRadians(2.0);
126
127
128 final double altitude = stationk.getPoint().getAltitude();
129 EarthITU453AtmosphereRefraction modelTropo = new EarthITU453AtmosphereRefraction(altitude);
130
131
132 final double refraction = FastMath.toDegrees(modelTropo.getRefraction(elevation));
133 Assert.assertEquals(refraction, 0.32, onehundredth);
134
135 final double thetamin = FastMath.toDegrees(modelTropo.getThetaMin());
136 Assert.assertEquals(-0.5402509318003884, thetamin, epsilon);
137 final double theta0 = FastMath.toDegrees(modelTropo.getTheta0());
138 Assert.assertEquals(-1.4959064751203384, theta0, epsilon);
139
140 }
141
142 @Test
143 public void testEarthITU453AtmosphereRefraction4degree() {
144
145
146 final double elevation = FastMath.toRadians(4.0);
147
148
149 final double altitude = stationk.getPoint().getAltitude();
150 EarthITU453AtmosphereRefraction modelTropo = new EarthITU453AtmosphereRefraction(altitude);
151
152
153 double refraction = FastMath.toDegrees(modelTropo.getRefraction(elevation));
154 Assert.assertEquals(0.21, refraction, onehundredth);
155 }
156
157 @Test
158 public void testEarthITU453AtmosphereRefraction10degree() {
159
160
161 final double elevation = FastMath.toRadians(10.0);
162
163
164 final double altitude = stationk.getPoint().getAltitude();
165 EarthITU453AtmosphereRefraction modelTropo = new EarthITU453AtmosphereRefraction(altitude);
166
167
168 double refraction = FastMath.toDegrees(modelTropo.getRefraction(elevation));
169 Assert.assertEquals(0.10, refraction, twohundredth);
170 }
171
172 @Test
173 public void testEarthITU453AtmosphereRefraction30degree() {
174
175
176 final double elevation = FastMath.toRadians(30.0);
177
178
179 final double altitude = stationk.getPoint().getAltitude();
180 EarthITU453AtmosphereRefraction modelTropo = new EarthITU453AtmosphereRefraction(altitude);
181
182
183 double refraction = FastMath.toDegrees(modelTropo.getRefraction(elevation));
184 Assert.assertEquals(0.02, refraction, onehundredth);
185 }
186
187 @Test
188 public void testEarthITU453AtmosphereRefraction90degree() {
189
190
191 final double elevation = FastMath.toRadians(90.0);
192
193
194 final double altitude = stationk.getPoint().getAltitude();
195 EarthITU453AtmosphereRefraction modelTropo = new EarthITU453AtmosphereRefraction(altitude);
196
197
198 double refraction = FastMath.toDegrees(modelTropo.getRefraction(elevation));
199 Assert.assertEquals(0.002, refraction, onethousandth);
200
201 }
202 @Test
203 public void testEarthITU453AtmosphereRefractionminusdegree() {
204
205
206 final double elevation = FastMath.toRadians(-10.);
207
208
209 final double altitude = stationh.getPoint().getAltitude();
210 EarthITU453AtmosphereRefraction modelTropo = new EarthITU453AtmosphereRefraction(altitude);
211
212
213 double refraction = FastMath.toDegrees(modelTropo.getRefraction(elevation));
214 Assert.assertEquals(1.7367073234643113, refraction, onethousandth);
215 }
216
217 @Test
218 public void testEarthITU453AtmosphereRefractiontable() {
219
220
221 final double altitude = stationa.getPoint().getAltitude();
222 EarthITU453AtmosphereRefraction modelTropo = new EarthITU453AtmosphereRefraction(altitude);
223
224 for (int itab=0; itab<40; itab++) {
225
226 final double elevation = FastMath.toRadians(ref_elevation[itab]);
227
228
229 final double refraction = 60.0 * FastMath.toDegrees(modelTropo.getRefraction(elevation));
230 Assert.assertEquals(ref_refraction[itab], refraction, 2.1);
231 }
232 }
233 }