Exemplo n.º 1
0
def extractTOWandCN0(SVprn, measData, TOWmeas, CN0meas, verbose=False):
    """
    extractTOWandCN0 axtracts for a SV the TOW and CN0 values observed per signaltype
    Parameters:
        SVprn: the ID for this SV
        measData: the measurement data from MEAS_EPOCH
        TOWmeas: array of lists that contains the TOW for this PRN and per signalType
        CN0meas: idem for CN0
    Returns:
        the signal types for this SVprn
    """
    if verbose:
        print('  Processing SVID = %d' % SVprn)

    # find indices with data for this SVID
    # print('SVprn = %s' % SVprn)
    indexSVprn = sbf2stf.indicesSatellite(SVprn, measData['MEAS_SVID'],
                                          verbose)
    # print('indexSVprn = %s' % indexSVprn)
    dataMeasSVprn = measData[indexSVprn]
    # print('dataMeasSVprn = %s' % dataMeasSVprn)

    # find indices that correspond to the signalTypes for this SVprn
    signalTypesSVprn = sbf2stf.observedSignalTypes(
        dataMeasSVprn['MEAS_SIGNALTYPE'], verbose)

    indexSignalType = []

    for index, signalType in enumerate(signalTypesSVprn):
        if verbose:
            print('      Treating signalType = %s (index=%d)' %
                  (signalType, index))

        # get the observation time span and observed CN0 for this SVprn and SignalType
        indexSignalType.extend(
            np.array(
                sbf2stf.indicesSignalType(signalType,
                                          dataMeasSVprn['MEAS_SIGNALTYPE'],
                                          verbose)))
        TOWmeas.append(dataMeasSVprn[indexSignalType[index]]['MEAS_TOW'])
        CN0meas.append(dataMeasSVprn[indexSignalType[index]]['MEAS_CN0'])

        # # print last added values
        if True:
            print('TOWmeas[%d] = %d => %d (%d)' %
                  (len(TOWmeas), TOWmeas[-1][0], TOWmeas[-1][-1],
                   np.size(TOWmeas[-1])))
            print('CN0meas[%d] = %f => %s (%d)' %
                  (len(CN0meas), CN0meas[-1][0], CN0meas[-1][-1],
                   np.size(CN0meas[-1])))

    return signalTypesSVprn
Exemplo n.º 2
0
def extractELEVATION(SVprn, dataVisibility, verbose=False):
    """
    extractELEVATION Extracts for a SV the elevation values observed
    Parameters:
        SVprn: the ID for this SV
        dataVisibility: the measurement data from SatVisibility_1
    Returns:
        the elevation for this SVprn
    """
    indexSVprnVis = sbf2stf.indicesSatellite(SVprn, dataVisibility['VISIBILITY_SVID'], verbose)
    dataVisibilitySVprn = dataVisibility[indexSVprnVis]['VISIBILITY_ELEVATION']
    # print(SVprn)
    # print(dataVisibilitySVprn)
    # sys.exit(0)

    return dataVisibilitySVprn
