Skip to content

Commit b03fee9

Browse files
committed
download pyrhelio tel files
1 parent b1830ed commit b03fee9

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import Pkg
2+
Pkg.activate(mktempdir())
3+
Pkg.add(["HTTP","EzXML"])
4+
5+
using Downloads
6+
using HTTP, EzXML
7+
pyrhelio_dir = "/gpfs/group/ebf11/default/pipeline/data/neid_solar/pyrheliometer"
8+
url = "https://neid.ipac.caltech.edu/pyrheliometer.php"
9+
10+
try
11+
12+
response = HTTP.request("GET",url)
13+
body = String(response.body)
14+
idx = findall(r"https\:\/\/\S+\/pyroheliotel\/neid_\w+_\S{4}_\d{8}\.tel",body)
15+
for i in eachindex(idx)
16+
this_url = body[idx[i]]
17+
m = match(r"neid_l\S+\.tel",this_url)
18+
if isnothing(m) continue end
19+
filename = joinpath(pyrhelio_dir,string(m.match))
20+
if filesize(filename) > 0 continue end
21+
println("# Need to download ", filename)
22+
Downloads.download(this_url, filename)
23+
if !(filesize(filename) > 0)
24+
println("# Somehow ", filename, " is still missing/empty.")
25+
end
26+
end
27+
28+
catch ex
29+
@warn "Error: " * string(ex)
30+
end

0 commit comments

Comments
 (0)