YE6BZJUKQ7VMYEKKI3WSKTZEBR5NWUUDIN6PGE4W7OTPIY5N3NJQC GPQSOVBPY7VTPHD75R6VWSNITPOL3AECF4DHJB32MF5Z72NV7YMQC YUIQQPXYFEVTS4XG4N6JTKBHWC4OFWWSCGJ6MLNA6AWTKSYCSIEQC KZKLAINJJWZ64T5MUZT34LJVQIKBTKZ6EJGD7C7TTSSDGCHEDPMAC KLUEQ6X5CXVBV3KLJKEHWQYHIU6AYPP2WT4PWKM2QZJ7SNACCJ6QC GVOVKH5R27K75VXGSZCP3X62FGNCSMDVFEKLR3LFXERFB54CHTUQC 2P27XV3DGJCRA4SNJENCJYZLPR2XWZMTY7CGYYSJOY4UMDVVO25AC Night bool `json:"night"`Day bool `json:"day"`Lat float64 `json:"lat"`Lng float64 `json:"lng"`Timezone string `json:"timezone"`
Night bool `json:"night"`Day bool `json:"day"`Location string `json:"location,omitempty"`
}// parseLocation parses a "lat,lng[,timezone]" string into its components.// Timezone is optional and defaults to "" (UTC).func parseLocation(location string) (lat, lng float64, timezone string, err error) {parts := strings.Split(location, ",")if len(parts) < 2 || len(parts) > 3 {return 0, 0, "", fmt.Errorf("--location must be \"lat,lng\" or \"lat,lng,timezone\" (got %d parts)", len(parts))}lat, err = strconv.ParseFloat(strings.TrimSpace(parts[0]), 64)if err != nil {return 0, 0, "", fmt.Errorf("--location: invalid latitude: %s", parts[0])}lng, err = strconv.ParseFloat(strings.TrimSpace(parts[1]), 64)if err != nil {return 0, 0, "", fmt.Errorf("--location: invalid longitude: %s", parts[1])}if len(parts) == 3 {timezone = strings.TrimSpace(parts[2])}return lat, lng, timezone, nil
func processFilesSequential(output *CallsClipOutput, filePaths []string, input CallsClipInput, speciesName, callType string, imgSize int) {
func processFilesSequential(output *CallsClipOutput, filePaths []string, input CallsClipInput, speciesName, callType string, imgSize int, lat, lng float64, timezone string) {
clips, skipped, errs := processFile(dataPath, input.Output, input.Prefix, input.Filter, speciesName, callType, input.Certainty, imgSize, input.Color, input.Night, input.Day, input.Lat, input.Lng, input.Timezone)
clips, skipped, errs := processFile(dataPath, input.Output, input.Prefix, input.Filter, speciesName, callType, input.Certainty, imgSize, input.Color, input.Night, input.Day, lat, lng, timezone)
func processFilesParallel(output *CallsClipOutput, filePaths []string, input CallsClipInput, speciesName, callType string, imgSize int) {
func processFilesParallel(output *CallsClipOutput, filePaths []string, input CallsClipInput, speciesName, callType string, imgSize int, lat, lng float64, timezone string) {
clips, skipped, errs := processFile(dataPath, input.Output, input.Prefix, input.Filter, speciesName, callType, input.Certainty, imgSize, input.Color, input.Night, input.Day, input.Lat, input.Lng, input.Timezone)
clips, skipped, errs := processFile(dataPath, input.Output, input.Prefix, input.Filter, speciesName, callType, input.Certainty, imgSize, input.Color, input.Night, input.Day, lat, lng, timezone)
// nextFloat parses the next argument as a float64, or exits with an error.func (p *clipArgParser) nextFloat(flag string) float64 {s := p.nextValue(flag)v, err := strconv.ParseFloat(s, 64)if err != nil {fmt.Fprintf(os.Stderr, "Error: %s must be a number\n", flag)os.Exit(1)}return v}
fmt.Fprintf(os.Stderr, " --night Only clip recordings made during solar night (requires --lat and --lng)\n")fmt.Fprintf(os.Stderr, " --day Only clip recordings made during solar day (requires --lat and --lng)\n")fmt.Fprintf(os.Stderr, " --lat <float> Latitude in decimal degrees (required with --night or --day)\n")fmt.Fprintf(os.Stderr, " --lng <float> Longitude in decimal degrees (required with --night or --day)\n")fmt.Fprintf(os.Stderr, " --timezone <zone> IANA timezone ID (e.g. Pacific/Auckland). Required for non-AudioMoth\n")fmt.Fprintf(os.Stderr, " recorders whose filenames embed local time (e.g. DOC AR4).\n")fmt.Fprintf(os.Stderr, " AudioMoth files embed a UTC timestamp in the WAV comment, so\n")fmt.Fprintf(os.Stderr, " --timezone is not needed for AudioMoth data.\n")
fmt.Fprintf(os.Stderr, " --night Only clip recordings made during solar night (requires --location)\n")fmt.Fprintf(os.Stderr, " --day Only clip recordings made during solar day (requires --location)\n")fmt.Fprintf(os.Stderr, " --location <lat,lng[,tz]> GPS coordinates and optional IANA timezone\n")fmt.Fprintf(os.Stderr, " e.g. --location \"-36.85,174.76\" or --location \"-36.85,174.76,Pacific/Auckland\"\n")fmt.Fprintf(os.Stderr, " Required with --night or --day. Timezone defaults to UTC.\n")fmt.Fprintf(os.Stderr, " Not needed for AudioMoth data (UTC from WAV comment).\n")
case "--lat":f.lat = p.nextFloat(arg)f.latSet = truecase "--lng":f.lng = p.nextFloat(arg)f.lngSet = truecase "--timezone":f.timezone = p.nextValue(arg)
case "--location":f.location = p.nextUniqueValue(arg, f.location)
if (f.night || f.day) && (!f.latSet || !f.lngSet) {fmt.Fprintf(os.Stderr, "Error: --night/--day requires both --lat and --lng\n\n")
if (f.night || f.day) && f.location == "" {fmt.Fprintf(os.Stderr, "Error: --night/--day requires --location\n\n")
## [2026-05-05] `calls clip`: replace --lat/--lng/--timezone with --location; remove --wav-only**Breaking CLI change.** Two flag changes to `skraak calls clip`:1. **`--lat`, `--lng`, `--timezone` → `--location`** — The three GPS/timezoneflags are replaced by a single `--location "lat,lng[,timezone]"` flag.Timezone is optional (defaults to UTC; not needed for AudioMoth).This makes invalid states unrepresentable (you can't pass lat without lng).Before:```bashskraak calls clip --folder ./data --output ./clips --prefix kiwi \--species Kiwi --night --lat -40.85 --lng 172.81 --timezone Pacific/Auckland```After:```bashskraak calls clip --folder ./data --output ./clips --prefix kiwi \--species Kiwi --night --location "-40.85,172.81,Pacific/Auckland"```
2. **`--wav-only` removed** — This flag skipped spectrogram PNG generation.Removed as unnecessary; the tool's primary purpose is generating trainingdata (PNG+WAV pairs).**Files changed:**- `cmd/calls_clip.go` — flag parsing, validation, usage text- `tools/calls_clip.go` — `CallsClipInput` struct, `parseLocation` helper,removed `wavOnly` from function signatures, unwrapped spectrogram conditional- `tools/calls_clip_bench_test.go` — removed `BenchmarkFullPipelineWavOnly`