Knio / pynmea2

Python library for parsing the NMEA 0183 protocol (GPS)
MIT License
634 stars 223 forks source link

Can't Parse: $IIMWV' #136

Open cbitterfield opened 3 years ago

cbitterfield commented 3 years ago

Sentence: ['$IIMWV', '343.0,R,8.4,N,A35\r\n$IIVWR,343.0,R,8.4,N,4.3,M,15.6,K74\r\n']

Among other sentences that don't decode. ['$IIMWV', '$IIHDM', '$IIVHW', '$APVTG', '$APVTG\x08', '$APHDM', '$\x00PH\x00M', '$STALK', '$HCHDG', '$IIDBT', '$APRSA', '$IIRMC', '$\x00PR\x02A', '$APHDG', '$ECGLL', '$IIMTW', '$I\tRM\x03']

The equipment onboard is Raymarine (AP400), Garmin Chartplotters and Class "A" AIS (A100).

Attaching a text file of raw data for use as well.

{'$IIMWV': "['$IIMWV', '292.0', 'R', '8.1', 'N', 'A*3D\\r\\n$IIVWR', '292.0', 'R', '8.1', 'N', '4.2', 'M', '15.0', 'K*7B\\r\\n']",
 '$IIHDM': "['$IIHDM', '28.0', 'M*18\\r\\n$HCHDG', '', '', '', '', '*6C\\r\\n']",
 '$IIVHW': "['$IIVHW', '', 'T', '', 'M', '0.0', 'N', '', 'K*7B\\r\\n$IIMTW', '24.0', 'C*15\\r\\n']",
 '$APVTG': "['$APVTG', '', 'T', '', 'M', '0.0', 'N', '', 'K', 'D* E\\r\\n']",
 '$APVTG\x08': "['$APVTG\\x08', 'T', '', 'M', '0.0\\x08N', '', 'K', 'D*0E\\r\\n']",
 '$APHDM': "['$APHDM', '051.8', 'M*3F\\r\\n$IIVHW', '', 'T', '', 'M', '0.0', 'N', '', 'K*7B\\r\\n$IIMTW', '24.0', 'C*15\\r\\n$IIVHW', '', 'T', '', 'M', '0.00', 'N', '', 'K*4B\\r\\n']",
 '$\x00PH\x00M': "['$\\x00PH\\x00M', '0 8. ', 'M*3E\\r\\n']",
 '$STALK': "['$STALK', '9C', 'C1', '26', 'F9*32\\r\\n$IIDBT', '8.9', 'f', '2.7', 'M', '1.5', 'F*11\\r\\n']",

nema_data.txt

'$HCHDG': "['$HCHDG', '', '', '', '', '*6C\\r\\n$IIRMC', '', 'A', '', '', '', '', '', '', '131121', '', 'A*71\\r\\n']",
 '$IIDBT': "['$IIDBT', '8.3', 'f', '2.5', 'M', '1.4', 'F*18\\r\\n$IIVHW', '', 'T', '', 'M', '0.0', 'N', '', 'K*7B\\r\\n$APVTG', '', 'T', '', 'M', '0.0', 'N', '', 'K', 'D*0E\\r\\n$STALK', '9C', '81', '27', 'F9*48\\r\\n']",
 '$APRSA': "['$APRSA', '-7.6', 'A*12\\r\\n$IIHDM', '43.0', 'M*15\\r\\n']",
 '$IIRMC': "['$IIRMC', '231300', 'A', '2904.000', 'N', '00056.213', 'W', '0.0', '', '131121', '', '', 'D*5 \\r\\n']",
 '$\x00PR\x02A': "['$\\x00PR\\x02A', '-7.6', 'A* 2\\r\\n']",
 '$APHDG': "['$APHDG', '049.1', '', '', '', '*54\\r\\n$HCHDG', '', '', '', '', '*6C\\r\\n']",
 '$ECGLL': "['$ECGLL', '2904.000', 'N', '00056.213', 'W', '231300', 'A', 'D*4E\\r\\n$IIVHW', '', 'T', '', 'M', '0.0', 'N', '', 'K*7B\\r\\n$IIMTW', '24.0', 'C*15\\r\\n']",
 '$IIMTW': "['$IIMTW', '24.2', 'C*17\\r\\n$APHDM', '076.7', 'M*35\\r\\n']",
 '$I\tRM\x03': "['$I\\tRM\\x03', '231300', 'A', '2904.000', 'N', '00056.213', 'W', '0.0', '', '131121', '', '', 'D*50\\r\\n']"}

EM Trak: A-100 sentences: ABM, ACA, ACK, AIR, BBM, DTM, EPV, GBS, GGA, GLL, GNS, HDT, LRF, LRI, RMC, ROT, SSD, VBW, VSD, VTG, SPW, THS

barbacbd commented 2 years ago

@cbitterfield I am not sure if you are still having issues with this dataset and the parsing of the information but I looked into this for you. I ran the following:


with open("nema_data.txt", "rb") as data_file:
    data = data_file.read()

data = data.split(b'\r\n')
data = [x.decode() for x in data if x]

for i, dp in enumerate(data):
    try:
        parsed = pynmea2.parse(dp)
    except ValueError as error:
        print(f"Index - {i}, {dp}")```

I was able to see the following output:

```Index - 202, $APVTG,,T,,M,0.0,N,,K,D* E
Index - 210, $APVT,,M,0.0,N,,K,D*0E
Index - 305, $PHM,0 8. ,M*3E
Index - 383, $APVTG,,T,,M,0.0,N,,K,D* E
Index - 1082, $APVT,T,,M,0.N,,K,D*0E
Index - 1460, $PRA,-7.6,A* 2
Index - 2290, $IIRMC,231300,A,2904.000,N,00056.213,W,0.0,,131121,,,D*5 
Index - 2982, $IIRMC,231300,A,2904.000,N,00056.213,W,0.0,,131121,,,D*5 
Index - 3497, $APVTG,,T,,M,0.0,N,,K,D* E
Index - 5466, $I    RM,231300,A,2904.000,N,00056.213,W,0.0,,131121,,,D*50

This is pulled directly from the file you linked in this issue. Note sure if there was an update or not but things appear to be fixed from your original issue.