#!/bin/bash
# new link in PypeIt-DevSuite g drive:
# https://drive.google.com/file/d/1FOYCIf4Nt102ZSiGwEqp-cEIGIvrWS8Y/view
# old link:
# https://drive.google.com/file/d/1uxR-kGDVvB6wLD7AW26OzzitYv0eZLr0/view
# Shell script to download TelFit_Lick_3100_11100_R10000.fits into the pypeit/data/telluric directory
# after installation of PypeIt
#fileId=1uxR-kGDVvB6wLD7AW26OzzitYv0eZLr0
fileId=1FOYCIf4Nt102ZSiGwEqp-cEIGIvrWS8Y
fileName=TelFit_Lick_3100_11100_R10000.fits
destPath=$(python -c "import pypeit; import os; print(os.path.join(os.path.dirname(pypeit.__file__), 'data', 'telluric', 'atm_grids', '${fileName}'))")
curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=${fileId}" > /dev/null
code="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
curl --compressed -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${code}&id=${fileId}" -o ${destPath}
