added avianz_of_raven function to Labels.jl

[?]
AEj8dahVWy718uSSFPe9VSRJ5qX5G8pC2zvFzJJ8yzBd
Nov 8, 2024, 9:06 PM
2O6SHIVYVHLSJNQ6WXFV2DSI6WPQWTXS3X6YY4V5JO3XEOEURUHQC

Dependencies

Change contents

  • edit in src/Labels.jl at line 159
    [2.4517]
    [2.4517]
    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)