-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcassis_download.sh
More file actions
executable file
·38 lines (31 loc) · 1.02 KB
/
cassis_download.sh
File metadata and controls
executable file
·38 lines (31 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
# get CASSIS spectra for aors matched against db targets
py=/usr/local/bin/python3
# this is where spectra will go
root='/Users/grant/a-extra/sdb/spectra/'
ddir=$root`echo "import config; print(config.spectra['irsstare'][0])" | $py`
r1=`echo "import config; print(config.spectra['irsstare'][1])" | $py`
r2=`echo "import config; print(config.spectra['irsstare'][2])" | $py`
cd $ddir
echo "Downloading spectra to "$ddir
mysql $db -N -e "SELECT aor_key FROM sdb.spectra" | while read aor
do
url1="https://cassis.sirtf.com/atlas/cgi/"
url2="download.py?aorkey="$aor"&ptg=0&product=yaaar_oe_wavesamp"
# see if file exists already or if we failed before
if [ -e $ddir$r1$aor$r2 ]
then
echo "File "`ls $ddir$r1$aor$r2`" exists"
elif [ -e $ddir$url2 ]
then
echo "Previous attempt at this file failed"
# otherwise try to grab it from CASSIS
else
echo "Getting file for aor:"$aor
url=$url1$url2
echo $url
curl -O -J $url
sleep 5
fi
done
cd -