def test_appendix_c_conversion_from_TEME_to_ITRF():
    rTEME = array([5094.18016210, 6127.64465950, 6380.34453270])
    vTEME = array([-4.746131487, 0.785818041, 5.531931288])
    vTEME = vTEME * 24.0 * 60.0 * 60.0  # km/s to km/day

    jd_utc = julian_date(2004, 4, 6, 7, 51, 28.386)
    d_ut1 = -0.439961
    jd_ut1 = jd_utc + d_ut1 / 86400.0

    xp = -0.140682 * arcsecond
    yp = 0.333309 * arcsecond

    rITRF, vITRF = TEME_to_ITRF(jd_ut1, rTEME, vTEME, xp, yp)

    epsilon = 5e-8  # Why not 1e-8, which would match all of their digits?

    assert abs(-1033.47938300 - rITRF[0]) < epsilon
    assert abs(+7901.29527540 - rITRF[1]) < epsilon
    assert abs(+6380.35659580 - rITRF[2]) < epsilon

    vITRF_per_second = vITRF / seconds_per_day

    epsilon = 7e-8  # Why not 1e-9, which would match all of their digits?

    assert abs(-3.225636520 - vITRF_per_second[0]) < epsilon
    assert abs(-2.872451450 - vITRF_per_second[1]) < epsilon
    assert abs(+5.531924446 - vITRF_per_second[2]) < epsilon
示例#2
0
    def find_closest_satellite(self, t, xyz, satlist):
        a = SatrecArray([sat.model for sat in satlist])
#        jd = np.array([t._utc_float()]) # skyfield 1.2x or so....
        jd = np.array([t.whole + t.tai_fraction - t._leap_seconds() / DAY_S])
        e, r, v = a.sgp4(jd, jd * 0.0)

        r = r[:,0,:]  # eliminate t axis since we only have one time
        v = v[:,0,:]
        r = r.T       # move x,y,z to top level like Skyfield expects
        v = v.T

        ut1 = np.array([t.ut1])
        r, v = TEME_to_ITRF(ut1, r, v)

        r2=np.array(xyz)
        r2.shape = 3, 1  # add extra dimension to stand in for time

#        sep_a = angle_between(r, r2)
        sep_d = length_of(r-r2)

        i = np.argmin(sep_d)

        closest_satellite = satlist[i]
#        closest_angle = sep_a[i] / tau * 360.0
        closest_distance = sep_d[i]

        if False:
            print("Position:",xyz,"at",t.utc_strftime(),":")
            for idx,s in enumerate(sorted(satlist, key=lambda sat: sat.name)):
                print("  %s: %8.2fkm %s"%(s.name,sep_d[idx],["","*"][i==idx]))

        return closest_satellite, closest_distance
示例#3
0
def TEME_to_GCRS(time, pos, vel):
    """Convert a position and velocity from TEME to GCRS coordinates, via ITRF

    * TEME: True Equator, Mean Equinox (used in TLE format and in SGP4 theory)
    * ITRF: International Terrestrial Reference Frame
    * GCRS: Geocentric Celestial Reference System (returned by method satellite.at)
    """
    pos, vel = TEME_to_ITRF(time.whole, pos, vel, 0.0, 0.0, time.ut1_fraction)
    return ITRF_to_GCRS2(time, pos, vel)
def test_appendix_c_conversion_from_TEME_to_ITRF():
    rTEME = array([5094.18016210, 6127.64465950, 6380.34453270])
    vTEME = array([-4.746131487, 0.785818041, 5.531931288])
    vTEME = vTEME * 24.0 * 60.0 * 60.0  # km/s to km/day

    jd_ut1 = JulianDate(tt=(2004, 4, 6, 7, 51, 28.386 - 0.439961)).tt

    xp = -0.140682 * arcsecond
    yp = 0.333309 * arcsecond

    rITRF, vITRF = TEME_to_ITRF(jd_ut1, rTEME, vTEME, xp, yp)

    meter = 1e-3

    assert abs(-1033.47938300 - rITRF[0]) < 0.1 * meter
    assert abs(+7901.29527540 - rITRF[1]) < 0.1 * meter
    assert abs(+6380.35659580 - rITRF[2]) < 0.1 * meter

    vITRF_per_second = vITRF * second

    assert abs(-3.225636520 - vITRF_per_second[0]) < 1e-4 * meter
    assert abs(-2.872451450 - vITRF_per_second[1]) < 1e-4 * meter
    assert abs(+5.531924446 - vITRF_per_second[2]) < 1e-4 * meter