Transforming Angles

Newbie question here.

Are there any good examples out there transforming AngularRaDec from one coordinate system to another. I would like to go back-and-forth from TEMEofDate to EME2000

Thx

Hi @Joe,

I would say something along these lines:

    public AngularRaDec transformReferenceFrame(AngularRaDec original, Frame newFrame) {
        Transform t                   = original.getReferenceFrame().getTransformTo(newFrame, original.getDate());
        double[] originalAngles       = original.getObservedValue();
        Vector3D originalDirection    = new Vector3D(originalAngles[0], originalAngles[1]);
        Vector3D transformedDirection = t.transformVector(originalDirection);
        double[] transformedAngles    = new double[] {
             transformedDirection.getAlpha(),
             transformedDirection.getDelta()
        };
       return new AngularRaDec(original.getStation(), newFrame, original.getDate(),
                               transformedAngles, original.getSigma(), original.getWeight(),
                               original.getSatellites().get(0));
    }

Note however that even if you want your orbit determination process to compute orbits in TEME (by configuring the underlying propagator builder) and your measurements were created in EME2000, it will work properly. The measurement is aware of both the spacecraft state frame and of its own frame and does compute the transform internally, so you don’t need to convert the measurement beforehand. It also works the other way round, if your measurements were created in TEME and you want to compute orbits in EME2000, just use the available measurements as is and let the transform be performed automatically under the hood.

The use case here is that we are getting B3 obs from some of the older sensor systems in TEMEofDate. We want to combine them with other observations decks that are already in EME2000. Then we will post to our database before consuming in an IOD/OD tool, so the converted frame is the end product.

[SOLUTION]

For those that may want to solve this in the future… I believe this is the solution. (giving back to the community)

//
// initialisation
//

    //Define Site Location
    double siteLatRad = Math.toRadians(39.2799);
    double siteLonRad = Math.toRadians(-104.773);
    double siteAltMeters = 2019.96; // Meters
    double ra = Math.toRadians(30.838);
    double dec = Math.toRadians(22.167);
    double[] raDecAngular = {ra, dec};
    AbsoluteDate obsTime = new AbsoluteDate(2019, 10, 12, 06, 46, 18.849, TimeScalesFactory.getUTC());
    String stationName = "ConversionSite";

    // Set up all the constructors

    // define Earth shape, using WGS84 model
    BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            FramesFactory.getITRF(IERSConventions.IERS_2010, false));

    // define an array of ground stations
    TopocentricFrame station =
            new TopocentricFrame(earth, new GeodeticPoint(siteLatRad, siteLonRad, siteAltMeters), stationName);

    GroundStation groundStation = new GroundStation(station);

    // inertial frame
    Frame inertialFrame = FramesFactory.getEME2000();
    Frame temeFrame = FramesFactory.getTEME();

    // Preparing the code for Luc
    final double[] sigma = {0,0};
    final double[] baseWeight = {0,0};
    AngularRaDec original = new AngularRaDec(groundStation, temeFrame, obsTime, raDecAngular, sigma, baseWeight, new ObservableSatellite(0));

    // Lucs code
    Transform t                   = original.getReferenceFrame().getTransformTo(inertialFrame, original.getDate());
    double[] originalAngles       = original.getObservedValue();
    Vector3D originalDirection    = new Vector3D(originalAngles[0], originalAngles[1]);
    Vector3D transformedDirection = t.transformVector(originalDirection);
    double[] transformedAngles    = new double[] {
            transformedDirection.getAlpha(),
            transformedDirection.getDelta()
    };
    AngularRaDec newAngle =  new AngularRaDec(original.getStation(), inertialFrame, original.getDate(),
            transformedAngles, sigma, baseWeight,
            original.getSatellites().get(0));

    double asd[] = newAngle.getObservedValue();
    double raDeg = Math.toDegrees(asd[0]);
    double decDeg = Math.toDegrees(asd[1]);

@Joe:

I am receiving RA/Dec measurements from the Calar Alto telescope in Spain (code: Z84). I was assuming that the values are given in inertial frame. But after reading the thread above I am no longer sure and wonder if they could also use the TEME frame. How can I know in which frame my data is coming in?
Thanks for any answer you can provide.
Rüdiger

TEME should be considered an ill-defined and obsolete frame, that is almost reserved to work with TLE, but it is mandatory for TLE. So depending on the system the telescope belongs to, you may have some hints about the frame it uses.

Apart from that, I would guess that you could test orbit determination or residuals computation when combining your angular data with other inputs (reference orbit or other measurements) for the same object. Unfortunately, if all you have for the object you observe are the Calar Alto telescope and TLE, it would probably be difficult to check as TLE is probably not accurate enough to identify frame differences.

Thanks Luc! Calar Alto is a German-Spanish telescope, nothing to do with USSpaceCom, so I will assume that they use inertial frame EME2000. I can try to get also data from our 1m Zeiss telescope on Tenerife and combine that. In any case when I will try to estimate solar radiation pressure effects on these objects in highly eccentric orbits with apogees close to the Moon orbit, I will face other more difficult problems, let’s see …