예제 #1
0
    def test_readRinex3Obs(self):
        """Test reading entire rinex obs file and spot check the data"""
        header, data = gpstk.readRinex3Obs(args.input_dir + "/arlm200a.15o",
                                           strict=True)

        # 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)

        self.assertEqual(
            gpstk.CivilTime(2015, 7, 19, 0, 0, 0,
                            gpstk.TimeSystem(gpstk.TimeSystem.GPS)),
            gpstk.CivilTime(earliest.time))

        self.assertEqual(
            gpstk.CivilTime(2015, 7, 19, 0, 59, 30,
                            gpstk.TimeSystem(gpstk.TimeSystem.GPS)),
            gpstk.CivilTime(latest.time))
예제 #2
0
def main():
    # Read in data, strict=True makes dataSets a list rather than a generator:
    header, dataSets = gpstk.readSEM('sem_data.txt', strict=True)

    # Write the data back to a different file (their contents should match):
    gpstk.writeSEM('sem_data.txt.new', header, dataSets)

    # Read the orbit out of the data:
    orbit = dataSets[0].toAlmOrbit()  # alm orbit of first data point

    austin = gpstk.Position(30, 97, 0, gpstk.Position.Geodetic)  # Austin, TX

    starttime = gpstk.CommonTime()  # iterator time to start at
    starttime.setTimeSystem(gpstk.TimeSystem('GPS'))
    endtime = gpstk.CommonTime()  # end time, 1 day later (see below)
    endtime.setTimeSystem(gpstk.TimeSystem('GPS'))
    endtime.addDays(1)

    X = []
    Y = []

    # Step through a day, adding plot points:
    for t in gpstk.times(starttime, endtime, seconds=1000):
        xvt = orbit.svXvt(t)
        location = gpstk.Position(xvt.x)
        elevation = austin.elevation(location)
        X.append(t.getDays())
        Y.append(elevation)

    # Make the plot
    fig = plt.figure()
    fig.suptitle('Elevation of a GPS satellite throughout the day',
                 fontsize=14,
                 fontweight='bold')
    ax = fig.add_subplot(111)
    ax.set_xlabel('Time (days)')
    ax.set_ylabel('Elevation (degrees)')
    plt.plot(X, Y, 'r')
    plt.show()
예제 #3
0
 def test_stream(self):
     header, data = gpstk.readRinex3Obs('rinex3obs_data.txt', strict=True)
     self.assertEqual(0L, header.numSVs)
     self.assertEqual('NATIONAL IMAGERY AND MAPPING AGENCY', header.agency)
     self.assertEqual(120, len(data))
     dataPoint = data[0]
     datum = dataPoint.getObs(gpstk.SatID(4), header.getObsIndex("C1"))
     self.assertAlmostEqual(24236698.057, datum.data)
     self.assertEqual(0, dataPoint.clockOffset)
     expectedTime = gpstk.CommonTime()
     expectedTime.set(2453167)
     expectedTime.setTimeSystem(gpstk.TimeSystem(gpstk.TimeSystem.GPS))
     self.assertEqual(expectedTime, dataPoint.time)
예제 #4
0
 def test(self):
     a = gpstk.ANSITime()
     a.scanf("1234567789", "%K")
     a.setTimeSystem(gpstk.TimeSystem('GLO'))
     b = a.toCommonTime()
     c = gpstk.MJD(b)
     d = gpstk.GPSWeekSecond(b)
     e = gpstk.CivilTime(b)
     f = gpstk.QZSWeekSecond(b)
     self.assertEqual('1234567789 GLO', str(a))
     self.assertEqual('2454876 84589000 0.000000000000000 GLO', str(b))
     self.assertEqual('54875.979039352 GLO', str(c))
     self.assertEqual('1518 516589.000000 GLO', str(d))
     self.assertEqual('02/13/2009 23:29:49 GLO', str(e))
     self.assertEqual('1518 516589.000000 GLO', str(f))
