How to convert ECI coordinates to a specific ITRS (such as ITRF2014) coordinate frame using astropy?

216 Views Asked by At

I want to convert ECI(GCRS frame) to ITRF2014, but in astropy I did not find any particular option to do so. In the docs and other examples, it is written like the transformation is happening to ITRS frame, so how to be sure, to which specific ITRS frame it is getting transformed to?

1

There are 1 best solutions below

0
Dec M On

Not sure if you are looking for a full state vector transform, or just a position, but I've been able to perform the conversion this way:

import numpy as np
from astropy.time import Time
from astropy import coordinates as coord
import astropy.units as u


def eci_to_ecef_pos(eci_pos, epoch, units):
            if isinstance(epoch, datetime):
                epoch = Time(datetime)
            if units == 'm':
                us = u.m
            else:
                us = u.km
            eci_coord = coord.CartesianRepresentation(x=eci_pos[0]*us, y=eci_pos[1]*us, z=eci_pos[2]*us)
            gcrs = coord.GCRS(eci_coord, obstime=epoch)
            itrf = gcrs.transform_to(coord.ITRS(obstime=epoch))
            ecef_pos = np.array(itrf.cartesian.xyz.value)
            return ecef_pos

As far as the frame getting transformed to, its being converted into the ITRF frame (mentioned here, with more info here). If you want it to specifically convert to the ITRF2014 frame, you could likely ingest the kernels necessary to make the conversion, or use the spiceypy package to do so as well.

Update: from a little more digging, Astropy seems to use the IAU2010 resolution, which corresponds to the ITRF2014 realization so no additional kernel ingestion should be needed.