Skip to content

Commit 76e8026

Browse files
committed
Updates for new API.
New API url and specifications. Updated URL and made small format changes to match the new API. Also, update magnitude of Ceres in remote tests. Added instructions for updating data files for monkeypatched tests.
1 parent 9a2864c commit 76e8026

File tree

11 files changed

+843
-764
lines changed

11 files changed

+843
-764
lines changed

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ splatalogue
2121

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

24+
jplhorizons
25+
^^^^^^^^^^^
26+
27+
- Updated to use new JPL Horizons API.
2428

2529
Infrastructure, Utility and Other Changes and Additions
2630
-------------------------------------------------------

astroquery/jplhorizons/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Conf(_config.ConfigNamespace):
1717

1818
# server settings
1919
horizons_server = _config.ConfigItem(
20-
'https://ssd.jpl.nasa.gov/horizons_batch.cgi',
20+
['https://ssd.jpl.nasa.gov/api/horizons.api', ],
2121
'JPL Horizons')
2222

2323
# implement later: sbdb_server = 'http://ssd-api.jpl.nasa.gov/sbdb.api'

astroquery/jplhorizons/core.py

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def ephemerides_async(self, airmass_lessthan=99,
144144
rate_cutoff=None,
145145
skip_daylight=False,
146146
refraction=False,
147-
refsystem='J2000',
147+
refsystem='ICRF',
148148
closest_apparition=False, no_fragments=False,
149149
quantities=conf.eph_quantities,
150150
get_query_payload=False,
@@ -423,8 +423,8 @@ def ephemerides_async(self, airmass_lessthan=99,
423423
refraction model; if ``False``, coordinates do not account for
424424
refraction (airless model); default: ``False``
425425
refsystem : string
426-
Coordinate reference system: ``'J2000'`` or ``'B1950'``; default:
427-
``'J2000'``
426+
Coordinate reference system: ``'ICRF'`` or ``'B1950'``; default:
427+
``'ICRF'``
428428
closest_apparition : boolean, optional
429429
Only applies to comets. This option will choose the closest
430430
apparition available in time to the selected epoch; default: False.
@@ -507,8 +507,8 @@ def ephemerides_async(self, airmass_lessthan=99,
507507
commandline += ' NOFRAG;'
508508

509509
request_payload = OrderedDict([
510-
('batch', 1),
511-
('TABLE_TYPE', 'OBSERVER'),
510+
('format', 'text'),
511+
('EPHEM_TYPE', 'OBSERVER'),
512512
('QUANTITIES', "'"+str(quantities)+"'"),
513513
('COMMAND', '"' + commandline + '"'),
514514
('SOLAR_ELONG', ('"' + str(solar_elongation[0]) + "," +
@@ -519,7 +519,7 @@ def ephemerides_async(self, airmass_lessthan=99,
519519
('ANG_FORMAT', ('DEG')),
520520
('APPARENT', ({False: 'AIRLESS',
521521
True: 'REFRACTED'}[refraction])),
522-
('REF_SYSTEM', (refsystem)),
522+
('REF_SYSTEM', refsystem),
523523
('EXTRA_PREC', {True: 'YES', False: 'NO'}[extra_precision])])
524524

525525
if isinstance(self.location, dict):
@@ -594,7 +594,7 @@ def ephemerides_async(self, airmass_lessthan=99,
594594
return response
595595

596596
def elements_async(self, get_query_payload=False,
597-
refsystem='J2000',
597+
refsystem='ICRF',
598598
refplane='ecliptic',
599599
tp_type='absolute',
600600
closest_apparition=False, no_fragments=False,
@@ -663,7 +663,7 @@ def elements_async(self, get_query_payload=False,
663663
----------
664664
refsystem : string
665665
Element reference system for geometric and astrometric quantities:
666-
``'J2000'`` or ``'B1950'``; default: ``'J2000'``
666+
``'ICRF'`` or ``'B1950'``; default: ``'ICRF'``
667667
refplane : string
668668
Reference plane for all output quantities: ``'ecliptic'`` (ecliptic
669669
and mean equinox of reference epoch), ``'earth'`` (Earth mean
@@ -742,8 +742,8 @@ def elements_async(self, get_query_payload=False,
742742

743743
# configure request_payload for ephemerides query
744744
request_payload = OrderedDict([
745-
('batch', 1),
746-
('TABLE_TYPE', 'ELEMENTS'),
745+
('format', 'text'),
746+
('EPHEM_TYPE', 'ELEMENTS'),
747747
('MAKE_EPHEM', 'YES'),
748748
('OUT_UNITS', 'AU-D'),
749749
('COMMAND', '"' + commandline + '"'),
@@ -973,19 +973,26 @@ def vectors_async(self, get_query_payload=False,
973973

974974
# configure request_payload for ephemerides query
975975
request_payload = OrderedDict([
976-
('batch', 1),
977-
('TABLE_TYPE', 'VECTORS'),
976+
('format', 'text'),
977+
('EPHEM_TYPE', 'VECTORS'),
978978
('OUT_UNITS', 'AU-D'),
979979
('COMMAND', '"' + commandline + '"'),
980980
('CENTER', ("'" + str(self.location) + "'")),
981981
('CSV_FORMAT', ('"YES"')),
982-
('REF_PLANE', {'ecliptic': 'ECLIPTIC', 'earth': 'FRAME',
983-
'body': "'BODY EQUATOR'"}[refplane]),
984-
('REF_SYSTEM', 'J2000'),
982+
('REF_PLANE', {
983+
'ecliptic': 'ECLIPTIC',
984+
'earth': 'FRAME',
985+
'frame': 'FRAME',
986+
'body': "'BODY EQUATOR'"
987+
}[refplane]),
988+
('REF_SYSTEM', 'ICRF'),
985989
('TP_TYPE', 'ABSOLUTE'),
986-
('LABELS', 'YES'),
987-
('VECT_CORR', {'geometric': '"NONE"', 'astrometric': '"LT"',
988-
'apparent': '"LT+S"'}[aberrations]),
990+
('VEC_LABELS', 'YES'),
991+
('VEC_CORR', {
992+
'geometric': '"NONE"',
993+
'astrometric': '"LT"',
994+
'apparent': '"LT+S"'
995+
}[aberrations]),
989996
('VEC_DELTA_T', {True: 'YES', False: 'NO'}[delta_T]),
990997
('OBJ_DATA', 'YES')]
991998
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Generate these files from the following URIs:
2+
3+
ceres_elements.txt
4+
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
5+
6+
ceres_ephemerides.txt
7+
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
8+
9+
ceres_vectors.txt
10+
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
11+
12+
no_H.txt
13+
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
Lines changed: 52 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
1-
*******************************************************************************
2-
JPL/HORIZONS 1 Ceres (A801 AA) 2020-May-29 09:49:47
3-
Rec #: 1 (+COV) Soln.date: 2020-May-20_11:11:55 # obs: 1030 (1995-2020)
1+
API VERSION: 1.0
2+
API SOURCE: NASA/JPL Horizons API
43

4+
*******************************************************************************
5+
JPL/HORIZONS 1 Ceres (A801 AA) 2021-Sep-22 17:02:01
6+
Rec #: 1 (+COV) Soln.date: 2021-Apr-13_11:04:44 # obs: 1075 (1995-2021)
7+
58
IAU76/J2000 helio. ecliptic osc. elements (au, days, deg., period=Julian yrs):
6-
7-
EPOCH= 2454061.5 ! 2006-Nov-22.00 (TDB) Residual RMS= .24184
8-
EC= .07985681703215082 QR= 2.544823927206557 TP= 2454873.5774668744
9-
OM= 80.40822338295483 W= 73.18422155550952 IN= 10.58670363476912
10-
A= 2.765682531058295 MA= 185.9804488570544 ADIST= 2.986541134910033
11-
PER= 4.59951 N= .214289342 ANGMOM= .028516315
12-
DAN= 2.68599 DDN= 2.81303 L= 153.318086
13-
B= 10.1291284 MOID= 1.57983994 TP= 2009-Feb-11.0774668744
14-
9+
10+
EPOCH= 2458849.5 ! 2020-Jan-01.00 (TDB) Residual RMS= .24563
11+
EC= .07687465013145245 QR= 2.556401146697176 TP= 2458240.1791309435
12+
OM= 80.3011901917491 W= 73.80896808746482 IN= 10.59127767086216
13+
A= 2.769289292143484 MA= 130.3159688200986 ADIST= 2.982177437589792
14+
PER= 4.60851 N= .213870839 ANGMOM= .028541613
15+
DAN= 2.69515 DDN= 2.81323 L= 153.8445988
16+
B= 10.1666388 MOID= 1.59231997 TP= 2018-May-01.6791309435
17+
1518
Asteroid physical parameters (km, seconds, rotational period in hours):
1619
GM= 62.6284 RAD= 469.7 ROTPER= 9.07417
17-
H= 3.4 G= .120 B-V= .713
20+
H= 3.53 G= .120 B-V= .713
1821
ALBEDO= .090 STYP= C
19-
20-
ASTEROID comments:
21-
1: soln ref.= JPL#47, OCC=0 radar(60 delay, 0 Dop.)
22+
23+
ASTEROID comments:
24+
1: soln ref.= JPL#48, OCC=0 radar(60 delay, 0 Dop.)
2225
2: source=ORB
2326
*******************************************************************************
2427

2528

2629
*******************************************************************************
27-
Ephemeris / WWW_USER Fri May 29 09:49:47 2020 Pasadena, USA / Horizons
30+
Ephemeris / API_USER Wed Sep 22 17:02:01 2021 Pasadena, USA / Horizons
2831
*******************************************************************************
29-
Target body name: 1 Ceres (A801 AA) {source: JPL#47}
30-
Center body name: Sun (10) {source: DE431}
32+
Target body name: 1 Ceres (A801 AA) {source: JPL#48}
33+
Center body name: Sun (10) {source: DE441}
3134
Center-site name: BODY CENTER
3235
*******************************************************************************
3336
Start time : A.D. 2000-Jan-01 00:00:00.0000 TDB
@@ -36,51 +39,49 @@ Step-size : 0 steps
3639
*******************************************************************************
3740
Center geodetic : 0.00000000,0.00000000,0.0000000 {E-lon(deg),Lat(deg),Alt(km)}
3841
Center cylindric: 0.00000000,0.00000000,0.0000000 {E-lon(deg),Dxy(km),Dz(km)}
39-
Center radii : 696000.0 x 696000.0 x 696000.0 k{Equator, meridian, pole}
40-
Keplerian GM : 2.9591220828559093E-04 au^3/d^2
41-
Small perturbers: Yes {source: SB431-N16}
42+
Center radii : 696000.0 x 696000.0 x 696000.0 k{Equator, meridian, pole}
43+
Keplerian GM : 2.9591220828411951E-04 au^3/d^2
44+
Small perturbers: Yes {source: SB441-N16}
4245
Output units : AU-D, deg, Julian Day Number (Tp)
4346
Output type : GEOMETRIC osculating elements
4447
Output format : 10
45-
Reference frame : ICRF/J2000.0
46-
Coordinate systm: Ecliptic and Mean Equinox of Reference Epoch
48+
Reference frame : Ecliptic of J2000.0
4749
*******************************************************************************
4850
Initial IAU76/J2000 heliocentric ecliptic osculating elements (au, days, deg.):
49-
EPOCH= 2454061.5 ! 2006-Nov-22.00 (TDB) Residual RMS= .24184
50-
EC= .07985681703215082 QR= 2.544823927206557 TP= 2454873.5774668744
51-
OM= 80.40822338295483 W= 73.18422155550952 IN= 10.58670363476912
52-
Equivalent ICRF heliocentric equatorial cartesian coordinates (au, au/d):
53-
X= 2.732617277025615E+00 Y=-7.734822664676754E-01 Z=-9.207592896905449E-01
54-
VX= 3.368590810386608E-03 VY= 8.330863405401928E-03 VZ= 3.238410491551668E-03
55-
Asteroid physical parameters (km, seconds, rotational period in hours):
56-
GM= 62.6284 RAD= 469.7 ROTPER= 9.07417
57-
H= 3.4 G= .120 B-V= .713
58-
ALBEDO= .090 STYP= C
51+
EPOCH= 2458849.5 ! 2020-Jan-01.00 (TDB) Residual RMS= .24563
52+
EC= .07687465013145245 QR= 2.556401146697176 TP= 2458240.1791309435
53+
OM= 80.3011901917491 W= 73.80896808746482 IN= 10.59127767086216
54+
Equivalent ICRF heliocentric cartesian coordinates (au, au/d):
55+
X= 1.007608869613381E+00 Y=-2.390064275223502E+00 Z=-1.332124522752402E+00
56+
VX= 9.201724467227128E-03 VY= 3.370381135398406E-03 VZ=-2.850337057661093E-04
57+
Asteroid physical parameters (km, seconds, rotational period in hours):
58+
GM= 62.6284 RAD= 469.7 ROTPER= 9.07417
59+
H= 3.53 G= .120 B-V= .713
60+
ALBEDO= .090 STYP= C
5961
*******************************************************************************
6062
JDTDB, Calendar Date (TDB), EC, QR, IN, OM, W, Tp, N, MA, TA, A, AD, PR,
6163
**************************************************************************************************************************************************************************************************************************************************************************************************************************************************
6264
$$SOE
63-
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,
65+
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,
6466
$$EOE
6567
**************************************************************************************************************************************************************************************************************************************************************************************************************************************************
6668
Coordinate system description:
6769

68-
Ecliptic and Mean Equinox of Reference Epoch
70+
Ecliptic at the standard reference epoch
6971

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

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

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

9495
Geometric states/elements have no aberrations applied.
9596

97+
9698
Computations by ...
9799
Solar System Dynamics Group, Horizons On-Line Ephemeris System
98100
4800 Oak Grove Drive, Jet Propulsion Laboratory
99101
Pasadena, CA 91109 USA
100-
Information: http://ssd.jpl.nasa.gov/
101-
Connect : telnet://ssd.jpl.nasa.gov:6775 (via browser)
102-
http://ssd.jpl.nasa.gov/?horizons
103-
telnet ssd.jpl.nasa.gov 6775 (via command-line)
104-
102+
Information : https://ssd.jpl.nasa.gov/
103+
Documentation: https://ssd.jpl.nasa.gov/?horizons_doc
104+
Connect : https://ssd.jpl.nasa.gov/?horizons (browser)
105+
telnet ssd.jpl.nasa.gov 6775 (command-line)
106+
e-mail command interface available
107+
Script and CGI interfaces available
108+
105109
*******************************************************************************

0 commit comments

Comments
 (0)