예제 #5
0
    def test_ephemeris(self):
        isblock9 = (lambda x: x.blockNum == 9)
        header, data = gpstk.readFIC('fic_data.txt', filterfunction=isblock9, strict=True)
        g = gpstk.GPSEphemerisStore()
        for d in data:
            ephem = gpstk.Rinex3NavData(d.toEngEphemeris())
            g.addEphemeris(ephem)

        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(6887268.768807452, xvt.x[0])
        self.assertAlmostEqual(1036.3167828001287, xvt.v[1])
예제 #6
0
    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])
예제 #7
0
    def test_standard_times(self):
        timeSystem = gpstk.TimeSystem('GPS')

        t1 = gpstk.UnixTime(1370983244, 659200)  # in 2013
        t1 = t1.toCommonTime()
        t1.setTimeSystem(timeSystem)

        t2 = gpstk.CivilTime(2012, 11, 6, 20, 40, 400)  # in 2012
        t2 = t2.toCommonTime()
        t2.setTimeSystem(timeSystem)

        self.assertEqual(False, t1 < t2)
        self.assertEqual(False, t1 <= t2)
        self.assertEqual(True, t1 > t2)
        self.assertEqual(True, t1 >= t2)
        self.assertEqual(False, t1 == t2)
        self.assertEqual(True, t1 != t2)
예제 #8
0
    def test_equal_common_times(self):
        timeSystem = gpstk.TimeSystem('GPS')

        t1 = gpstk.CommonTime(timeSystem)
        t1.addDays(3)

        t2 = gpstk.CommonTime(timeSystem)
        t2.addSeconds(2 * gpstk.constants.SEC_PER_DAY)  # add 2 days
        t2 += (2 * gpstk.constants.SEC_PER_DAY)  # add 2 more days
        t2 -= (1 * gpstk.constants.SEC_PER_DAY)  # subtract a day

        self.assertEqual(False, t1 < t2)
        self.assertEqual(True, t1 <= t2,)
        self.assertEqual(False, t1 > t2)
        self.assertEqual(True, t1 >= t2)
        self.assertEqual(True, t1 == t2)
        self.assertEqual(False, t1 != t2)
