Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A lot of errors #199

Open
klint-k opened this issue Jul 11, 2019 · 0 comments
Open

A lot of errors #199

klint-k opened this issue Jul 11, 2019 · 0 comments

Comments

@klint-k
Copy link

klint-k commented Jul 11, 2019

I found two file on the internet.
nmea_data_sample.txt
nmea_sample.txt

it wound up with about a lot of errors.
The out up dict is large.
This is a link for the dict that i got changed to a file.
https://github.com/klint-k/pynmea2_errors/blob/master/bad_vdm.txt

The script that i wrote:

with open('nmea-sample.txt','rt') as file_obj:
    nmea_obj = file_obj.readlines()

with open('nmea_data_sample.txt','rt') as file_obj:
    nmea_obj += file_obj.readlines()


bad = {}

for k in nmea_obj:
    t = k.split(',')
    #print()
    if t[-1] == '0*26\n' or t[-1] == '0*25\n':
        pass
##    elif t[0] != "!AIVDM":
##        print(t)
##        pass
    elif t[0][3:] != "VDM":
        print(t[0][3:])
        pass
    elif t[1] == '1':
        #print(t)
        try:
            x = ais.decode(t[-2], 0)
            #print(x)
        except _ais.DecodeError:
            try:
                x = ais.decode(t[-2], 1)
                #print(x)
            except _ais.DecodeError:
                try:
                    x = ais.decode(t[-2], 3)
                    #print(x)
                except Exception as e:
                    bad[k] = e
                    print(e)
                    pass
        except Exception as e:
            bad[k] = e
            print(e)
        else:
            for i in x:
                #print('%s: %s' % (i, x[i]))
                pass
    elif t[1] == '2' and t[2] == '1':
        store = t
    elif t[1] == '2' and t[2] == '2':
        try:
            #store += t
            #print(store)
            #print(t)
            x = ais.decode(store[-2] + t[-2], 2)
            #print(x)
        except Exception as e:
            bad[str(k) + str(store)] = e
            #bad.append(store)
            #bad.append(t)
            print(e)
        else:
            for i in x:
                #print('%s: %s' % (i, x[i]))
                pass
            store = ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant