def main(): rfn = gpstk.getPathData() + '/test_input_rinex2_obs_RinexObsFile.06o' header, data = gpstk.readRinex3Obs(rfn, strict=True) # Let's pretend we want to change something in the header # (otherwise this would be a two-line example!) header.receiverOffset = 47 # Now let's find the earliest and latest observations # function for how to compare Rinex3ObsData objects for min/max functions: timeFunction = lambda self: self.time earliest = min(data, key=timeFunction) latest = max(data, key=timeFunction) print 'Earliest time found:', gpstk.CivilTime(earliest.time) print 'Latest time found: ', gpstk.CivilTime(latest.time) # Now let's write it all back to a different file gpstk.writeRinex3Obs('rinex3obs_data.txt.new', header, data)
def main(): rfn = gpstk.getPathData() + '/test_input_rinex2_obs_RinexObsFile.06o' header, data = gpstk.readRinex3Obs(rfn, strict=True) # Let's pretend we want to change something in the header # (otherwise this would be a two-line example!) header.receiverOffset = 47 # Now let's find the earliest and latest observations # function for how to compare Rinex3ObsData objects for min/max functions: timeFunction = lambda self: self.time earliest = min(data, key=timeFunction) latest = max(data, key=timeFunction) print 'Earliest time found:', gpstk.CivilTime(earliest.time) print 'Latest time found: ', gpstk.CivilTime(latest.time) # Now let's write it all back to a different file gpstk.writeRinex3Obs( 'rinex3obs_data.txt.new', header, data)
#!/usr/bin/env python """ 1. Extract pseudorange obs 2. compute biased multipath observation. """ from __future__ import print_function from gpstk import C_MPS, GAMMA_GPS, L1_FREQ_GPS import gpstk rfn = gpstk.getPathData() + '/test_input_rinex2_obs_RinexObsFile.06o' # Make a GPSTk SatID used to find a specific satellite in the data svid = gpstk.RinexSatID(5, gpstk.SatID.systemGPS) try: header, data = gpstk.readRinex3Obs(rfn, strict=True) print(header) # Loop through all the epochs and process the data for each one for d in data: # Note that d is now a Rinex3ObsData # Check if the PRN is in view (by searching for it) if d.obs.find(svid) == d.obs.end(): print(gpstk.CivilTime(d.time), 'svid', svid, 'not in view') else: P1 = d.getObs(svid, "C1W", header).data P2 = d.getObs(svid, "C2W", header).data L1 = d.getObs(svid, "L1C", header).data
#!/usr/bin/env python """ An example of how to walk a RINEX data set and use SatID and ObsID, building an obsEpochMap of the data along the way. """ from __future__ import print_function import gpstk fn = gpstk.getPathData() + '/arlm200z.15o' # read in header and get a generator for the data header, data = gpstk.readRinex3Obs(fn) print(header) oem = gpstk.ObsEpochMap() for d in data: print(gpstk.CivilTime(d.time)) oe = gpstk.ObsEpoch() oe.time = d.time for sv in list(d.obs.keys()): # sv is an SatID object print(sv, end=' ') epoch = d.obs[sv] soe = gpstk.SvObsEpoch() soe.svid = sv for i in range(len(epoch)): rinex2_obs_type = header.R2ObsTypes[i] oid = header.mapObsTypes['G'][i] print("{}({})={}".format(oid, rinex2_obs_type, epoch[i].data), end=' ') soe[oid] = epoch[i].data
#!/usr/bin/env python """ An example of generating new rinex file (both v2,11 and v3.02. First an existing v2.11 file is read in just so we don't have to make up all the data that goes into the new files. """ import gpstk ifn = gpstk.getPathData() + '/test_input_rinex2_obs_RinexObsFile.06o' header, data = gpstk.readRinex3Obs(ifn, strict=True) new_header = gpstk.Rinex3ObsHeader() new_header.fileType = header.fileType new_header.fileProgram = header.fileProgram new_header.date = header.date new_header.fileAgency = header.fileAgency new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validRunBy new_header.markerName = header.markerName new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validMarkerName new_header.observer = header.observer new_header.agency = header.agency new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validObserver new_header.recNo = header.recNo new_header.recType = header.recType new_header.recVers = header.recVers
#!/usr/bin/env python """ An example reading a RINEX obs, nav and met file and using PRSolution2 to computer a receiver position and compare this to the position in the obs header. """ import gpstk import sys obsfn = gpstk.getPathData() + '/arlm200z.15o' navfn = gpstk.getPathData() + '/arlm200z.15n' metfn = gpstk.getPathData() + '/arlm200z.15m' navHeader, navData = gpstk.readRinex3Nav(navfn) ephStore = gpstk.gpstk.Rinex3EphemerisStore() for navDataObj in navData: ephStore.addEphemeris(navDataObj) tropModel = gpstk.GGTropModel() metHeader, metData = gpstk.readRinexMet(metfn) obsHeader, obsData = gpstk.readRinex3Obs(obsfn) indexP1 = obsHeader.getObsIndex('C1W') indexP2 = obsHeader.getObsIndex('C2W') raimSolver = gpstk.PRSolution2() for obsObj in obsData: for metObj in metData: if metObj.time >= obsObj.time:
#!/usr/bin/env python """ An example of how to walk a RINEX data set and use SatID and ObsID, building an obsEpochMap of the data along the way. """ import gpstk fn = gpstk.getPathData() + '/arlm200z.15o' # read in header and get a generator for the data header, data = gpstk.readRinex3Obs(fn) print header oem = gpstk.ObsEpochMap() for d in data: print gpstk.CivilTime(d.time) oe=gpstk.ObsEpoch() oe.time = d.time for sv in d.obs.keys(): # sv is an SatID object print sv, epoch = d.obs[sv] soe = gpstk.SvObsEpoch() soe.svid = sv for i in range(len(epoch)): rinex2_obs_type = header.R2ObsTypes[i] oid = header.mapObsTypes['G'][i] print "{}({})={}".format(str(oid), rinex2_obs_type, epoch[i].data), soe[oid] = epoch[i].data