예제 #9
0
def process(input_file, output_file):
    try:
        print 'Reading {}.'.format(input_file)
        header, data = gpstk.readRinex3Obs(input_file)  # read in everything
        #print header

        new_header = gpstk.Rinex3ObsHeader()

        # Initially, valid = 0L, but other values get masked into it.
        new_header.version = header.version
        new_header.fileType = header.fileType
        new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validVersion

        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
        new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validReceiver

        new_header.antNo = header.antNo
        new_header.antType = header.antType
        new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validAntennaType

        newAntPosition = gpstk.Triple(header.antennaPosition[0],
                                      header.antennaPosition[1],
                                      header.antennaPosition[2])
        new_header.antennaPosition = newAntPosition
        new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validAntennaPosition

        newAntDelta = gpstk.Triple(header.antennaDeltaHEN[0],
                                   header.antennaDeltaHEN[1],
                                   header.antennaDeltaHEN[2])
        new_header.antennaDeltaHEN = newAntDelta
        new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validAntennaDeltaHEN

        # This is kind of odd.  The Rinex3ObsHeader can handle both V3 and V2
        # formatted files.  The two versions handle observation types differently.
        # - The first structure "mapObsTypes" holds the V3 definitions in a
        # "dictionary of lists" (or "map of vectors" in c++)
        # - The second structure "R2ObsTypes" holds the V2 definitions and is
        # stored as list of strings (or Vector of Strings in c++)
        # It's not clear whether either or both are necessary to write a file.
        # It DOES seem to be clear that both will be available after reading a file.

        for rinObsType in header.mapObsTypes:
            #print "Found obs-type:{}".format(rinObsType)
            newObsIds = []
            for rinObsId in header.mapObsTypes[rinObsType]:
                #print "Found obs-id:{}".format(str(rinObsId))
                #print " --type={} code={} band={}".format(rinObsId.type, rinObsId.code, rinObsId.band)
                newObsId = gpstk.RinexObsID(str(rinObsId))
                newObsIds.append(newObsId)
            new_header.mapObsTypes[rinObsType] = tuple(newObsIds)
        new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validNumObs

        for rin_obs_id in header.R2ObsTypes:
            #print "Found obs-id:{}".format(rin_obs_id)
            new_header.R2ObsTypes.append(rin_obs_id)
        new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validNumObs

        # This creates a new CivilTime object that we can populate
        new_header.firstObs = gpstk.CivilTime()
        new_header.firstObs.year = header.firstObs.year
        new_header.firstObs.month = header.firstObs.month
        new_header.firstObs.day = header.firstObs.day
        new_header.firstObs.hour = header.firstObs.hour
        new_header.firstObs.minute = header.firstObs.minute
        new_header.firstObs.second = header.firstObs.second
        new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validFirstTime

        new_header.markerNumber = header.markerNumber
        new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validMarkerNumber

        new_header.interval = header.interval
        new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validInterval

        #####
        # Unfortunately, sigStrengthUnit is tied to the wavelengthFactor property,
        # We cannot set the latter due to a missing SWIG Python adapter, and
        # because the same "validity flag" governs both, we can't output
        # sigStrengthUnit without inadvertently outputting a bogus wavelengthFactor.
        #####
        #new_header.wavelengthFactor = header.wavelengthFactor
        #new_header.sigStrengthUnit = header.sigStrengthUnit
        #new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validSigStrengthUnit

        for comment in header.commentList:
            new_header.commentList.append(comment)
        new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validComment

        new_header.validEoH = True

        # This method is a huge hack to get around a problem in the Rinex3ObsData
        # writer.  See the method for details.
        new_header = tweakInternalHeaderState(new_header)
        #print new_header

        processed_data = []
        # Now we loop through all the epochs and process the data for each one
        for d in data:

            # This creates a new CommonTime object with the system set to GPS.
            timec = gpstk.CommonTime(gpstk.TimeSystem(gpstk.TimeSystem.GPS))
            # This creates a new CommonTime object with the system set to GPS.
            mjd = int(d.time.getDays())
            sod = float(d.time.getSecondOfDay())
            timec.set(mjd, sod, gpstk.TimeSystem(gpstk.TimeSystem.GPS))

            # Assign values to a new Rinex Obs Data object
            nd = gpstk.Rinex3ObsData()
            nd.time = timec
            nd.auxHeader = d.auxHeader
            nd.clockOffset = d.clockOffset
            nd.epochFlag = d.epochFlag
            nd.numSVs = d.numSVs

            for satkey in d.obs.keys():
                newSatKey = gpstk.RinexSatID(satkey.toString())
                satObss = d.obs[newSatKey]
                # satObss is a tuple of  RinexDatum
                newSatObss = []
                for satObs in satObss:
                    #print "{} {} {} {}".format(satkey.toString(), satObs.data, satObs.lli, satObs.ssi)
                    newSatObs = gpstk.RinexDatum()
                    newSatObs.data = satObs.data
                    newSatObs.lli = satObs.lli
                    newSatObs.ssi = satObs.ssi
                    newSatObss.append(newSatObs)

                nd.obs[newSatKey] = tuple(newSatObss)

            #print "O{}".format(d)
            #print "S{}".format(nd)
            processed_data.append(nd)

        gpstk.writeRinex3Obs(output_file, new_header, processed_data)
        print "Wrote output file: {}".format(output_file)

    # We can catch any custom gpstk exception like this:
    except gpstk.Exception as e:
        print e
