Skip to content

Commit

Permalink
modified: Julia/fitsDBNULL.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
jvo203 committed Jan 12, 2023
1 parent 6243aea commit 6632323
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Julia/error.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALMA01566285 :: /home/alma/fits_archive/2021/09/19/jvon_210919/2018.1.01123.S/A001_X133d_X1aa6/ALMA01566285_00_00_00.fits
ALMA01562024 :: /home/alma/fits_archive/2021/07/18/jvon_210718/2018.1.01123.S/A001_X133d_X1aa6/ALMA01562024_00_00_00.fits
42 changes: 41 additions & 1 deletion Julia/fitsDBNULL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,44 @@ function get_datasets(conn, threshold)
data = columntable(res)

return data
end
end

function check_dataset(datasetid, path)
src = "/home/alma/" * path

if !isfile(src)
# append to the error file
open("error.txt", "a") do f
write(f, "$(datasetid) :: $(src)\n")
end
end
end

conn = connect_db("alma")
datasets = get_datasets(conn, 0)

ids = datasets[:dataset_id]
paths = datasets[:path]

count = 1
total_count = length(ids) # number of datasets to check

println("Checking $(total_count) datasets")

p = Progress(total_count, 1, "Checking...")

for (datasetid, path) in zip(ids, paths)
global p, count

# println("Checking dataset $(count) of $(total_count)")

# check if the dataset exists
check_dataset(datasetid, path)

update!(p, count)

# increment the index
count = count + 1
end

close(conn)

0 comments on commit 6632323

Please sign in to comment.