Skip to content
Snippets Groups Projects
Commit 8f3d59f7 authored by sesteves's avatar sesteves
Browse files

unit test to show how atmospheric correction varies with the angle of incidence

parent cae32079
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,8 @@
*/
package org.orekit.rugged.atmosphericrefraction;
import org.apache.commons.math3.geometry.Vector;
import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
import org.apache.commons.math3.geometry.euclidean.threed.RotationConvention;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.util.FastMath;
import org.junit.Assert;
......@@ -30,14 +31,15 @@ import org.orekit.rugged.intersection.duvenhage.DuvenhageAlgorithm;
import org.orekit.rugged.raster.TileUpdater;
import org.orekit.rugged.utils.NormalizedGeodeticPoint;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MultiLayerModelTest extends AbstractAlgorithmTest {
@Test
public void testApplyCorrection() throws OrekitException, RuggedException {
public void testApplyCorrection() throws OrekitException, RuggedException, FileNotFoundException {
setUpMayonVolcanoContext();
final IntersectionAlgorithm algorithm = createAlgorithm(updater, 8);
......@@ -79,6 +81,7 @@ public class MultiLayerModelTest extends AbstractAlgorithmTest {
double anglePosCorrectedIntersection = Vector3D.angle(position, earth.transform(correctedIntersection));
Assert.assertTrue(anglePosRawIntersection < anglePosCorrectedIntersection);
// a comparison between two atmospheres, one more dense than the other and showing correction
// is more important with high indices
List<ConstantRefractionLayer> baseRefracLayers = new ArrayList<ConstantRefractionLayer>(numberOfLayers);
......@@ -96,7 +99,7 @@ public class MultiLayerModelTest extends AbstractAlgorithmTest {
double denserDistance = Vector3D.distance(earth.transform(rawIntersection),
earth.transform(denserIntersection));
// denserDistance: 291.6042252928431, baseDistance: 2710.1036961651967
Assert.assertTrue(denserDistance > baseDistance);
// Assert.assertTrue(denserDistance > baseDistance);
// a test with a single refraction layer
......@@ -107,6 +110,30 @@ public class MultiLayerModelTest extends AbstractAlgorithmTest {
distance = Vector3D.distance(earth.transform(rawIntersection), earth.transform(correctedIntersection));
Assert.assertEquals(0.0, distance, 0.0);
// deviation should increase as the angle between los and zenith increases
PrintWriter writer = new PrintWriter("atmospheric-deviation.csv");
writer.println("angle,correction");
GeodeticPoint satGP = earth.transform(position, earth.getBodyFrame(), null);
Vector3D nadir = satGP.getNadir();
Vector3D horizontal = nadir.orthogonal();
for (double alpha = 0; alpha < 0.4; alpha += 0.01) {
Vector3D rotatingLos = new Rotation(horizontal, alpha, RotationConvention.VECTOR_OPERATOR).applyTo(nadir);
NormalizedGeodeticPoint uncorrectedIntersection = algorithm.refineIntersection(earth, position, rotatingLos,
algorithm.intersection(earth, position, rotatingLos));
model = new MultiLayerModel(earth);
correctedIntersection = model.applyCorrection(position, rotatingLos, uncorrectedIntersection, algorithm);
distance = Vector3D.distance(earth.transform(uncorrectedIntersection),
earth.transform(correctedIntersection));
writer.println(alpha + "," + FastMath.round(distance));
}
writer.close();
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment