#!/bin/bash
# Avec Jerome: use -rplane=2 to get vectors in ecliptic coordinate system
#              use -rplane=1 to get vectors in equatorial coordinate system
# this are geometric coordinates: no correction for light travel time is made.
export LC_ALL=C
ast=`echo $1 | tr A-Z a-z`
JD=$2
n=$3
st=$4
obs=$5
#curl "http://vo.imcce.fr/webservices/miriade/ephemcc_query.php?-name=a:$ast&-type=&-ep=$JD&-nbd=$n&-step=$st&-observer=$obs&-mime=text&-tscale=UTC&-theory=INPOP&-teph=1&-tcoor=2&-rplane=2&-output=--julian"
#echo "http://vo.imcce.fr/webservices/miriade/ephemcc_query.php?-name=a:$ast&-type=&-ep=$JD&-nbd=$n&-step=$st&-observer=$obs&-mime=text&-tscale=UTC&-theory=INPOP&-teph=1&-tcoor=2&-rplane=2&-output=--julian"
curl -s "http://vo.imcce.fr/webservices/miriade/ephemcc_query.php?-name=a:$ast&-type=&-ep=$JD&-nbd=$n&-step=$st&-observer=$obs&-mime=text&-tscale=UTC&-theory=INPOP&-teph=1&-tcoor=2&-rplane=2&-output=--julian" | awk '/^ *[0-9]/ {printf("%20.10lf %24.13lf %24.13lf %24.13lf %24.13lf %24.13lf %24.13lf\n",$1,$13,$14,$15,$2,$3,$4)}'
#curl -s "http://vo.imcce.fr/webservices/miriade/ephemcc_query.php?-name=a:$ast&-type=&-ep=$JD&-nbd=$n&-step=$st&-observer=$obs&-mime=text&-tscale=UTC&-theory=INPOP&-teph=1&-tcoor=2&-rplane=2&-output=--julian"