예제 #10
0
def main(args=sys.argv[1:]):
    program_description = ('Converts from a given input time specification to '
                           'other time formats. Include the quotation marks. '
                           'All year values are four digit years.')
    parser = argparse.ArgumentParser(description=program_description)

    group = parser.add_mutually_exclusive_group()
    group.add_argument('-A', '--ansi', help='\"ANSI-Second\"')
    group.add_argument('-c', '--civil',
                       help='\"Month(numeric) DayOfMonth Year Hour:Minute:Second\"')
    group.add_argument('-R', '--rinex',
                       help='\"Year(2-digit) Month(numeric) DayOfMonth Hour Minute Second\"')
    group.add_argument('-o', '--ews', help='\"GPSEpoch 10bitGPSweek SecondOfWeek\"')
    group.add_argument('-f', '--ws', help='\"FullGPSWeek SecondOfWeek\"')
    group.add_argument('-w', '--wz', help='\"FullGPSWeek Zcount\"')
    group.add_argument('--z29', help='\"29bitZcount\"')
    group.add_argument('-Z', '--z32', help='\"32bitZcount\"')
    group.add_argument('-j', '--julian', help='\"JulianDate\"')
    group.add_argument('-m', '--mjd', help='\"ModifiedJulianDate\"')
    group.add_argument('-u', '--unixtime', help='\"UnixSeconds UnixMicroseconds\"')
    group.add_argument('-y', '--doy', help='\"Year DayOfYear SecondsOfDay\"')

    parser.add_argument('-F', '--output_format', help='Time format to use on output')

    parser.add_argument('-a', '--add_offset', type=int, nargs='+',
                        help='add NUM seconds to specified time')
    parser.add_argument('-s', '--sub_offset', type=int, nargs='+',
                        help='subtract NUM seconds to specified time')
    args = parser.parse_args(args)

    # these format keys must match the long arg names
    formats = {
        'ansi': '%K',
        'civil': '%m %d %Y %H:%M:%f',
        'rinex': '%y %m %d %H %M %S',
        'ews': '%E %G %g',
        'ws': '%F %g',
        'wz': '%F %Z',
        'z29': '%E %c',
        'z32': '%C',
        'julian': '%J',
        'mjd': '%Q',
        'unixtime': '%U',
        'doy': '%Y %j %s'
    }

    time_found = False
    for key in formats:
        input_time = getattr(args, key)  # args.ansi, args.civil, etc.
        if input_time is not None:
            try:
                ct = gpstk.scanTime(input_time, formats[key])
                time_found = True
            except gpstk.exceptions.InvalidRequest:
                raise gpstk.exceptions.InvalidRequest('Input could not be parsed.'
                                                      '\nCheck formatt, ensure that the input is both valid and in quotes.'
                                                      '\nCheck if time is too early/late for these formats.')

    if not time_found:
        ct = gpstk.SystemTime().toCommonTime()

    ct.setTimeSystem(gpstk.TimeSystem('GPS'))

    if args.add_offset is not None:
        for t in args.add_offset:
            ct.addSeconds(float(t))
    if args.sub_offset is not None:
        for t in args.sub_offset:
            ct.addSeconds(-float(t))

    if args.output_format is not None:
        print((gpstk.printTime(ct, args.output_format)))
    else:
        def left_align(str):
            spacing = ' ' * 8
            return spacing + str.ljust(31)

        print('')  # newline

        print(left_align('Month/Day/Year H:M:S'), end=' ')
        print(gpstk.CivilTime(ct))

        print(left_align('Modified Julian Date'), end=' ')
        print(gpstk.MJD(ct))

        print(left_align('GPSweek DayOfWeek SecOfWeek'), end=' ')
        print(gpstk.GPSWeekSecond(ct).printf('%G %w % 13.6g'))

        print(left_align('FullGPSweek Zcount'), end=' ')
        print(gpstk.GPSWeekZcount(ct).printf('%F % 6z'))

        print(left_align('Year DayOfYear SecondOfDay'), end=' ')
        print(gpstk.YDSTime(ct).printf('%Y %03j % 12.6s'))

        print(left_align('Unix: Second Microsecond'), end=' ')
        print(gpstk.UnixTime(ct).printf('%U % 6u'))

        print(left_align('Zcount: 29-bit (32-bit)'), end=' ')
        print(gpstk.GPSWeekZcount(ct).printf('%c (%C)'))

        print('')  # newline
