自动识别系统解码-船舶跟踪
libais的Python项目详细描述
用于解码海事自动识别系统信息的库。
建筑
用python构建
$ python setup.py build $ python setup.py install
使用python进行测试
$ virtualenv ve $source ve/bin/activate $ python setup.py test
使用cmake
构建$ cmake . $ make
使用遗留makefile构建
$ make -f Makefile-custom test
用法
libais有两个接口,一个是基于高级迭代器的接口 和一个低级别的快速C++只有一个。基于迭代器的接口是 按以下方式访问:
importais.streamwithopen("file.nmea")asf:formsginais.stream.decode(f):printmsg< >直接使用低级C++接口,需要处理多行消息和填充自己:
importaisais.decode('15PIIv7P00D5i9HNn2Q3G?wB0t0I',0)ais.decode('402u=TiuaA000r5UJ`H4`?7000S:',0)ais.decode('55NBjP01mtGIL@CW;SM<D60P5Ld000000000000P0`<3557l0<50@kk@K5h@00000000000',2)
还支持将解析的消息转换为结构 由gpsd/gpsdecode输出。为了完全兼容,您必须编写 生成的消息字典将使用json.dump()和add 每条消息后都有一个换行符。
importais.streamimportjsonimportais.compatibility.gpsdwithopen("infile.nmea")asinf:withopen("outfile.gpsd")asoutf:formsginais.stream.decode(f):gpsdmsg=ais.compatibility.gpsd.mangle(msg)json.dump(gpsdmsg,outf)outf.write("\n")
AIS规范文件
- ITU-1371,ITU-1371-{1,2,3,4]
- e-Navigation
- IMO CIRC 236
- IMO CIRC 289
- 欧盟RIS
发展中
< > C++代码在2012年11月被切换到谷歌风格。 缩进应为2个空格。http://google-styleguide.googlecode.com/svn/trunk/cpplint/
$ git clone https://github.com/schwehr/libais $cd libais $ virtualenv ve $source ve/bin/activate $ pip install -e .[tests]$ python setup.py test$ py.test --cov=ais --cov-report term-missing
或
$ git clone https://github.com/schwehr/libais $cd libais $ virtualenv ve $source ve/bin/activate $ pip install -e .[test]$ python setup.py develop $ python setup.py test$ py.test --cov=ais --cov-report term-missing