def test(self): e = gpstk.EngAlmanac() suframe = [023222245L, 14111111324L, 4623626L, 33333531536L, 4126166634L, 17845L, 6317L, 736162361L, 83163L, 91471L] e.addSubframe(suframe, 1) g = gpstk.GPSAlmanacStore() g.addAlmanac(e)
def yuma_data(filename, prn): header, data = gpstk.readYuma(filename) sat = gpstk.SatID(prn, gpstk.SatID.systemGPS) almanac = gpstk.GPSAlmanacStore() for d in data: if prn == d.PRN: orbit = d.toAlmOrbit() almanac.addAlmanac(orbit) class yuma_holder: def __init__(self, almanacStore, satStore): self.almanacStore = almanacStore self.satStore = satStore def first_time(self): return self.almanacStore.getInitialTime() def last_time(self): return self.almanacStore.getFinalTime() def position(self, t): triple = self.almanacStore.getXvt(self.satStore, t).getPos() return triple2Position(triple) return yuma_holder(almanac, sat)
def test_almanac(self): isblock62 = (lambda x: x.blockNum == 62) header, data = gpstk.readFIC('fic_data.txt', filterfunction=isblock62, strict=True) self.assertEqual(96, len(data)) g = gpstk.GPSAlmanacStore() for d in data: orbit = d.toAlmOrbit() g.addAlmanac(orbit) sat = gpstk.SatID(4, gpstk.SatID.systemGPS) sys = gpstk.TimeSystem(gpstk.TimeSystem.GPS) t = gpstk.CivilTime(2012, 11, 10, 2, 0, 0, sys) t = t.toCommonTime() xvt= g.getXvt(sat, t) self.assertAlmostEqual(6888490.4337890595, xvt.x[0]) self.assertAlmostEqual(1036.1894772036476, xvt.v[1])