Skip to content

Commit

Permalink
Merge pull request astropy#2154 from mkelley/jplhorizons-api-update
Browse files Browse the repository at this point in the history
Updates for new jplhorizons API.
  • Loading branch information
bsipocz authored Sep 28, 2021
2 parents d606686 + 872d469 commit 1aba55e
Show file tree
Hide file tree
Showing 11 changed files with 840 additions and 763 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ splatalogue

- Splatalogue table merging can now handle unmasked columns [#2136]

jplhorizons
^^^^^^^^^^^

- Updated to use v1.0 of the new JPL Horizons API released 2021-09-15.
Included in this update, the default reference system is changed from
J2000 to ICRF, following API documentation. [#2154]

Infrastructure, Utility and Other Changes and Additions
-------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion astroquery/jplhorizons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Conf(_config.ConfigNamespace):

# server settings
horizons_server = _config.ConfigItem(
'https://ssd.jpl.nasa.gov/horizons_batch.cgi',
['https://ssd.jpl.nasa.gov/api/horizons.api', ],
'JPL Horizons')

# implement later: sbdb_server = 'http://ssd-api.jpl.nasa.gov/sbdb.api'
Expand Down
37 changes: 20 additions & 17 deletions astroquery/jplhorizons/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def ephemerides_async(self, airmass_lessthan=99,
rate_cutoff=None,
skip_daylight=False,
refraction=False,
refsystem='J2000',
refsystem='ICRF',
closest_apparition=False, no_fragments=False,
quantities=conf.eph_quantities,
get_query_payload=False,
Expand Down Expand Up @@ -423,8 +423,8 @@ def ephemerides_async(self, airmass_lessthan=99,
refraction model; if ``False``, coordinates do not account for
refraction (airless model); default: ``False``
refsystem : string
Coordinate reference system: ``'J2000'`` or ``'B1950'``; default:
``'J2000'``
Coordinate reference system: ``'ICRF'`` or ``'B1950'``; default:
``'ICRF'``
closest_apparition : boolean, optional
Only applies to comets. This option will choose the closest
apparition available in time to the selected epoch; default: False.
Expand Down Expand Up @@ -507,8 +507,8 @@ def ephemerides_async(self, airmass_lessthan=99,
commandline += ' NOFRAG;'

request_payload = OrderedDict([
('batch', 1),
('TABLE_TYPE', 'OBSERVER'),
('format', 'text'),
('EPHEM_TYPE', 'OBSERVER'),
('QUANTITIES', "'"+str(quantities)+"'"),
('COMMAND', '"' + commandline + '"'),
('SOLAR_ELONG', ('"' + str(solar_elongation[0]) + "," +
Expand All @@ -519,7 +519,7 @@ def ephemerides_async(self, airmass_lessthan=99,
('ANG_FORMAT', ('DEG')),
('APPARENT', ({False: 'AIRLESS',
True: 'REFRACTED'}[refraction])),
('REF_SYSTEM', (refsystem)),
('REF_SYSTEM', refsystem),
('EXTRA_PREC', {True: 'YES', False: 'NO'}[extra_precision])])

if isinstance(self.location, dict):
Expand Down Expand Up @@ -594,7 +594,7 @@ def ephemerides_async(self, airmass_lessthan=99,
return response

def elements_async(self, get_query_payload=False,
refsystem='J2000',
refsystem='ICRF',
refplane='ecliptic',
tp_type='absolute',
closest_apparition=False, no_fragments=False,
Expand Down Expand Up @@ -663,7 +663,7 @@ def elements_async(self, get_query_payload=False,
----------
refsystem : string
Element reference system for geometric and astrometric quantities:
``'J2000'`` or ``'B1950'``; default: ``'J2000'``
``'ICRF'`` or ``'B1950'``; default: ``'ICRF'``
refplane : string
Reference plane for all output quantities: ``'ecliptic'`` (ecliptic
and mean equinox of reference epoch), ``'earth'`` (Earth mean
Expand Down Expand Up @@ -742,8 +742,8 @@ def elements_async(self, get_query_payload=False,

# configure request_payload for ephemerides query
request_payload = OrderedDict([
('batch', 1),
('TABLE_TYPE', 'ELEMENTS'),
('format', 'text'),
('EPHEM_TYPE', 'ELEMENTS'),
('MAKE_EPHEM', 'YES'),
('OUT_UNITS', 'AU-D'),
('COMMAND', '"' + commandline + '"'),
Expand Down Expand Up @@ -973,19 +973,22 @@ def vectors_async(self, get_query_payload=False,

# configure request_payload for ephemerides query
request_payload = OrderedDict([
('batch', 1),
('TABLE_TYPE', 'VECTORS'),
('format', 'text'),
('EPHEM_TYPE', 'VECTORS'),
('OUT_UNITS', 'AU-D'),
('COMMAND', '"' + commandline + '"'),
('CENTER', ("'" + str(self.location) + "'")),
('CSV_FORMAT', ('"YES"')),
('REF_PLANE', {'ecliptic': 'ECLIPTIC', 'earth': 'FRAME',
('REF_PLANE', {'ecliptic': 'ECLIPTIC',
'earth': 'FRAME',
'frame': 'FRAME',
'body': "'BODY EQUATOR'"}[refplane]),
('REF_SYSTEM', 'J2000'),
('REF_SYSTEM', 'ICRF'),
('TP_TYPE', 'ABSOLUTE'),
('LABELS', 'YES'),
('VECT_CORR', {'geometric': '"NONE"', 'astrometric': '"LT"',
'apparent': '"LT+S"'}[aberrations]),
('VEC_LABELS', 'YES'),
('VEC_CORR', {'geometric': '"NONE"',
'astrometric': '"LT"',
'apparent': '"LT+S"'}[aberrations]),
('VEC_DELTA_T', {True: 'YES', False: 'NO'}[delta_T]),
('OBJ_DATA', 'YES')]
)
Expand Down
13 changes: 13 additions & 0 deletions astroquery/jplhorizons/tests/data/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Generate these files from the following URIs:

ceres_elements.txt
https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=ELEMENTS&MAKE_EPHEM=YES&OUT_UNITS=AU-D&COMMAND=%22Ceres%3B%22&CENTER=%27500%4010%27&CSV_FORMAT=YES&ELEM_LABELS=YES&OBJ_DATA=YES&REF_SYSTEM=ICRF&REF_PLANE=ECLIPTIC&TP_TYPE=ABSOLUTE&TLIST=2451544.5

ceres_ephemerides.txt
https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=OBSERVER&QUANTITIES=%271%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%2C25%2C26%2C27%2C28%2C29%2C30%2C31%2C32%2C33%2C34%2C35%2C36%2C37%2C38%2C39%2C40%2C41%2C42%2C43%27&COMMAND=%22Ceres%3B%22&SOLAR_ELONG=%220%2C180%22&LHA_CUTOFF=0&CSV_FORMAT=YES&CAL_FORMAT=BOTH&ANG_FORMAT=DEG&APPARENT=AIRLESS&REF_SYSTEM=ICRF&EXTRA_PREC=NO&CENTER=%27500%27&TLIST=2451544.5&SKIP_DAYLT=NO

ceres_vectors.txt
https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=VECTORS&OUT_UNITS=AU-D&COMMAND=%22Ceres%3B%22&CENTER=%27500%4010%27&CSV_FORMAT=%22YES%22&REF_PLANE=ECLIPTIC&REF_SYSTEM=ICRF&TP_TYPE=ABSOLUTE&VEC_LABELS=YES&VEC_CORR=%22NONE%22&VEC_DELTA_T=NO&OBJ_DATA=YES&TLIST=2451544.5

no_H.txt
https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=OBSERVER&QUANTITIES=%271%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%2C25%2C26%2C27%2C28%2C29%2C30%2C31%2C32%2C33%2C34%2C35%2C36%2C37%2C38%2C39%2C40%2C41%2C42%2C43%27&COMMAND=%221935+UZ%3B%22&SOLAR_ELONG=%220%2C180%22&LHA_CUTOFF=0&CSV_FORMAT=YES&CAL_FORMAT=BOTH&ANG_FORMAT=DEG&APPARENT=AIRLESS&REF_SYSTEM=ICRF&EXTRA_PREC=NO&CENTER=%27500%40399%27&TLIST=2459480.5004416634&SKIP_DAYLT=NO
100 changes: 52 additions & 48 deletions astroquery/jplhorizons/tests/data/ceres_elements.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
*******************************************************************************
JPL/HORIZONS 1 Ceres (A801 AA) 2020-May-29 09:49:47
Rec #: 1 (+COV) Soln.date: 2020-May-20_11:11:55 # obs: 1030 (1995-2020)
API VERSION: 1.0
API SOURCE: NASA/JPL Horizons API

*******************************************************************************
JPL/HORIZONS 1 Ceres (A801 AA) 2021-Sep-22 17:02:01
Rec #: 1 (+COV) Soln.date: 2021-Apr-13_11:04:44 # obs: 1075 (1995-2021)

IAU76/J2000 helio. ecliptic osc. elements (au, days, deg., period=Julian yrs):

EPOCH= 2454061.5 ! 2006-Nov-22.00 (TDB) Residual RMS= .24184
EC= .07985681703215082 QR= 2.544823927206557 TP= 2454873.5774668744
OM= 80.40822338295483 W= 73.18422155550952 IN= 10.58670363476912
A= 2.765682531058295 MA= 185.9804488570544 ADIST= 2.986541134910033
PER= 4.59951 N= .214289342 ANGMOM= .028516315
DAN= 2.68599 DDN= 2.81303 L= 153.318086
B= 10.1291284 MOID= 1.57983994 TP= 2009-Feb-11.0774668744

EPOCH= 2458849.5 ! 2020-Jan-01.00 (TDB) Residual RMS= .24563
EC= .07687465013145245 QR= 2.556401146697176 TP= 2458240.1791309435
OM= 80.3011901917491 W= 73.80896808746482 IN= 10.59127767086216
A= 2.769289292143484 MA= 130.3159688200986 ADIST= 2.982177437589792
PER= 4.60851 N= .213870839 ANGMOM= .028541613
DAN= 2.69515 DDN= 2.81323 L= 153.8445988
B= 10.1666388 MOID= 1.59231997 TP= 2018-May-01.6791309435
Asteroid physical parameters (km, seconds, rotational period in hours):
GM= 62.6284 RAD= 469.7 ROTPER= 9.07417
H= 3.4 G= .120 B-V= .713
H= 3.53 G= .120 B-V= .713
ALBEDO= .090 STYP= C

ASTEROID comments:
1: soln ref.= JPL#47, OCC=0 radar(60 delay, 0 Dop.)
ASTEROID comments:
1: soln ref.= JPL#48, OCC=0 radar(60 delay, 0 Dop.)
2: source=ORB
*******************************************************************************


*******************************************************************************
Ephemeris / WWW_USER Fri May 29 09:49:47 2020 Pasadena, USA / Horizons
Ephemeris / API_USER Wed Sep 22 17:02:01 2021 Pasadena, USA / Horizons
*******************************************************************************
Target body name: 1 Ceres (A801 AA) {source: JPL#47}
Center body name: Sun (10) {source: DE431}
Target body name: 1 Ceres (A801 AA) {source: JPL#48}
Center body name: Sun (10) {source: DE441}
Center-site name: BODY CENTER
*******************************************************************************
Start time : A.D. 2000-Jan-01 00:00:00.0000 TDB
Expand All @@ -36,51 +39,49 @@ Step-size : 0 steps
*******************************************************************************
Center geodetic : 0.00000000,0.00000000,0.0000000 {E-lon(deg),Lat(deg),Alt(km)}
Center cylindric: 0.00000000,0.00000000,0.0000000 {E-lon(deg),Dxy(km),Dz(km)}
Center radii : 696000.0 x 696000.0 x 696000.0 k{Equator, meridian, pole}
Keplerian GM : 2.9591220828559093E-04 au^3/d^2
Small perturbers: Yes {source: SB431-N16}
Center radii : 696000.0 x 696000.0 x 696000.0 k{Equator, meridian, pole}
Keplerian GM : 2.9591220828411951E-04 au^3/d^2
Small perturbers: Yes {source: SB441-N16}
Output units : AU-D, deg, Julian Day Number (Tp)
Output type : GEOMETRIC osculating elements
Output format : 10
Reference frame : ICRF/J2000.0
Coordinate systm: Ecliptic and Mean Equinox of Reference Epoch
Reference frame : Ecliptic of J2000.0
*******************************************************************************
Initial IAU76/J2000 heliocentric ecliptic osculating elements (au, days, deg.):
EPOCH= 2454061.5 ! 2006-Nov-22.00 (TDB) Residual RMS= .24184
EC= .07985681703215082 QR= 2.544823927206557 TP= 2454873.5774668744
OM= 80.40822338295483 W= 73.18422155550952 IN= 10.58670363476912
Equivalent ICRF heliocentric equatorial cartesian coordinates (au, au/d):
X= 2.732617277025615E+00 Y=-7.734822664676754E-01 Z=-9.207592896905449E-01
VX= 3.368590810386608E-03 VY= 8.330863405401928E-03 VZ= 3.238410491551668E-03
Asteroid physical parameters (km, seconds, rotational period in hours):
GM= 62.6284 RAD= 469.7 ROTPER= 9.07417
H= 3.4 G= .120 B-V= .713
ALBEDO= .090 STYP= C
EPOCH= 2458849.5 ! 2020-Jan-01.00 (TDB) Residual RMS= .24563
EC= .07687465013145245 QR= 2.556401146697176 TP= 2458240.1791309435
OM= 80.3011901917491 W= 73.80896808746482 IN= 10.59127767086216
Equivalent ICRF heliocentric cartesian coordinates (au, au/d):
X= 1.007608869613381E+00 Y=-2.390064275223502E+00 Z=-1.332124522752402E+00
VX= 9.201724467227128E-03 VY= 3.370381135398406E-03 VZ=-2.850337057661093E-04
Asteroid physical parameters (km, seconds, rotational period in hours):
GM= 62.6284 RAD= 469.7 ROTPER= 9.07417
H= 3.53 G= .120 B-V= .713
ALBEDO= .090 STYP= C
*******************************************************************************
JDTDB, Calendar Date (TDB), EC, QR, IN, OM, W, Tp, N, MA, TA, A, AD, PR,
**************************************************************************************************************************************************************************************************************************************************************************************************************************************************
$$SOE
2451544.500000000, A.D. 2000-Jan-01 00:00:00.0000, 7.837505661794254E-02, 2.549670138349935E+00, 1.058336073882007E+01, 8.049436523546700E+01, 7.392278833506030E+01, 2.451516163109598E+06, 2.141950390313929E-01, 6.069621345711466E+00, 7.121192564072539E+00, 2.766494284533461E+00, 2.983318430716986E+00, 1.680711194936862E+03,
2451544.500000000, A.D. 2000-Jan-01 00:00:00.0000, 7.837505574674922E-02, 2.549670145428669E+00, 1.058336066935565E+01, 8.049436497808115E+01, 7.392278720553115E+01, 2.451516163103133E+06, 2.141950384425567E-01, 6.069622713669460E+00, 7.121194154895409E+00, 2.766494289599058E+00, 2.983318433769447E+00, 1.680711199557247E+03,
$$EOE
**************************************************************************************************************************************************************************************************************************************************************************************************************************************************
Coordinate system description:

Ecliptic and Mean Equinox of Reference Epoch
Ecliptic at the standard reference epoch

Reference epoch: J2000.0
XY-plane: plane of the Earth's orbit at the reference epoch
Note: obliquity of 84381.448 arcseconds wrt ICRF equator (IAU76)
X-axis : out along ascending node of instantaneous plane of the Earth's
orbit and the Earth's mean equator at the reference epoch
Z-axis : perpendicular to the xy-plane in the directional (+ or -) sense
of Earth's north pole at the reference epoch.
X-Y plane: adopted Earth orbital plane at the reference epoch
Note: obliquity of 84381.448 arcseconds (IAU76) wrt ICRF equator
X-axis : ICRF
Z-axis : perpendicular to the X-Y plane in the directional (+ or -) sense
of Earth's north pole at the reference epoch.

Symbol meaning [1 au= 149597870.700 km, 1 day= 86400.0 s]:

JDTDB Julian Day Number, Barycentric Dynamical Time
EC Eccentricity, e
QR Periapsis distance, q (au)
IN Inclination w.r.t XY-plane, i (degrees)
IN Inclination w.r.t X-Y plane, i (degrees)
OM Longitude of Ascending Node, OMEGA, (degrees)
W Argument of Perifocus, w (degrees)
Tp Time of periapsis (Julian Day Number)
Expand All @@ -93,13 +94,16 @@ Coordinate system description:

Geometric states/elements have no aberrations applied.


Computations by ...
Solar System Dynamics Group, Horizons On-Line Ephemeris System
4800 Oak Grove Drive, Jet Propulsion Laboratory
Pasadena, CA 91109 USA
Information: http://ssd.jpl.nasa.gov/
Connect : telnet://ssd.jpl.nasa.gov:6775 (via browser)
http://ssd.jpl.nasa.gov/?horizons
telnet ssd.jpl.nasa.gov 6775 (via command-line)
Author : [email protected]
Information : https://ssd.jpl.nasa.gov/
Documentation: https://ssd.jpl.nasa.gov/?horizons_doc
Connect : https://ssd.jpl.nasa.gov/?horizons (browser)
telnet ssd.jpl.nasa.gov 6775 (command-line)
e-mail command interface available
Script and CGI interfaces available
Author : [email protected]
*******************************************************************************
Loading

0 comments on commit 1aba55e

Please sign in to comment.