鸟粪,“大统一”蝙蝠声学元数据格式
guano的Python项目详细描述
鸟粪比
这是GUANO的Python引用实现,“grand 统一声学符号本体”,蝙蝠声学的元数据格式 录音。它包括一个生产就绪的python模块 支持读取和写入鸟粪元数据,以及 有用的命令行实用程序。
有关鸟粪元数据本身的更多信息,包括格式 规范,请参见guano项目主页:http://guano-md.org
有关guano py的文档可以在以下位置找到:http://guano-py.readthedocs.io
要求
- python 2.7或python 3.3+
安装
从python包索引中神奇地下载并安装:
$> pip install -U guano
除了可以在中使用guanopython模块之外 你自己的软件,你也会有一个小的useful scripts集合来使用。
或者,您可以从github签出项目并安装 在本地以开发人员模式自行破解:
$> git clone https://github.com/riggsd/guano-py.git $> cd guano-py $> python setup.py develop
API使用
fromguanoimportGuanoFile# load a .WAV file with (or without) GUANO metadatag=GuanoFile('test.wav')# get and set metadata values like a Python dictprintg['GUANO|Version']>>>1.0printg['Make'],g['Model']>>>'Pettersson','D500X'g['Species Manual ID']='Myso'g['Note']='I love GUANO!'# namespaced fields can be specified separately or pipe-delimitedprintg['PET','Gain'],g['PET|Gain']>>>80,80g['SB|Consensus']='Epfu'g['SB','Consensus']='Epfu'# print all the metadata valuesforkey,valueing.items():print'%s: %s'%(key,value)# write the updated .WAV file back to diskg.write()# have some GUANO metadata from some other source? load it from a stringg=GuanoFile.from_string('GUANO|Version:1.0\nTags:voucher,hand-release')# write GUANO metadata somewhere else, say an Anabat file or text filewithopen('sidecar_file.guano','wb')asoutfile:outfile.write(g.serialize())# teach the parser to recognize custom metadata fieldsGuanoFile.register('Anabat',['Humidity','Temperature'],float)GuanoFile.register('SB','Thumbnail Image',guano.base64decode)