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
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
# determine current weeknumber and subsequent date from SBF data WkNr = int(dataMeas['MEAS_WNC'][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 and SignalTypes observed SVIDs = sbf2stf.observedSatellites(dataMeas['MEAS_SVID'], verbose) signalTypes = sbf2stf.observedSignalTypes(dataMeas['MEAS_SIGNALTYPE'], verbose) # create the CN0 plots for all SVs and SignalTypes indexSignalType = [] dataMeasSignalType = [] # storing data in arrays per SV and per signalType measTOW = [] # TOWs with measurements measCN0 = [] # CNO values @ measTOW STlist = [] # list of signaltypes traversed SVIDlist = [] # list of SVIDs traversed # extract first TOW and CN0 arrays for all SVs and signaltypes for SVID in SVIDs: signalTypesSVID = extractTOWandCN0(SVID, dataMeas, measTOW, measCN0, 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'] indexSignalType = [] dataMeasSVIDSignalType = [] lliIndicators = [] lliTOWs = [] firstTOW = [] for index, signalType in enumerate(signalTypesSVID): print('-' * 25) print("signalType = %s index=%d - name = %s\n" % (signalType, index, mSSN.GNSSSignals[signalType]['name']))