Exemplo n.º 3
0
def extractTOWandCN0(SVprn, measData, TOWmeas, CN0meas, verbose=False):
    """
    extractTOWandCN0 axtracts for a SV the TOW and CN0 values observed per signaltype
    Parameters:
        SVprn: the ID for this SV
        measData: the measurement data from MEAS_EPOCH
        TOWmeas: array of lists that contains the TOW for this PRN and per signalType
        CN0meas: idem for CN0
    Returns:
        the signal types for this SVprn
    """
    if verbose:
        print('  Processing SVID = %d' % SVprn)

    # find indices with data for this SVID
    # print('SVprn = %s' % SVprn)
    indexSVprn = sbf2stf.indicesSatellite(SVprn, measData['MEAS_SVID'], verbose)
    # print('indexSVprn = %s' % indexSVprn)
    dataMeasSVprn = measData[indexSVprn]
    # print('dataMeasSVprn = %s' % dataMeasSVprn)

    # find indices that correspond to the signalTypes for this SVprn
    signalTypesSVprn = sbf2stf.observedSignalTypes(dataMeasSVprn['MEAS_SIGNALTYPE'], verbose)

    indexSignalType = []

    for index, signalType in enumerate(signalTypesSVprn):
        if verbose:
            print('      Treating signalType = %s (index=%d)' % (signalType, index))

        # get the observation time span and observed CN0 for this SVprn and SignalType
        indexSignalType.extend(np.array(sbf2stf.indicesSignalType(signalType, dataMeasSVprn['MEAS_SIGNALTYPE'], verbose)))
        TOWmeas.append(dataMeasSVprn[indexSignalType[index]]['MEAS_TOW'])
        CN0meas.append(dataMeasSVprn[indexSignalType[index]]['MEAS_CN0'])

        # # print last added values
        if True:
            print('TOWmeas[%d] = %d => %d (%d)' % (len(TOWmeas), TOWmeas[-1][0], TOWmeas[-1][-1], np.size(TOWmeas[-1])))
            print('CN0meas[%d] = %f => %s (%d)' % (len(CN0meas), CN0meas[-1][0], CN0meas[-1][-1], np.size(CN0meas[-1])))

    return signalTypesSVprn
Exemplo n.º 4
0
    if not sbf2stf.verifySignalTypeOrder(dataMeas['MEAS_SIGNALTYPE'], dataExtra['EXTRA_SIGNALTYPE'], dataMeas['MEAS_TOW'], verbose):
        sys.exit(E_SIGNALTYPE_MISMATCH)

    # correct the smoothed PR Code and work with the raw PR
    dataMeas['MEAS_CODE'] = sbf2stf.removeSmoothing(dataMeas['MEAS_CODE'], dataExtra['EXTRA_SMOOTHINGCORR'], dataExtra['EXTRA_MPCORR'])
    # print('dataMeas['MEAS_CODE'] = %s\n' % dataMeas['MEAS_CODE'])

    # find list of SVIDs observed
    SVIDs = sbf2stf.observedSatellites(dataMeas['MEAS_SVID'], verbose)

    for SVID in SVIDs:
        print('=' * 50)
        gnssSyst, gnssSystShort, gnssPRN = mSSN.svPRN(SVID)
        print('SVID = %d - %s - %s%d' % (SVID, gnssSyst, gnssSystShort, gnssPRN))

        indexSVID = sbf2stf.indicesSatellite(SVID, dataMeas['MEAS_SVID'], verbose)
        dataMeasSVID = dataMeas[indexSVID]
        print("indexSVID = %s" % indexSVID)

        # store temporaray results ONLY for inspection
        nameDataMeasSVID = str(SVID) + '.csv'
        print('nameDataMeasSVID = %s' % nameDataMeasSVID)
        print('dataMeasSVID = %s' % dataMeasSVID)
        np.savetxt(nameDataMeasSVID, dataMeasSVID, fmt='%i,%.1f,%i,%i,%i,%i,%i,%.2f,%.2f,%.2f,%.2f,%i,%i,%i')

        signalTypesSVID = sbf2stf.observedSignalTypes(dataMeasSVID['MEAS_SIGNALTYPE'], verbose)
        print('signalTypesSVID = %s' % signalTypesSVID)

        # print("len dataMeas['MEAS_CODE'] %d" % len(dataMeas['MEAS_CODE']))
        # print("len dataMeasSVID['MEAS_CODE'] %d" % len(dataMeasSVID['MEAS_CODE']))
        # print dataMeasSVID['MEAS_SVID']
Exemplo n.º 5
0
    # correct the smoothed PR Code and work with the raw PR
    dataMeas['MEAS_CODE'] = sbf2stf.removeSmoothing(
        dataMeas['MEAS_CODE'], dataExtra['EXTRA_SMOOTHINGCORR'],
        dataExtra['EXTRA_MPCORR'])
    # print 'dataMeas['MEAS_CODE'] = %s\n' % dataMeas['MEAS_CODE']

    # find list of SVIDs observed
    SVIDs = sbf2stf.observedSatellites(dataMeas['MEAS_SVID'], verbose)

    for SVID in SVIDs:
        print('=' * 50)
        gnssSyst, gnssSystShort, gnssPRN = mSSN.svPRN(SVID)
        print('SVID = %d - %s - %s%d' %
              (SVID, gnssSyst, gnssSystShort, gnssPRN))

        indexSVID = sbf2stf.indicesSatellite(SVID, dataMeas['MEAS_SVID'],
                                             verbose)
        dataMeasSVID = dataMeas[indexSVID]
        # print "indexSVID = %s" % indexSVID

        # store temporaray results ONLY for inspection
        # nameDataMeasSVID = str(SVID) + '.csv'
        # np.savetxt(nameDataMeasSVID, dataMeasSVID, fmt=colFmtMeasEpoch)

        signalTypesSVID = sbf2stf.observedSignalTypes(
            dataMeasSVID['MEAS_SIGNALTYPE'], verbose)
        # print 'signalTypesSVID = %s' % signalTypesSVID

        # print "len dataMeas['MEAS_CODE'] %d" % len(dataMeas['MEAS_CODE'])
        # print "len dataMeasSVID['MEAS_CODE'] %d" % len(dataMeasSVID['MEAS_CODE'])
        # print dataMeasSVID['MEAS_SVID']
Exemplo n.º 6
0
    dateString = gpstime.UTCFromWT(WkNr, float(dataMeas['MEAS_TOW'][0])).strftime("%d/%m/%Y")
    if verbose:
        print('WkNr = %d - dateString = %s' % (WkNr, dateString))

    # correct the smoothed PR Code and work with the raw PR
    dataMeas['MEAS_CODE'] = sbf2stf.removeSmoothing(dataMeas['MEAS_CODE'], dataExtra['EXTRA_SMOOTHINGCORR'], dataExtra['EXTRA_MPCORR'])
    # print('rawPR = %s\n' % dataMeas['MEAS_CODE'])

    # find list of SVIDs from MeasEpoch and SatVisibility blocks and SignalTypes observed
    SVIDs = sbf2stf.observedSatellites(dataMeas['MEAS_SVID'], verbose)
    SVIDsVis = sbf2stf.observedSatellites(dataVisibility['VISIBILITY_SVID'], verbose)
    # print(SVIDsVis)
    # print(SVIDs)
    # sys.exit(0)
    signalTypes = sbf2stf.observedSignalTypes(dataMeas['MEAS_SIGNALTYPE'], verbose)
    indexSVprnVis = sbf2stf.indicesSatellite(dataVisibility['VISIBILITY_SVID'], verbose)
    # print(SVIDsVis)

    # create the CN0 plots for all SVs and SignalTypes
    indexSignalType = []
    dataMeasSignalType = []

    # storing data in arrays per SV and per signalType
    measTOW = []  # TOWs with measurements
    visibilityTOW = []
    measCN0 = []  # CNO values @ measTOW
    STlist = []  # list of signaltypes traversed
    SVIDlist = []  # list of SVIDs traversed
    ELEVATIONVisibility = []  # list of Elevation  traversed

    # extract first TOW and CN0 arrays for all SVs and signaltypes
Exemplo n.º 7
0
    # create subset with only valid elevation angles
    indexValid = sbf2stf.findValidElevation(dataChanSt['CHST_Elevation'], verbose)
    dataChanStValid = dataChanSt[indexValid]

    # find the list of SVIDs with valid elev/azim data
    SVIDs = sbf2stf.observedSatellites(dataChanStValid['CHST_SVID'], verbose)

    # extract for each satellite the elevation and azimuth angles
    prnElev = []
    prnAzim = []
    prnHour = []
    prnHourElev = []
    prnHourAzim = []
    for i, PRN in enumerate(SVIDs):
        print('PRN = %d' % PRN)
        indexPRN = sbf2stf.indicesSatellite(PRN, dataChanStValid['CHST_SVID'], verbose)
        prnElev.append(dataChanStValid[indexPRN]['CHST_Elevation'])
        prnAzim.append(dataChanStValid[indexPRN]['CHST_Azimuth'])

        # retain only multiples of hours to display
        prnTime = dataChanStValid[indexPRN]['CHST_TOW']
        indexHour = np.where(np.fmod(prnTime, 3600.) == 0)
        # print('indexHour = %s' % indexHour)
        prnHour.append(prnTime[indexHour])
        prnHourElev.append(dataChanStValid[indexPRN]['CHST_Elevation'][indexHour])
        prnHourAzim.append(dataChanStValid[indexPRN]['CHST_Azimuth'][indexHour])

        # print('PRN = %d - prnElev = %s' % (PRN, prnElev[-1]))
        # print('PRN = %d - prnAzim = %s' % (PRN, prnAzim[-1]))
        # print('PRN = %d - prnHour = %s' % (PRN, prnHour[-1]))
        # print('PRN = %d - prnHourElev = %s' % (PRN, prnHourElev[-1]))