예제 #11
0
def main(args=sys.argv[1:]):
    program_description = ("Converts from a given input time specification to "
                           "other time formats. Include the quotation marks. "
                           "All year values are four digit years.")
    parser = argparse.ArgumentParser(description=program_description)

    group = parser.add_mutually_exclusive_group()
    group.add_argument("-A", "--ansi", help='"ANSI-Second"')
    group.add_argument(
        "-c",
        "--civil",
        help='"Month(numeric) DayOfMonth Year Hour:Minute:Second"')
    group.add_argument(
        "-R",
        "--rinex",
        help='"Year(2-digit) Month(numeric) DayOfMonth Hour Minute Second"')
    group.add_argument("-o",
                       "--ews",
                       help='"GPSEpoch 10bitGPSweek SecondOfWeek"')
    group.add_argument("-f", "--ws", help='"FullGPSWeek SecondOfWeek"')
    group.add_argument("-w", "--wz", help='"FullGPSWeek Zcount"')
    group.add_argument("--z29", help='"29bitZcount"')
    group.add_argument("-Z", "--z32", help='"32bitZcount"')
    group.add_argument("-j", "--julian", help='"JulianDate"')
    group.add_argument("-m", "--mjd", help='"ModifiedJulianDate"')
    group.add_argument("-u",
                       "--unixtime",
                       help='"UnixSeconds UnixMicroseconds"')
    group.add_argument("-y", "--doy", help='"Year DayOfYear SecondsOfDay"')

    parser.add_argument("-F",
                        "--output_format",
                        help="Time format to use on output")

    parser.add_argument("-a",
                        "--add_offset",
                        type=int,
                        nargs="+",
                        help="add NUM seconds to specified time")
    parser.add_argument("-s",
                        "--sub_offset",
                        type=int,
                        nargs="+",
                        help="subtract NUM seconds to specified time")
    args = parser.parse_args(args)

    # these format keys must match the long arg names
    formats = {
        "ansi": "%K",
        "civil": "%m %d %Y %H:%M:%f",
        "rinex": "%y %m %d %H %M %S",
        "ews": "%E %G %g",
        "ws": "%F %g",
        "wz": "%F %Z",
        "z29": "%E %c",
        "z32": "%C",
        "julian": "%J",
        "mjd": "%Q",
        "unixtime": "%U",
        "doy": "%Y %j %s",
    }

    time_found = False
    for key in formats:
        input_time = getattr(args, key)  # args.ansi, args.civil, etc.
        if input_time is not None:
            try:
                ct = gpstk.scanTime(input_time, formats[key])
                time_found = True
            except gpstk.exceptions.InvalidRequest:
                raise gpstk.exceptions.InvalidRequest(
                    "Input could not be parsed."
                    "\nCheck formatt, ensure that the input is both valid and in quotes."
                    "\nCheck if time is too early/late for these formats.")

    if not time_found:
        ct = gpstk.SystemTime().toCommonTime()

    ct.setTimeSystem(gpstk.TimeSystem("GPS"))

    if args.add_offset is not None:
        for t in args.add_offset:
            ct.addSeconds(float(t))
    if args.sub_offset is not None:
        for t in args.sub_offset:
            ct.addSeconds(-float(t))

    if args.output_format is not None:
        print((gpstk.printTime(ct, args.output_format)))
    else:

        def left_align(txt: str):
            spacing = " " * 8
            return spacing + txt.ljust(31)

        print("")  # newline

        print(left_align("Month/Day/Year H:M:S"), end=" ")
        print(gpstk.CivilTime(ct))

        print(left_align("Modified Julian Date"), end=" ")
        print(gpstk.MJD(ct))

        print(left_align("GPSweek DayOfWeek SecOfWeek"), end=" ")
        print(gpstk.GPSWeekSecond(ct).printf("%G %w % 13.6g"))

        print(left_align("FullGPSweek Zcount"), end=" ")
        print(gpstk.GPSWeekZcount(ct).printf("%F % 6z"))

        print(left_align("Year DayOfYear SecondOfDay"), end=" ")
        print(gpstk.YDSTime(ct).printf("%Y %03j % 12.6s"))

        print(left_align("Unix: Second Microsecond"), end=" ")
        print(gpstk.UnixTime(ct).printf("%U % 6u"))

        print(left_align("Zcount: 29-bit (32-bit)"), end=" ")
        print(gpstk.GPSWeekZcount(ct).printf("%c (%C)"))

        print("")  # newline
# these to be set. Since the input to this program is RINEX v2.11,
# what should happen is that the Rinex3ObsHeader should fill in default values
# for the SystemPhaseShift and not require the two glonass since there is no
# glonass data in the source
new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validSystemPhaseShift
new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validGlonassSlotFreqNo
new_header.valid = new_header.valid | gpstk.Rinex3ObsHeader.validGlonassCodPhsBias

