Package ais :: Module ais_dumpnames
[hide private]
[frames] | no frames]

Source Code for Module ais.ais_dumpnames

 1  #!/usr/bin/env python 
 2  __version__ = '$Revision: 4791 $'.split()[1] 
 3  __date__ = '$Date: 2006-09-24 14:01:41 -0400 (Sun, 24 Sep 2006) $'.split()[1] 
 4  __author__ = 'Kurt Schwehr' 
 5   
 6  __doc__=''' 
 7  Pull out names from msg 5 packages as fast as possible.  Dirty trick 
 8  version with no error checking. 
 9   
10  @requires: U{epydoc<http://epydoc.sourceforge.net/>} >= 3.0alpha3 
11  @requires: U{BitVector<http://cheeseshop.python.org/pypi/BitVector>} >= 1.2 
12   
13  @author: U{'''+__author__+'''<http://schwehr.org/>} 
14  @version: ''' + __version__ +''' 
15  @copyright: 2006 
16  @var __date__: Date of last svn commit 
17  @undocumented: __version__ __author__ __doc__ myparser 
18  @since: 2006-Dec 
19  @status: under development 
20  @organization: U{CCOM<http://ccom.unh.edu/>} 
21  @license: GPL v2 
22   
23  @bug: Cheap hack 
24  ''' 
25   
26  import sys, binary, ais_msg_5, aisstring 
27  from BitVector import BitVector 
28   
29  if __name__=='__main__': 
30      for line in file('5.ais'): 
31          fields = line.split(',')[:6] 
32          if '1'!=fields[2]: # Must be the start of a sequence 
33              continue 
34          if len(fields[5])<39: continue 
35          bv = binary.ais6tobitvec(fields[5][:39]) # Hacked for speed 
36          print int(bv[8:38]),aisstring.decode(bv[112:232],True) 
37