Commit 49e0a99f authored by Bryan Cazabonne's avatar Bryan Cazabonne

Removed computeZenithDelay() method from DiscreteTroposphericModel.

parent af6f6da4
......@@ -67,33 +67,6 @@ public interface DiscreteTroposphericModel {
*/
<T extends RealFieldElement<T>> T pathDelay(T elevation, FieldGeodeticPoint<T> point, T[] parameters, FieldAbsoluteDate<T> date);
/** This method allows the computation of the zenith hydrostatic and
* zenith wet delay. The resulting element is an array having the following form:
* <ul>
* <li>double[0] = D<sub>hz</sub> → zenith hydrostatic delay
* <li>double[1] = D<sub>wz</sub> → zenith wet delay
* </ul>
* @param point station location
* @param parameters tropospheric model parameters
* @param date current date
* @return a two components array containing the zenith hydrostatic and wet delays.
*/
double[] computeZenithDelay(GeodeticPoint point, double[] parameters, AbsoluteDate date);
/** This method allows the computation of the zenith hydrostatic and
* zenith wet delay. The resulting element is an array having the following form:
* <ul>
* <li>T[0] = D<sub>hz</sub> → zenith hydrostatic delay
* <li>T[1] = D<sub>wz</sub> → zenith wet delay
* </ul>
* @param <T> type of the elements
* @param point station location
* @param parameters tropospheric model parameters
* @param date current date
* @return a two components array containing the zenith hydrostatic and wet delays.
*/
<T extends RealFieldElement<T>> T[] computeZenithDelay(FieldGeodeticPoint<T> point, T[] parameters, FieldAbsoluteDate<T> date);
/** Get the drivers for tropospheric model parameters.
* @return drivers for tropospheric model parameters
*/
......
......@@ -19,10 +19,8 @@ package org.orekit.models.earth.troposphere;
import java.util.Collections;
import java.util.List;
import org.hipparchus.Field;
import org.hipparchus.RealFieldElement;
import org.hipparchus.util.FastMath;
import org.hipparchus.util.MathArrays;
import org.orekit.bodies.FieldGeodeticPoint;
import org.orekit.bodies.GeodeticPoint;
import org.orekit.time.AbsoluteDate;
......@@ -106,95 +104,30 @@ public class EstimatedTroposphericModel implements DiscreteTroposphericModel {
@Override
public double pathDelay(final double elevation, final GeodeticPoint point,
final double[] parameters, final AbsoluteDate date) {
// Use an empirical model for tropospheric zenith hydro-static delay : Saastamoinen model
final SaastamoinenModel saastamoinen = new SaastamoinenModel(t0, p0, 0.0);
// Zenith delays. elevation = pi/2 because we compute the delay in the zenith direction
final double zhd = saastamoinen.pathDelay(0.5 * FastMath.PI, point, parameters, date);
final double ztd = parameters[0];
// Mapping functions
final double[] mf = model.mappingFactors(elevation, point, date);
// Zenith delays
final double[] delays = computeZenithDelay(point, parameters, date);
// Total delay
return mf[0] * delays[0] + mf[1] * (delays[1] - delays[0]);
return mf[0] * zhd + mf[1] * (ztd - zhd);
}
/** {@inheritDoc} */
@Override
public <T extends RealFieldElement<T>> T pathDelay(final T elevation, final FieldGeodeticPoint<T> point,
final T[] parameters, final FieldAbsoluteDate<T> date) {
// Mapping functions
final T[] mf = model.mappingFactors(elevation, point, date);
// Zenith delays
final T[] delays = computeZenithDelay(point, parameters, date);
// Total delay
return mf[0].multiply(delays[0]).add(mf[1].multiply(delays[1].subtract(delays[0])));
}
/** This method allows the computation of the zenith hydrostatic and zenith total delays.
* The resulting element is an array having the following form:
* <ul>
* <li>double[0] = D<sub>hz</sub> → zenith hydrostatic delay
* <li>double[1] = D<sub>tz</sub> → zenith total delay
* </ul>
* <p>
* The user have to be careful because the others tropospheric models in Orekit
* compute the zenith wet delay instead of the total zenith delay.
* </p>
* @param point station location
* @param parameters tropospheric model parameters
* @param date current date
* @return a two components array containing the zenith hydrostatic and wet delays.
*/
@Override
public double[] computeZenithDelay(final GeodeticPoint point, final double[] parameters,
final AbsoluteDate date) {
// Use an empirical model for tropospheric zenith hydro-static delay : Saastamoinen model
final SaastamoinenModel saastamoinen = new SaastamoinenModel(t0, p0, 0.0);
// elevation = pi/2 because we compute the delay in the zenith direction
final double zhd = saastamoinen.computeZenithDelay(point, parameters, date)[0];
final double ztd = parameters[0];
return new double[] {
zhd,
ztd
};
}
/** This method allows the computation of the zenith hydrostatic and zenith total delays.
* The resulting element is an array having the following form:
* <ul>
* <li>double[0] = D<sub>hz</sub> → zenith hydrostatic delay
* <li>double[1] = D<sub>tz</sub> → zenith total delay
* </ul>
* <p>
* The user have to be careful because the others tropospheric models in Orekit
* compute the zenith wet delay instead of the total zenith delay.
* </p>
* @param <T> type of the elements
* @param point station location
* @param parameters tropospheric model parameters
* @param date current date
* @return a two components array containing the zenith hydrostatic and wet delays.
*/
@Override
public <T extends RealFieldElement<T>> T[] computeZenithDelay(final FieldGeodeticPoint<T> point, final T[] parameters,
final FieldAbsoluteDate<T> date) {
// Field
final Field<T> field = date.getField();
// Use an empirical model for tropospheric zenith hydro-static delay : Saastamoinen model
final SaastamoinenModel saastamoinen = new SaastamoinenModel(t0, p0, 0.0);
// elevation = pi/2 because we compute the delay in the zenith direction
final T zhd = saastamoinen.computeZenithDelay(point, parameters, date)[0];
// Zenith delays. elevation = pi/2 because we compute the delay in the zenith direction
final T zhd = saastamoinen.pathDelay(date.getField().getZero().add(0.5 * FastMath.PI), point, parameters, date);
final T ztd = parameters[0];
final T[] delays = MathArrays.buildArray(field, 2);
delays[0] = zhd;
delays[1] = ztd;
return delays;
// Mapping functions
final T[] mf = model.mappingFactors(elevation, point, date);
// Total delay
return mf[0].multiply(zhd).add(mf[1].multiply(ztd.subtract(zhd)));
}
}
......@@ -19,12 +19,10 @@ package org.orekit.models.earth.troposphere;
import java.util.Collections;
import java.util.List;
import org.hipparchus.Field;
import org.hipparchus.RealFieldElement;
import org.hipparchus.analysis.interpolation.PiecewiseBicubicSplineInterpolatingFunction;
import org.hipparchus.analysis.interpolation.PiecewiseBicubicSplineInterpolator;
import org.hipparchus.util.FastMath;
import org.hipparchus.util.MathArrays;
import org.orekit.annotation.DefaultDataContext;
import org.orekit.bodies.FieldGeodeticPoint;
import org.orekit.bodies.GeodeticPoint;
......@@ -157,28 +155,6 @@ public class FixedTroposphericDelay implements DiscreteTroposphericModel {
return delayFunction.value(h, e);
}
/** {@inheritDoc} */
@Override
public double[] computeZenithDelay(final GeodeticPoint point, final double[] parameters,
final AbsoluteDate date) {
return new double[] {
pathDelay(0.5 * FastMath.PI, point, parameters, date),
0.
};
}
/** {@inheritDoc} */
@Override
public <T extends RealFieldElement<T>> T[] computeZenithDelay(final FieldGeodeticPoint<T> point, final T[] parameters,
final FieldAbsoluteDate<T> date) {
final Field<T> field = date.getField();
final T zero = field.getZero();
final T[] delay = MathArrays.buildArray(field, 2);
delay[0] = pathDelay(zero.add(0.5 * FastMath.PI), point, parameters, date);
delay[1] = zero;
return delay;
}
/** {@inheritDoc} */
@Override
public List<ParameterDriver> getParametersDrivers() {
......
......@@ -19,10 +19,8 @@ package org.orekit.models.earth.troposphere;
import java.util.Collections;
import java.util.List;
import org.hipparchus.Field;
import org.hipparchus.RealFieldElement;
import org.hipparchus.util.FastMath;
import org.hipparchus.util.MathArrays;
import org.orekit.bodies.FieldGeodeticPoint;
import org.orekit.bodies.GeodeticPoint;
import org.orekit.time.AbsoluteDate;
......@@ -112,28 +110,6 @@ public class MariniMurrayModel implements DiscreteTroposphericModel {
return dR;
}
/** {@inheritDoc} */
@Override
public double[] computeZenithDelay(final GeodeticPoint point, final double[] parameters,
final AbsoluteDate date) {
return new double[] {
pathDelay(0.5 * FastMath.PI, point, parameters, date),
0.
};
}
/** {@inheritDoc} */
@Override
public <T extends RealFieldElement<T>> T[] computeZenithDelay(final FieldGeodeticPoint<T> point, final T[] parameters,
final FieldAbsoluteDate<T> date) {
final Field<T> field = date.getField();
final T zero = field.getZero();
final T[] delay = MathArrays.buildArray(field, 2);
delay[0] = pathDelay(zero.add(0.5 * FastMath.PI), point, parameters, date);
delay[1] = zero;
return delay;
}
/** {@inheritDoc} */
@Override
public List<ParameterDriver> getParametersDrivers() {
......
......@@ -130,8 +130,17 @@ public class MendesPavlisModel implements DiscreteTroposphericModel, MappingFunc
return delays[0].multiply(mappingFunction[0]).add(delays[1].multiply(mappingFunction[1]));
}
/** {@inheritDoc} */
@Override
/** This method allows the computation of the zenith hydrostatic and
* zenith wet delay. The resulting element is an array having the following form:
* <ul>
* <li>double[0] = D<sub>hz</sub> → zenith hydrostatic delay
* <li>double[1] = D<sub>wz</sub> → zenith wet delay
* </ul>
* @param point station location
* @param parameters tropospheric model parameters
* @param date current date
* @return a two components array containing the zenith hydrostatic and wet delays.
*/
public double[] computeZenithDelay(final GeodeticPoint point, final double[] parameters, final AbsoluteDate date) {
final double fsite = getSiteFunctionValue(point);
......@@ -169,8 +178,18 @@ public class MendesPavlisModel implements DiscreteTroposphericModel, MappingFunc
return delay;
}
/** {@inheritDoc} */
@Override
/** This method allows the computation of the zenith hydrostatic and
* zenith wet delay. The resulting element is an array having the following form:
* <ul>
* <li>T[0] = D<sub>hz</sub> → zenith hydrostatic delay
* <li>T[1] = D<sub>wz</sub> → zenith wet delay
* </ul>
* @param <T> type of the elements
* @param point station location
* @param parameters tropospheric model parameters
* @param date current date
* @return a two components array containing the zenith hydrostatic and wet delays.
*/
public <T extends RealFieldElement<T>> T[] computeZenithDelay(final FieldGeodeticPoint<T> point, final T[] parameters,
final FieldAbsoluteDate<T> date) {
final Field<T> field = date.getField();
......
......@@ -27,7 +27,6 @@ import org.hipparchus.analysis.interpolation.LinearInterpolator;
import org.hipparchus.analysis.polynomials.PolynomialFunction;
import org.hipparchus.analysis.polynomials.PolynomialSplineFunction;
import org.hipparchus.util.FastMath;
import org.hipparchus.util.MathArrays;
import org.orekit.annotation.DefaultDataContext;
import org.orekit.bodies.FieldGeodeticPoint;
import org.orekit.bodies.GeodeticPoint;
......@@ -405,28 +404,6 @@ public class SaastamoinenModel implements DiscreteTroposphericModel {
}
/** {@inheritDoc} */
@Override
public double[] computeZenithDelay(final GeodeticPoint point, final double[] parameters,
final AbsoluteDate date) {
return new double[] {
pathDelay(0.5 * FastMath.PI, point, parameters, date),
0.
};
}
/** {@inheritDoc} */
@Override
public <T extends RealFieldElement<T>> T[] computeZenithDelay(final FieldGeodeticPoint<T> point, final T[] parameters,
final FieldAbsoluteDate<T> date) {
final Field<T> field = date.getField();
final T zero = field.getZero();
final T[] delay = MathArrays.buildArray(field, 2);
delay[0] = pathDelay(zero.add(0.5 * FastMath.PI), point, parameters, date);
delay[1] = zero;
return delay;
}
/** {@inheritDoc} */
@Override
public List<ParameterDriver> getParametersDrivers() {
......
......@@ -235,26 +235,6 @@ public class TimeSpanEstimatedTroposphericModel implements DiscreteTroposphericM
extractedParameters, date);
}
/** {@inheritDoc} */
@Override
public double[] computeZenithDelay(final GeodeticPoint point, final double[] parameters,
final AbsoluteDate date) {
// Extract the proper parameters valid at date from the input array
final double[] extractedParameters = extractParameters(parameters, date);
// Compute and return zenith delay
return getTroposphericModel(date).computeZenithDelay(point, extractedParameters, date);
}
/** {@inheritDoc} */
@Override
public <T extends RealFieldElement<T>> T[] computeZenithDelay(final FieldGeodeticPoint<T> point, final T[] parameters,
final FieldAbsoluteDate<T> date) {
// Extract the proper parameters valid at date from the input array
final T[] extractedParameters = extractParameters(parameters, date);
// Compute and return zenith delay
return getTroposphericModel(date.toAbsoluteDate()).computeZenithDelay(point, extractedParameters, date);
}
/** Find if a parameter driver with a given name already exists in a list of parameter drivers.
* @param driversList the list of parameter drivers
* @param name the parameter driver's name to filter with
......
......@@ -114,14 +114,33 @@ public class ViennaOneModel implements DiscreteTroposphericModel, MappingFunctio
return delays[0].multiply(mappingFunction[0]).add(delays[1].multiply(mappingFunction[1]));
}
/** {@inheritDoc} */
@Override
/** This method allows the computation of the zenith hydrostatic and
* zenith wet delay. The resulting element is an array having the following form:
* <ul>
* <li>T[0] = D<sub>hz</sub> → zenith hydrostatic delay
* <li>T[1] = D<sub>wz</sub> → zenith wet delay
* </ul>
* @param point station location
* @param parameters tropospheric model parameters
* @param date current date
* @return a two components array containing the zenith hydrostatic and wet delays.
*/
public double[] computeZenithDelay(final GeodeticPoint point, final double[] parameters, final AbsoluteDate date) {
return zenithDelay.clone();
}
/** {@inheritDoc} */
@Override
/** This method allows the computation of the zenith hydrostatic and
* zenith wet delay. The resulting element is an array having the following form:
* <ul>
* <li>T[0] = D<sub>hz</sub> → zenith hydrostatic delay
* <li>T[1] = D<sub>wz</sub> → zenith wet delay
* </ul>
* @param <T> type of the elements
* @param point station location
* @param parameters tropospheric model parameters
* @param date current date
* @return a two components array containing the zenith hydrostatic and wet delays.
*/
public <T extends RealFieldElement<T>> T[] computeZenithDelay(final FieldGeodeticPoint<T> point, final T[] parameters,
final FieldAbsoluteDate<T> date) {
final Field<T> field = date.getField();
......
......@@ -291,14 +291,33 @@ public class ViennaThreeModel implements DiscreteTroposphericModel, MappingFunct
return delays[0].multiply(mappingFunction[0]).add(delays[1].multiply(mappingFunction[1]));
}
/** {@inheritDoc} */
@Override
/** This method allows the computation of the zenith hydrostatic and
* zenith wet delay. The resulting element is an array having the following form:
* <ul>
* <li>T[0] = D<sub>hz</sub> → zenith hydrostatic delay
* <li>T[1] = D<sub>wz</sub> → zenith wet delay
* </ul>
* @param point station location
* @param parameters tropospheric model parameters
* @param date current date
* @return a two components array containing the zenith hydrostatic and wet delays.
*/
public double[] computeZenithDelay(final GeodeticPoint point, final double[] parameters, final AbsoluteDate date) {
return zenithDelay.clone();
}
/** {@inheritDoc} */
@Override
/** This method allows the computation of the zenith hydrostatic and
* zenith wet delay. The resulting element is an array having the following form:
* <ul>
* <li>T[0] = D<sub>hz</sub> → zenith hydrostatic delay
* <li>T[1] = D<sub>wz</sub> → zenith wet delay
* </ul>
* @param <T> type of the elements
* @param point station location
* @param parameters tropospheric model parameters
* @param date current date
* @return a two components array containing the zenith hydrostatic and wet delays.
*/
public <T extends RealFieldElement<T>> T[] computeZenithDelay(final FieldGeodeticPoint<T> point, final T[] parameters,
final FieldAbsoluteDate<T> date) {
final Field<T> field = date.getField();
......
......@@ -80,28 +80,6 @@ public class FixedTroposphericModelTest {
Assert.assertEquals(2.5d, model.pathDelay(zero.add(FastMath.toRadians(90d)), new FieldGeodeticPoint<T>(zero, zero, zero.add(100000.0)), null, FieldAbsoluteDate.getJ2000Epoch(field)).getReal(), epsilon);
}
@Test
public void testZenithDelay() {
// Zenith Delay
final double[] zenithDelay = model.computeZenithDelay(new GeodeticPoint(0., 0., 0.), model.getParameters(), AbsoluteDate.J2000_EPOCH);
Assert.assertEquals(2.5d, zenithDelay[0], epsilon);
Assert.assertEquals(0.0d, zenithDelay[1], epsilon);
}
@Test
public void testFieldZenithDelay() {
doTestZenithDelay(Decimal64Field.getInstance());
}
private <T extends RealFieldElement<T>> void doTestZenithDelay(final Field<T> field) {
// Zero
final T zero = field.getZero();
// Zenith Delay
final T[] zenithDelay = model.computeZenithDelay(new FieldGeodeticPoint<T>(zero, zero, zero), model.getParameters(field), FieldAbsoluteDate.getJ2000Epoch(field));
Assert.assertEquals(2.5d, zenithDelay[0].getReal(), epsilon);
Assert.assertEquals(0.0d, zenithDelay[1].getReal(), epsilon);
}
@Test
public void testSymmetry() {
for (int elevation = 0; elevation < 90; elevation += 10) {
......
......@@ -253,54 +253,6 @@ public class SaastamoinenModelTest {
}
}
@Test
public void testZenithDelay() {
Utils.setDataRoot("atmosphere");
SaastamoinenModel model = SaastamoinenModel.getStandardModel();
for (int h = 0; h < heights.length; h++) {
for (int e = 0; e < elevations.length; e++) {
double height = heights[h];
double elevation = elevations[e];
// Select only the expected value for elevation = 90°
if (elevation == FastMath.toRadians(90.0)) {
double expectedValue = expectedValues[h][e];
double[] actualValue = model.computeZenithDelay(new GeodeticPoint(0.0, 0.0, height), model.getParameters(), AbsoluteDate.J2000_EPOCH);
Assert.assertEquals(expectedValue, actualValue[0], epsilon);
}
}
}
}
@Test
public void testFieldZenithDelay() {
doTestFieldZenithDelay(Decimal64Field.getInstance());
}
private <T extends RealFieldElement<T>> void doTestFieldZenithDelay(final Field<T> field) {
Utils.setDataRoot("atmosphere");
SaastamoinenModel model = SaastamoinenModel.getStandardModel();
// Zero
final T zero = field.getZero();
for (int h = 0; h < heights.length; h++) {
for (int e = 0; e < elevations.length; e++) {
T height = zero.add(heights[h]);
T elevation = zero.add(elevations[e]);
// Select only the expected value for elevation = 90°
if (elevation.getReal() == FastMath.toRadians(90.0)) {
double expectedValue = expectedValues[h][e];
T[] actualValue = model.computeZenithDelay(new FieldGeodeticPoint<>(zero, zero, zero.add(height)), model.getParameters(field), FieldAbsoluteDate.getJ2000Epoch(field));
Assert.assertEquals(expectedValue, actualValue[0].getReal(), epsilon);
}
}
}
}
@Test
public void testIssue572() {
Utils.setDataRoot("atmosphere");
......
......@@ -385,9 +385,6 @@ public class TimeSpanEstimatedTroposphericModelTest {
Assert.assertEquals(estimatedModel.pathDelay(elevation, point, estimatedParameters, date),
timeSpanModel.pathDelay(elevation, point, timeSpanParameters, date),
Double.MIN_VALUE);
Assert.assertEquals(estimatedModel.computeZenithDelay(point, estimatedParameters, date)[0],
timeSpanModel.computeZenithDelay(point, timeSpanParameters, date)[0],
Double.MIN_VALUE);
}
@Test
......@@ -410,9 +407,6 @@ public class TimeSpanEstimatedTroposphericModelTest {
Assert.assertEquals(estimatedModel.pathDelay(elevation, dsPoint, estimatedParameters, date).getReal(),
timeSpanModel.pathDelay(elevation, dsPoint, timeSpanParameters, date).getReal(),
Double.MIN_VALUE);
Assert.assertEquals(estimatedModel.computeZenithDelay(dsPoint, estimatedParameters, date)[0].getReal(),
timeSpanModel.computeZenithDelay(dsPoint, timeSpanParameters, date)[0].getReal(),
Double.MIN_VALUE);
}
private SpacecraftState shiftState(SpacecraftState state, OrbitType orbitType, PositionAngle angleType,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment