Skip to content

Commit

Permalink
Making sure that SV IDs in non-merged GSA sentences end up in correct…
Browse files Browse the repository at this point in the history
… GP vs GL dataframe columns
  • Loading branch information
nabelekt committed Jan 17, 2021
1 parent 8df6b5c commit 59e1fe0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions nmea_data_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,21 @@ def sentences_to_dataframes(sentence_sets):
row_data.insert(4, dts_sentence.sentence.talker)
row_data.insert(5, dts_sentence.sentence.sentence_type)

# For non-merged GSV or GSA sentences with more data than merged sentences, fill with NaNs where there is no data
# For non-merged GSV or GSA sentences with less data than merged sentences, fill with NaNs where there is no data
if sentence_type in ['GSV', 'GSA'] and not sentence_is_merged:
placeholders = [np.NaN] * (len(columns) - len(row_data))
if sentence_type == 'GSV':
row_data = row_data + placeholders
elif sentence_type == 'GSA':
row_data = row_data[:-3] + placeholders + row_data[-3:]
# Make sure SV ID data gets put in correct (GP vs GL) columns
sv_ids_in_sentence = row_data[8:20]
glonass_ids = range(65,96+1) # See notes in MergedSentence_GSA class
# Row data consists of: 6 elements inserted above, 2 elements, 12 SV IDs, 3 elements
# Columns/fields consist of: 6 elements inserted above, 2 elements, 12 GP SV IDs, 12 GL SV IDs, 3 elements
if len(set(sv_ids_in_sentence) & set(glonass_ids)): # If there are GLONASS SV IDs in the sentence
row_data = row_data[:-15] + placeholders + row_data[-15:]
else:
row_data = row_data[:-3] + placeholders + row_data[-3:]

list_of_data_rows.append(row_data)

Expand Down

0 comments on commit 59e1fe0

Please sign in to comment.