end
# Raven selections.txt to AviaNZ .data
# using CSV, DataFrames, JSON3
# uncomment line 'isfile(avianzf) && rm(f)' to remove .selection.txt file
# a=glob("*/*/*.Table.1.selections.txt")
# map(x -> avianz_of_raven!(x), a)
function avianz_of_raven!(f::String)
df=DataFrame(CSV.File(f))
data=Any[Dict([("Operator", "D"), ("Reviewer", "D"), ("Duration", 60.0)])]
labels=Any[]
for row in eachrow(df)
label=
[
row."Begin Time (s)",
row."End Time (s)",
floor(Int, row."Low Freq (Hz)"),
ceil(Int, row."High Freq (Hz)"),
[
Dict([("filter", "M"), ("species", row.Species), ("certainty", 100)])
]
]
push!(labels, label)
end
append!(data, labels)
avianzf=f * ".data"
open(avianzf, "w") do io
JSON3.write(io, data)
println(io)
end
#isfile(avianzf) && rm(f)