예제 #1
0
def test_rotating_vector_into_frame():
    et_seconds = 259056665.1855896
    ts = load.timescale()
    t = ts.tdb_jd(T0 + et_seconds / 3600. / 24.0)

    pc = PlanetaryConstants()
    pc.read_text(load('moon_080317.tf'))
    pc.read_binary(load('moon_pa_de421_1900-2050.bpc'))

    # Example from "moon_080317.tf" (the raw vector is taken from a
    # tweaked version of the script in the file that uses "J2000"):

    vector = ICRF(
        np.array([
            2.4798273371071659e+05, -2.6189996683651494e+05,
            -1.2455830876097400e+05
        ]) / AU_KM)
    vector.t = t
    meter = 1e-3

    frame = pc.build_frame_named('MOON_PA_DE421')
    result = vector.frame_xyz(frame)
    assert max(abs(result.km - [379908.634, 33385.003, -12516.8859])) < meter

    relative_frame = pc.build_frame_named('MOON_ME_DE421')
    result = vector.frame_xyz(relative_frame)
    assert max(abs(result.km - [379892.825, 33510.118, -12661.5278])) < meter
예제 #2
0
from skyfield.api import Topos, load
from skyfield.api import EarthSatellite
from skyfield.positionlib import ICRF
from skyfield.positionlib import Geometric
from skyfield.positionlib import Barycentric
ts = load.timescale()

thisx = 4085.0136322698854
thisy = -1852.4897691900894
thisz =  -4916.7862179899175

vec = ICRF([thisx,thisy,thisz])
vec.t = ts.utc(2020, 3, 18, 3, 36, 35.0)

vecG1 = Geometric([thisx,thisy,thisz])
vecG1.t = ts.utc(2020, 3, 18, 3, 36, 35.0)



satellites = load.tle_file('fullcatalog.txt')
print( 'Loaded', len(satellites), 'satellites')

firsttime = ts.utc(2020, 3, 18, 3, 36, 35.0)



for sat in satellites:
    geocentric = sat.apparent(firsttime)
    thatx, thaty, thatz = geocentric.position.km
    print(geocentric.position.km)
    #if (thatx == thisx):