use of org.orekit.data.BodiesElements in project Orekit by CS-SI.
the class OceanTidesField method onDate.
/**
* {@inheritDoc}
*/
@Override
public NormalizedSphericalHarmonics onDate(final AbsoluteDate date) throws OrekitException {
// computed Cnm and Snm coefficients
final int rows = degree + 1;
final double[][] cnm = new double[rows][];
final double[][] snm = new double[rows][];
for (int i = 0; i <= degree; ++i) {
final int m = FastMath.min(i, order) + 1;
cnm[i] = new double[m];
snm[i] = new double[m];
}
final BodiesElements bodiesElements = arguments.evaluateAll(date);
for (final OceanTidesWave wave : waves) {
wave.addContribution(bodiesElements, cnm, snm);
}
if (poleTideFunction != null && degree > 1 && order > 0) {
// add pole tide
poleTide(date, cnm, snm);
}
return new TideHarmonics(date, cnm, snm);
}
use of org.orekit.data.BodiesElements in project Orekit by CS-SI.
the class OceanLoading method displacement.
/**
* {@inheritDoc}
*/
@Override
public Vector3D displacement(final BodiesElements elements, final Frame earthFrame, final Vector3D referencePoint) throws OrekitException {
// allocate arrays for each species splines
final UnivariateFunction[] realZSpline = new UnivariateFunction[mainTides.length];
final UnivariateFunction[] imaginaryZSpline = new UnivariateFunction[mainTides.length];
final UnivariateFunction[] realWSpline = new UnivariateFunction[mainTides.length];
final UnivariateFunction[] imaginaryWSpline = new UnivariateFunction[mainTides.length];
final UnivariateFunction[] realSSpline = new UnivariateFunction[mainTides.length];
final UnivariateFunction[] imaginarySSpline = new UnivariateFunction[mainTides.length];
// prepare splines for each species
for (int i = 0; i < mainTides.length; ++i) {
// compute current rates
final double[] rates = new double[mainTides[i].length];
for (int j = 0; j < rates.length; ++j) {
rates[j] = mainTides[i][j].tide.getRate(elements);
}
// set up splines for the current rates
realZSpline[i] = spline(rates, mainTides[i], d -> d.realZ);
imaginaryZSpline[i] = spline(rates, mainTides[i], d -> d.imaginaryZ);
realWSpline[i] = spline(rates, mainTides[i], d -> d.realW);
imaginaryWSpline[i] = spline(rates, mainTides[i], d -> d.imaginaryW);
realSSpline[i] = spline(rates, mainTides[i], d -> d.realS);
imaginarySSpline[i] = spline(rates, mainTides[i], d -> d.imaginaryS);
}
// evaluate all harmonics using interpolated admittances
double dz = 0;
double dw = 0;
double ds = 0;
for (final Map.Entry<Tide, Double> entry : CARTWRIGHT_EDDEN_AMPLITUDE_MAP.entrySet()) {
final Tide tide = entry.getKey();
final double amplitude = entry.getValue();
final int i = tide.getTauMultiplier();
final double rate = tide.getRate(elements);
// apply splines for the current rate of this tide
final double rZ = realZSpline[i].value(rate);
final double iZ = imaginaryZSpline[i].value(rate);
final double rW = realWSpline[i].value(rate);
final double iW = imaginaryWSpline[i].value(rate);
final double rS = realSSpline[i].value(rate);
final double iS = imaginarySSpline[i].value(rate);
// phase for the current tide, including corrections
final double correction;
if (tide.getTauMultiplier() == 0) {
correction = FastMath.PI;
} else if (tide.getTauMultiplier() == 1) {
correction = 0.5 * FastMath.PI;
} else {
correction = 0.0;
}
final double phase = tide.getPhase(elements) + correction;
dz += amplitude * FastMath.hypot(rZ, iZ) * FastMath.cos(phase + FastMath.atan2(iZ, rZ));
dw += amplitude * FastMath.hypot(rW, iW) * FastMath.cos(phase + FastMath.atan2(iW, rW));
ds += amplitude * FastMath.hypot(rS, iS) * FastMath.cos(phase + FastMath.atan2(iS, rS));
}
// convert to proper frame
final GeodeticPoint gp = earth.transform(referencePoint, earthFrame, null);
return new Vector3D(dz, gp.getZenith(), dw, gp.getWest(), ds, gp.getSouth());
}
use of org.orekit.data.BodiesElements in project Orekit by CS-SI.
the class OceanLoadingCoefficientsBLQFactoryTest method testOrganization.
@Test
public void testOrganization() throws OrekitException {
TimeScale ut1 = TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true);
FundamentalNutationArguments fna = IERSConventions.IERS_2010.getNutationArguments(ut1);
final BodiesElements el = fna.evaluateAll(AbsoluteDate.J2000_EPOCH);
OceanLoadingCoefficientsBLQFactory factory = new OceanLoadingCoefficientsBLQFactory("^hardisp\\.blq$");
List<String> sites = factory.getSites();
for (String site : sites) {
OceanLoadingCoefficients coeffs = factory.getCoefficients(site);
Assert.assertEquals(3, coeffs.getNbSpecies());
Assert.assertEquals(3, coeffs.getNbTides(0));
Assert.assertEquals(4, coeffs.getNbTides(1));
Assert.assertEquals(4, coeffs.getNbTides(2));
for (int i = 0; i < coeffs.getNbSpecies(); ++i) {
for (int j = 1; j < coeffs.getNbTides(i); ++j) {
// for each species, tides are sorted in increasing rate order
Assert.assertTrue(coeffs.getTide(i, j - 1).getRate(el) < coeffs.getTide(i, j).getRate(el));
}
}
}
}
use of org.orekit.data.BodiesElements in project Orekit by CS-SI.
the class OceanLoadingTest method testSemiDiurnal.
@Test
public void testSemiDiurnal() throws OrekitException {
TimeScale ut1 = TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true);
FundamentalNutationArguments fna = IERSConventions.IERS_2010.getNutationArguments(ut1);
BodiesElements elements = fna.evaluateAll(new AbsoluteDate(2009, 6, 25, 0, 0, 0.0, ut1));
for (Tide tide : getTides()) {
if (tide.getDoodsonMultipliers()[0] == 2) {
double f = tide.getRate(elements) * Constants.JULIAN_DAY / (2 * FastMath.PI);
Assert.assertTrue(f > 1.5);
Assert.assertTrue(f <= 2.5);
}
}
}
use of org.orekit.data.BodiesElements in project Orekit by CS-SI.
the class OceanLoadingTest method testTidesRatesPastInversion.
@Test
public void testTidesRatesPastInversion() throws OrekitException {
// on -122502-11-09, the rates for semidiurnal tides 245556 and 245635 cross over
final TimeScale ut1 = TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true);
final FundamentalNutationArguments fna = IERSConventions.IERS_2010.getNutationArguments(ut1);
final Tide tide1 = new Tide(245556);
final Tide tide2 = new Tide(245635);
final AbsoluteDate t0530 = new AbsoluteDate(-122502, 11, 9, 5, 30, 0.0, TimeScalesFactory.getTAI());
final BodiesElements el0530 = fna.evaluateAll(t0530);
Assert.assertTrue(tide1.getRate(el0530) < tide2.getRate(el0530));
final AbsoluteDate t0430 = t0530.shiftedBy(-3600.0);
final BodiesElements el0430 = fna.evaluateAll(t0430);
Assert.assertTrue(tide1.getRate(el0430) > tide2.getRate(el0430));
}
Aggregations