Skip to content

Commit

Permalink
Use on_error in scripts/orbitdetermination.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
LuEdRaMo committed Aug 27, 2024
1 parent bce609b commit bfc1d16
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/orbitdetermination.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ end
using NEOs: Tracklet, reduce_tracklets

# Initial orbit determination routine
function iod(neo::String, output::String)
# Output file
filename = joinpath(output, replace(neo, " " => "") * ".jld2")
function iod(neo::String, filename::String)
# Download optical astrometry
radec = fetch_radec_mpc("designation" => neo)
if length(radec) < 3
Expand Down Expand Up @@ -90,9 +88,13 @@ function main()
neos = readlines(input)
println("", length(neos), " NEOs to be processed with ", nworkers(),
" workers (", Threads.nthreads(), " threads each)")
# Output files
filenames = map(neos) do neo
return joinpath(output, replace(neo, " " => "") * ".jld2")
end

# Distributed orbit determination
mask = pmap(neo -> iod(neo, output), neos)
mask = pmap(iod, neos, filenames; on_error = ex -> false)
println("", count(mask), " / ", length(neos), " successful NEOs")

return nothing
Expand Down

0 comments on commit bfc1d16

Please sign in to comment.