print new_header

new_data = []
# Now we loop through all the epochs and process the data for each one
for d in data:

    # This creates a new CommonTime object with the system set to GPS.
    timec = gpstk.CommonTime(gpstk.TimeSystem(gpstk.TimeSystem.GPS))
    # This creates a new CommonTime object with the system set to GPS.
    mjd = int(d.time.getDays())
    sod = float(d.time.getSecondOfDay())
    timec.set(mjd, sod, gpstk.TimeSystem(gpstk.TimeSystem.GPS))

    # Assign values to a new Rinex Obs Data object
    nd = gpstk.Rinex3ObsData()
    nd.time = timec
    nd.auxHeader = d.auxHeader
    nd.clockOffset = d.clockOffset
    nd.epochFlag= d.epochFlag
    nd.numSVs = d.numSVs

    for satkey in d.obs.keys():
        newSatKey = gpstk.RinexSatID(satkey.toString())
예제 #13
0
 def test_exception(self):
     # subtracting 2 CommonTimes throws an InvalidRequest
     a = gpstk.CommonTime(gpstk.TimeSystem('GPS'))
     b = gpstk.CommonTime(gpstk.TimeSystem('GLO'))
     self.assertRaises(gpstk.InvalidRequest, a.__sub__, b)
예제 #14
0
 def test_constructor_constant(self):
     sys = gpstk.TimeSystem(gpstk.TimeSystem.GPS)
     self.assertEqual('GPS', str(sys))
     self.assertEqual(gpstk.TimeSystem.GPS, sys.getTimeSystem())
예제 #15
0
import gpstk
from matplotlib.pyplot import figure, show

# Read in data, strict=True makes dataSets a list rather than a generator:
header, dataSets = gpstk.readSEM("data/sem_data.txt", strict=True)

# Write the data back to a different file (their contents should match):
gpstk.writeSEM("sem_data.txt.new", header, dataSets)

# Read the orbit out of the data:
orbit = dataSets[0].toAlmOrbit()  # alm orbit of first data point

austin = gpstk.Position(30, 97, 0, gpstk.Position.Geodetic)  # Austin, TX

starttime = gpstk.CommonTime()  # iterator time to start at
starttime.setTimeSystem(gpstk.TimeSystem("GPS"))
endtime = gpstk.CommonTime()  # end time, 1 day later (see below)
endtime.setTimeSystem(gpstk.TimeSystem("GPS"))
endtime.addDays(1)
# %% Step through a day, adding plot points:
d = []
el = []
for t in gpstk.times(starttime, endtime, seconds=1000):
    d.append(t.getDays())
    xvt = orbit.svXvt(t)
    location = gpstk.Position(xvt.x)
    el.append(austin.elevation(location))

# Make the plot
fig = figure()
ax = fig.gca()
예제 #16
0
from matplotlib.pyplot import figure, show


# Read in data, strict=True makes dataSets a list rather than a generator:
header, dataSets = gpstk.readSEM('data/sem_data.txt', strict=True)

# Write the data back to a different file (their contents should match):
gpstk.writeSEM('sem_data.txt.new', header, dataSets)

# Read the orbit out of the data:
orbit = dataSets[0].toAlmOrbit()  # alm orbit of first data point

austin = gpstk.Position(30, 97, 0, gpstk.Position.Geodetic)  # Austin, TX

starttime = gpstk.CommonTime()    # iterator time to start at
starttime.setTimeSystem(gpstk.TimeSystem('GPS'))
endtime = gpstk.CommonTime()  # end time, 1 day later (see below)
endtime.setTimeSystem(gpstk.TimeSystem('GPS'))
endtime.addDays(1)
# %% Step through a day, adding plot points:
d = []
el = []
for t in gpstk.times(starttime, endtime, seconds=1000):
    d.append(t.getDays())
    xvt = orbit.svXvt(t)
    location = gpstk.Position(xvt.x)
    el.append(austin.elevation(location))


# Make the plot
fig = figure()