tessl install tessl/pypi-pynmea2@1.19.0Python library for parsing and generating NMEA 0183 protocol messages used in GPS and marine navigation systems
Agent Success
Agent success rate when using this tile
77%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.12x
Baseline
Agent success rate without this tile
69%
Build a Python tool that processes GPS almanac data from NMEA sentences and generates a summary report of satellite orbital parameters.
Your tool should:
The input file will contain one or more NMEA GPS almanac sentences, one per line. Each sentence provides orbital parameters for a single GPS satellite including satellite PRN number, GPS week number, health status, eccentricity, and other orbital elements.
The tool should output a text report with the following structure:
GPS Almanac Summary
===================
Total Satellites: <count>
Satellite PRNs: <comma-separated list>
Healthy Satellites: <count>
Unhealthy Satellites: <count>
Average Eccentricity: <value>Input file (almanac_data.txt):
$GPALM,1,1,15,1159,00,4310,7b,145f,fd44,a10ce4,1cbe,-12,1,2*5e
$GPALM,1,1,26,1159,00,4308,7b,1472,fd8c,a10d56,2761,0,1,2*4fExpected output:
GPS Almanac Summary
===================
Total Satellites: 2
Satellite PRNs: 15, 26
Healthy Satellites: 2
Unhealthy Satellites: 0
Average Eccentricity: 0.00799@generates
Create a Python script that reads the input file, processes each ALM sentence, and prints the summary report to stdout.
def parse_almanac_file(filename: str) -> dict:
"""
Parse GPS almanac sentences from a file.
Args:
filename: Path to file containing NMEA ALM sentences
Returns:
Dictionary with keys:
- 'total_satellites': int
- 'prn_numbers': list of int
- 'healthy_count': int
- 'unhealthy_count': int
- 'avg_eccentricity': float
"""
pass
def generate_report(data: dict) -> str:
"""
Generate a formatted summary report from parsed almanac data.
Args:
data: Dictionary from parse_almanac_file()
Returns:
Formatted report string
"""
passProvides NMEA 0183 sentence parsing support for GPS almanac data.