use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics in project Orekit by CS-SI.
the class GRGSFormatReaderTest method testReadLimits.
@Test
public void testReadLimits() throws OrekitException {
GravityFieldFactory.addPotentialCoefficientsReader(new GRGSFormatReader("grim5_C1.dat", true));
UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(3, 2);
UnnormalizedSphericalHarmonics harmonics = provider.onDate(provider.getReferenceDate());
try {
harmonics.getUnnormalizedCnm(3, 3);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
// expected
} catch (Exception e) {
Assert.fail("wrong exception caught: " + e.getLocalizedMessage());
}
try {
harmonics.getUnnormalizedCnm(4, 2);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
// expected
} catch (Exception e) {
Assert.fail("wrong exception caught: " + e.getLocalizedMessage());
}
harmonics.getUnnormalizedCnm(3, 2);
Assert.assertEquals(3, provider.getMaxDegree());
Assert.assertEquals(2, provider.getMaxOrder());
}
use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics in project Orekit by CS-SI.
the class GRGSFormatReaderTest method testRegular05cUnnormalized.
@Test
public void testRegular05cUnnormalized() throws OrekitException {
GravityFieldFactory.addPotentialCoefficientsReader(new GRGSFormatReader("grim5_C1.dat", true));
UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(5, 5);
AbsoluteDate refDate = new AbsoluteDate("1997-01-01T12:00:00", TimeScalesFactory.getTT());
Assert.assertEquals(refDate, provider.getReferenceDate());
AbsoluteDate date = new AbsoluteDate("2011-05-01T01:02:03", TimeScalesFactory.getTT());
Assert.assertEquals(date.durationFrom(refDate), provider.getOffset(date), Precision.SAFE_MIN);
UnnormalizedSphericalHarmonics harmonics = provider.onDate(date);
int maxUlps = 2;
checkValue(harmonics.getUnnormalizedCnm(3, 0), date, 3, 0, 1997, 1, 1, 0.95857491635129E-06, 0.28175700027753E-11, maxUlps);
checkValue(harmonics.getUnnormalizedCnm(5, 5), date, 5, 5, 1997, 1, 1, 0.17481512311600E-06, 0.0, maxUlps);
checkValue(harmonics.getUnnormalizedSnm(4, 0), date, 4, 0, 1997, 1, 1, 0, 0, maxUlps);
checkValue(harmonics.getUnnormalizedSnm(4, 4), date, 4, 4, 1997, 1, 1, 0.30882755318300E-06, 0, maxUlps);
Assert.assertEquals(0.3986004415E+15, provider.getMu(), 0);
Assert.assertEquals(0.6378136460E+07, provider.getAe(), 0);
}
use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics in project Orekit by CS-SI.
the class GravityFieldFactoryTest method testUnnormalizer.
@Test
public void testUnnormalizer() throws OrekitException {
Utils.setDataRoot("potential/icgem-format");
final double shift = 1.23456e8;
UnnormalizedSphericalHarmonicsProvider ref = GravityFieldFactory.getUnnormalizedProvider(5, 5);
UnnormalizedSphericalHarmonics refHarmonics = ref.onDate(ref.getReferenceDate().shiftedBy(shift));
NormalizedSphericalHarmonicsProvider normalized = GravityFieldFactory.getNormalizedProvider(5, 5);
UnnormalizedSphericalHarmonicsProvider unnormalized = GravityFieldFactory.getUnnormalizedProvider(normalized);
UnnormalizedSphericalHarmonics unnormalizedHarmonics = unnormalized.onDate(unnormalized.getReferenceDate().shiftedBy(shift));
Assert.assertEquals(ref.getMaxDegree(), unnormalized.getMaxDegree());
Assert.assertEquals(ref.getMaxOrder(), unnormalized.getMaxOrder());
Assert.assertEquals(ref.getReferenceDate(), unnormalized.getReferenceDate());
Assert.assertEquals(ref.getAe(), unnormalized.getAe(), FastMath.ulp(ref.getAe()));
Assert.assertEquals(ref.getMu(), unnormalized.getMu(), FastMath.ulp(ref.getMu()));
Assert.assertEquals(ref.getOffset(AbsoluteDate.GPS_EPOCH), unnormalized.getOffset(AbsoluteDate.GPS_EPOCH), FastMath.ulp(ref.getOffset(AbsoluteDate.GPS_EPOCH)));
for (int i = 0; i <= 5; ++i) {
for (int j = 0; j <= i; ++j) {
double cRef = refHarmonics.getUnnormalizedCnm(i, j);
double cTest = unnormalizedHarmonics.getUnnormalizedCnm(i, j);
Assert.assertEquals(cRef, cTest, FastMath.ulp(cRef));
double sRef = refHarmonics.getUnnormalizedSnm(i, j);
double sTest = unnormalizedHarmonics.getUnnormalizedSnm(i, j);
Assert.assertEquals(sRef, sTest, FastMath.ulp(sRef));
}
}
}
use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics in project Orekit by CS-SI.
the class SHMFormatReaderTest method testReadLimits.
@Test
public void testReadLimits() throws OrekitException {
Utils.setDataRoot("potential");
GravityFieldFactory.addPotentialCoefficientsReader(new SHMFormatReader("eigen_cg03c_coef", false));
UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(3, 2);
UnnormalizedSphericalHarmonics harmonics = provider.onDate(provider.getReferenceDate());
try {
harmonics.getUnnormalizedCnm(3, 3);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
// expected
} catch (Exception e) {
Assert.fail("wrong exception caught: " + e.getLocalizedMessage());
}
try {
harmonics.getUnnormalizedCnm(4, 2);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
// expected
} catch (Exception e) {
Assert.fail("wrong exception caught: " + e.getLocalizedMessage());
}
harmonics.getUnnormalizedCnm(3, 2);
Assert.assertEquals(3, provider.getMaxDegree());
Assert.assertEquals(2, provider.getMaxOrder());
}
use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics in project Orekit by CS-SI.
the class SHMFormatReaderTest method testRegular03cUnnormalized.
@Test
public void testRegular03cUnnormalized() throws OrekitException {
Utils.setDataRoot("potential");
GravityFieldFactory.addPotentialCoefficientsReader(new SHMFormatReader("eigen_cg03c_coef", false));
UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(5, 5);
Assert.assertEquals(TideSystem.TIDE_FREE, provider.getTideSystem());
AbsoluteDate refDate = new AbsoluteDate("1997-01-01T12:00:00", TimeScalesFactory.getTT());
Assert.assertEquals(refDate, provider.getReferenceDate());
AbsoluteDate date = new AbsoluteDate("2011-05-01T01:02:03", TimeScalesFactory.getTT());
Assert.assertEquals(date.durationFrom(refDate), provider.getOffset(date), Precision.SAFE_MIN);
UnnormalizedSphericalHarmonics harmonics = provider.onDate(date);
int maxUlps = 2;
checkValue(harmonics.getUnnormalizedCnm(3, 0), date, 3, 0, 1997, 1, 1, 0.957201462136e-06, 0.490000000000e-11, maxUlps);
checkValue(harmonics.getUnnormalizedCnm(5, 5), date, 5, 5, 1997, 1, 1, 0.174786174485e-06, 0.0, maxUlps);
checkValue(harmonics.getUnnormalizedSnm(4, 0), date, 4, 0, 1997, 1, 1, 0, 0, maxUlps);
checkValue(harmonics.getUnnormalizedSnm(4, 4), date, 4, 4, 1997, 1, 1, 0.308834784975e-06, 0, maxUlps);
Assert.assertEquals(0.3986004415E+15, provider.getMu(), 0);
Assert.assertEquals(0.6378136460E+07, provider.getAe(), 0);
}
Aggregations