Exemplo n.º 8
0
    # correct the smoothed PR Code and work with the raw PR
    dataMeas['MEAS_CODE'] = sbf2stf.removeSmoothing(
        dataMeas['MEAS_CODE'], dataExtra['EXTRA_SMOOTHINGCORR'],
        dataExtra['EXTRA_MPCORR'])
    # print('rawPR = %s\n' % dataMeas['MEAS_CODE'])

    # find list of SVIDs from MeasEpoch and SatVisibility blocks and SignalTypes observed
    SVIDs = sbf2stf.observedSatellites(dataMeas['MEAS_SVID'], verbose)
    SVIDsVis = sbf2stf.observedSatellites(dataVisibility['VISIBILITY_SVID'],
                                          verbose)
    # print(SVIDsVis)
    # print(SVIDs)
    # sys.exit(0)
    signalTypes = sbf2stf.observedSignalTypes(dataMeas['MEAS_SIGNALTYPE'],
                                              verbose)
    indexSVprnVis = sbf2stf.indicesSatellite(dataVisibility['VISIBILITY_SVID'],
                                             verbose)
    # print(SVIDsVis)

    # create the CN0 plots for all SVs and SignalTypes
    indexSignalType = []
    dataMeasSignalType = []

    # storing data in arrays per SV and per signalType
    measTOW = []  # TOWs with measurements
    visibilityTOW = []
    measCN0 = []  # CNO values @ measTOW
    STlist = []  # list of signaltypes traversed
    SVIDlist = []  # list of SVIDs traversed
    ELEVATIONVisibility = []  # list of Elevation  traversed

    # extract first TOW and CN0 arrays for all SVs and signaltypes
Exemplo n.º 9
0
    indexValid = sbf2stf.findValidElevation(dataChanSt['CHST_Elevation'],
                                            verbose)
    dataChanStValid = dataChanSt[indexValid]

    # find the list of SVIDs with valid elev/azim data
    SVIDs = sbf2stf.observedSatellites(dataChanStValid['CHST_SVID'], verbose)

    # extract for each satellite the elevation and azimuth angles
    prnElev = []
    prnAzim = []
    prnHour = []
    prnHourElev = []
    prnHourAzim = []
    for i, PRN in enumerate(SVIDs):
        print('PRN = %d' % PRN)
        indexPRN = sbf2stf.indicesSatellite(PRN, dataChanStValid['CHST_SVID'],
                                            verbose)
        prnElev.append(dataChanStValid[indexPRN]['CHST_Elevation'])
        prnAzim.append(dataChanStValid[indexPRN]['CHST_Azimuth'])

        # retain only multiples of hours to display
        prnTime = dataChanStValid[indexPRN]['CHST_TOW']
        indexHour = np.where(np.fmod(prnTime, 3600.) == 0)
        # print('indexHour = %s' % indexHour)
        prnHour.append(prnTime[indexHour])
        prnHourElev.append(
            dataChanStValid[indexPRN]['CHST_Elevation'][indexHour])
        prnHourAzim.append(
            dataChanStValid[indexPRN]['CHST_Azimuth'][indexHour])

        # print('PRN = %d - prnElev = %s' % (PRN, prnElev[-1]))
        # print('PRN = %d - prnAzim = %s' % (PRN, prnAzim[-1]))