I recently started using Skyfield (python) to find (x, y, z) coordinates of things in space. Now I'd like to transform between Earth-Centered, Earth-Fixed (rotating) and Earth-Centered Inertial (non-rotating) coordinates, since "rocket speeds" may sometimes be webcasted in earth-fixed (rotating) frames . See this answer and this answer
This is what I have so far. The barycentric positions are straight from Skyfield, but I'm just subtracting the earth position from the moon's position to get earth-centered inertial position - I think this is OK for non-precision results, I don't know if it is really that easy or if there is something subtle I'm missing.
However, I'm wondering if there is an "official" Earth-fixed (rotating) frame, and if Skyfield has a method to convert to it, or to any rotating frame in general?
from skyfield.api import load, JulianDate de421 = load('de421.bsp') earth = de421['earth'] moon = de421['moon'] slc40 = earth.topos('28.562 N', '80.577 W') jd = JulianDate(utc=(2015,12, 22, 1, 48, 0)) epos = earth.at(jd).position.km # barycentric (ICRS) position of earth mpos = moon.at(jd).position.km # barycentric (ICRS) position of moon slc40pos = slc40.at(jd).position.km # barycentric (ICRS) position of SLC-40 mpos_ec = mpos - epos # earth centered (inertial) position of moon slc40pos_ec = slc40pos - epos # earth centered (inertial) position of SLC-40