def test_ephem_store(self): ephem = gpstk.SP3EphemerisStore() ephem.rejectBadPositions(True) ephem.rejectBadClocks(True) ephem.loadFile(gpstk.data.full_path("sp3_data.txt")) t = ephem.getInitialTime() t.addSeconds(60 * 120) # 2 hours into data s = gpstk.SatID(1) p = ephem.getPosition(s, t) self.assertAlmostEqual(17359099.884999998, p[0]) self.assertAlmostEqual(-483028.55, p[1]) self.assertAlmostEqual(-19921938.297000002, p[2])
def sp3_data(filename, prn): store = gpstk.SP3EphemerisStore() store.loadFile(filename) sat = gpstk.SatID(prn) class sp3_holder: def __init__(self, sp3Store, satStore): self.sp3Store = sp3Store self.satStore = satStore def first_time(self): return self.sp3Store.getPositionInitialTime(self.satStore) def last_time(self): return self.sp3Store.getPositionFinalTime(self.satStore) def position(self, t): triple = self.sp3Store.getPosition(self.satStore, t) return triple2Position(triple) return sp3_holder(store, sat)