35 lines
1.3 KiB
Bash
35 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
# Download a small, versionable 2MASS PSC field from the IRSA Gator API.
|
|
#
|
|
# The query is intentionally a 0.5-degree cone instead of the full PSC: the
|
|
# all-sky catalog contains hundreds of millions of sources and is not suitable
|
|
# for this repository. The output remains an original IPAC table so no
|
|
# photometry or missing-value handling is silently changed.
|
|
set -euo pipefail
|
|
|
|
repo_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
output="$repo_root/assets/2mass/raw/2mass_psc_m31_0p5deg.tbl"
|
|
tmp_output=$(mktemp "${TMPDIR:-/tmp}/2mass_psc_m31_XXXXXX.tbl")
|
|
trap 'rm -f "$tmp_output"' EXIT
|
|
|
|
mkdir -p "$(dirname -- "$output")"
|
|
|
|
curl --fail --silent --show-error --location --get \
|
|
'https://irsa.ipac.caltech.edu/cgi-bin/Gator/nph-query' \
|
|
--data-urlencode 'catalog=fp_psc' \
|
|
--data-urlencode 'spatial=cone' \
|
|
--data-urlencode 'objstr=10.6847083 41.26875' \
|
|
--data-urlencode 'radius=0.5' \
|
|
--data-urlencode 'radunits=deg' \
|
|
--data-urlencode 'outfmt=1' \
|
|
--data-urlencode 'selcols=designation,ra,dec,j_m,h_m,k_m' \
|
|
--data-urlencode 'outrows=50000' \
|
|
-o "$tmp_output"
|
|
|
|
grep -q "2MASS All-Sky Point Source Catalog" "$tmp_output"
|
|
grep -q '^| *designation|' "$tmp_output"
|
|
mv "$tmp_output" "$output"
|
|
trap - EXIT
|
|
|
|
printf 'Wrote %s\n' "$output"
|