Script ais_dumpnames_py
[hide private]
[frames] | no frames]

Source Code for Script script-ais_dumpnames_py

 1  #!/usr/bin/env python 
 2   
 3  import sys, binary, ais_msg_5, aisstring 
 4  from BitVector import BitVector 
 5   
 6  for line in file('5.ais'): 
 7      fields = line.split(',')[:6] 
 8      if '1'!=fields[2]: # Must be the start of a sequence 
 9          continue 
10      if len(fields[5])<39: continue 
11      bv = binary.ais6tobitvec(fields[5][:39]) # Hacked for speed 
12      print int(bv[8:38]),aisstring.decode(bv[112:232],True) 
13