Skip to content

Instantly share code, notes, and snippets.

@JohannesBuchner
Created February 27, 2019 09:57
Show Gist options
  • Save JohannesBuchner/572849d3eb92f0755f2fb2fdeb24aef1 to your computer and use it in GitHub Desktop.
Save JohannesBuchner/572849d3eb92f0755f2fb2fdeb24aef1 to your computer and use it in GitHub Desktop.
Download GAIA data
wget -nc http://cdn.gea.esac.esa.int/Gaia/gdr2/gaia_source/csv/
grep -Eo GaiaSource_.*.csv.gz index.html | while read i; do
if [ -e $i ]; then
true
else
wget "http://cdn.gea.esac.esa.int/Gaia/gdr2/gaia_source/csv/$i" -O - | zcat | LC_ALL=C awk -F, '{print $2,$6,$8,sqrt($7**2+$9**2),$48}' | tail -n +2 | gzip > $i.tmp && mv $i.tmp $i
fi
done
{ echo "source_id ra dec poserror phot_g_mean_flux";
ls | grep '.csv.gz'|xargs zcat } | gzip > gaia.gz
# build FITS file with stilts
java -jar ~/topcat-lite.jar -stilts tcopy ifmt=ascii ofmt=fits-basic in=gaia.gz out=gaia.fits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment