riggsd / guano-py

Python reference implementation of the GUANO bat acoustics metadata specification
http://guano-md.org
MIT License
13 stars 5 forks source link

Type of Loc Accuracy is incorrect #22

Closed jmears63 closed 1 year ago

jmears63 commented 1 year ago

A small thing, but I think the type of Loc Accuracy should be float, not int, per the spec here: https://www.wildlifeacoustics.com/SCHEMA/GUANO.html. That's at guano.py line 170.

This discrepancy means that in strict mode, the parser fails to parse this field, and throws an exception. This became an issue in real life when I couldn't parse out a real wav file with this guano data:

GUANO|Version: 1.0 Species Manual ID: MyoBra/MyoMys,MyoDau,MyoNat Loc Position: (60.805893333, 24.600683333) Loc Accuracy: 40.02338521414699 Anabat|CallType: Matala

Perhaps a further refinement would be to have the parser fail open even in strict mode, so that a single bad field doesn't prevent other fields from being parsed? And possibly, make the default mode lenient? I can't imagine that clients typically want the parser to choke on a minor issue such as this.

riggsd commented 1 year ago

I apologize for the long delay, but your report slipped through the cracks during summer travels!

You are absolutely correct that the specification defines Loc Accuracy as a float value, but the Python library was parsing it as an int. I've fixed this bug, and also made strict=False the new default behavior, since many fewer people use this library for validation than for day-to-day use.

Are you able to test the unreleased master branch to verify that it works with your recordings?

jmears63 commented 1 year ago

Yes that seems fine, based on a quick check with various wav files.

Thank you!