Python library for parsing and generating NMEA 0183 protocol messages used in GPS and marine navigation systems
77
Build a GPS data stream processor that reads marine navigation sentences from continuous data streams and extracts position information.
The processor should handle continuous streams of GPS data (e.g., from serial ports, network sockets, or files). The stream may contain:
Extract and track GPS position data including:
The processor must handle errors appropriately:
The processor should output position data in a readable format showing:
@generates
class GPSStreamProcessor:
"""
Processes continuous streams of GPS navigation data and extracts position information.
The processor handles buffering of partial lines, parsing of navigation sentences,
and extraction of position data with appropriate error handling.
"""
def __init__(self, error_mode='raise'):
"""
Initialize the GPS stream processor.
Args:
error_mode (str): How to handle parsing errors. Options: 'raise', 'ignore', 'yield'
"""
pass
def process_stream(self, stream):
"""
Process a stream of GPS data and yield position information.
Args:
stream: An iterable that yields chunks of GPS data (strings or bytes)
Yields:
dict: Position information with keys 'timestamp', 'latitude', 'longitude', 'valid'
"""
pass
def process_file(self, file_path):
"""
Process a file containing GPS data and return all positions.
Args:
file_path (str): Path to the file containing GPS data
Returns:
list: List of position dictionaries
"""
passProvides NMEA 0183 sentence parsing and stream processing support.
Install with Tessl CLI
npx tessl i tessl/pypi-pynmea2docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10