Skip to content

Commit 1ba112a

Browse files
committed
Remove deprecation warnings and warn in documentation.
Remove 'id' as an ``id_type`` option (it had no effect).
1 parent 343c7a5 commit 1ba112a

File tree

3 files changed

+26
-33
lines changed

3 files changed

+26
-33
lines changed

CHANGES.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,13 @@ jplhorizons
3434
Included in this update, the default reference system is changed from
3535
J2000 to ICRF, following API documentation. [#2154]
3636

37-
- Query `id_type` behavior and options are changing:
38-
- `'majorbody'` has been renamed to `''` (empty string) to represent the
39-
Horizons default behavior. The Horizons default to search major bodies
40-
first, then fall back to a small body search. Horizons does not have
41-
a major body only search.
42-
- The default behavior was `'smallbody'` but this will be changed to the
43-
Horizons default in a future version.
44-
- Deprecation warnings are raised if `id_type` is `'majorbody'` or
45-
was not specified by the user.
37+
- Query ``id_type`` behavior has changed:
38+
- ``'majorbody'`` has been removed and the equivalent functionality
39+
replaced ``None``. This implements the Horizons default, which is to
40+
search for major bodies first, then fall back to a small body search when
41+
no matches are found. Horizons does not have a major body only search.
42+
- The default value was ``'smallbody'`` but it is now ``None``, which
43+
follows Horizons's default behavior.
4644

4745
Infrastructure, Utility and Other Changes and Additions
4846
-------------------------------------------------------

astroquery/jplhorizons/core.py

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from astropy.table import Table, Column
1313
from astropy.io import ascii
1414
from astropy.time import Time
15-
from astropy.utils.exceptions import AstropyDeprecationWarning
1615

1716
# 3. local imports - use relative imports
1817
# commonly required local imports shown below as example
@@ -30,7 +29,7 @@
3029
class HorizonsClass(BaseQuery):
3130
"""
3231
A class for querying the
33-
`JPL Horizons <https://ssd.jpl.nasa.gov/horizons.cgi>`_ service.
32+
`JPL Horizons <https://ssd.jpl.nasa.gov/horizons/>`_ service.
3433
"""
3534

3635
TIMEOUT = conf.timeout
@@ -48,7 +47,7 @@ def __init__(self, id=None, location=None, epochs=None,
4847
orbital element or vector queries. Uses the same codes as JPL
4948
Horizons. If no location is provided, Earth's center is used for
5049
ephemerides queries and the Sun's center for elements and vectors
51-
queries. Arbitrary topocentic coordinates for ephemerides queries
50+
queries. Arbitrary topocentric coordinates for ephemerides queries
5251
can be provided in the format of a dictionary. The dictionary has to
5352
be of the form {``'lon'``: longitude in deg (East positive, West
5453
negative), ``'lat'``: latitude in deg (North positive, South
@@ -66,13 +65,12 @@ def __init__(self, id=None, location=None, epochs=None,
6665
time is used.
6766
id_type : str, optional
6867
Controls Horizons's object selection for ``id``
69-
[HORIZONSDOC_SELECTION]_ . Options: ``'majorbody'`` (DEPRECATED,
70-
use ``''``), ``'designation'`` (small body designation), ``'name'``
71-
(asteroid or comet name), ``'asteroid_name'``, ``'comet_name'``,
72-
``'id'`` (Horizons ID number), ``'smallbody'`` (asteroid and comet
73-
search), or ``''`` (empty string; first search search planets,
74-
natural satellites, spacecraft, and special cases, then small
75-
bodies).
68+
[HORIZONSDOC_SELECTION]_ . Options: ``'designation'`` (small body
69+
designation), ``'name'`` (asteroid or comet name),
70+
``'asteroid_name'``, ``'comet_name'``, ``'smallbody'`` (asteroid
71+
and comet search), or ``None`` (first search search planets,
72+
natural satellites, spacecraft, and special cases, and if no
73+
matches, then search small bodies).
7674
7775
References
7876
----------
@@ -110,19 +108,9 @@ def __init__(self, id=None, location=None, epochs=None,
110108
self.epochs = epochs
111109

112110
# check for id_type
113-
if id_type is None:
114-
warnings.warn('id_type was not specified, defaulting to a '
115-
'"smallbody" search. This behavior is deprecated and will be '
116-
'changed to "" (empty string / Horizons default) in the future.',
117-
AstropyDeprecationWarning)
118-
id_type = 'smallbody'
119-
elif id_type == 'majorbody':
120-
warnings.warn('id_type "majorbody" is deprecated and will be '
121-
'removed. For the equivalent search behavior, use "" (empty '
122-
'string).', AstropyDeprecationWarning)
123-
id_type = ''
124-
if id_type not in ['', 'smallbody', 'designation', 'name',
125-
'asteroid_name', 'comet_name', 'id']:
111+
112+
if id_type not in [None, 'smallbody', 'designation', 'name',
113+
'asteroid_name', 'comet_name']:
126114
raise ValueError('id_type ({:s}) not allowed'.format(id_type))
127115
self.id_type = id_type
128116

docs/jplhorizons/jplhorizons.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@
66
JPL Horizons Queries (`astroquery.jplhorizons`/astroquery.solarsystem.jpl.horizons)
77
***********************************************************************************
88

9+
.. Warning::
10+
11+
The default search behavior has changed. In v0.4.3 and earlier, the default
12+
``id_type`` was ``'smallbody'``. With v0.4.4, the default is ``None``, which
13+
aligns with JPL Hoirizons's `default behavior
14+
<https://ssd.jpl.nasa.gov/?horizons_doc#selection>`_: search major bodies
15+
first, and if no major bodies are found, then search small bodies.
16+
917
.. Note::
1018

1119
Due to serverside changes the ``jplhorizons`` module requires astroquery v0.4.1 or newer.
1220
Previous versions are not expected to function, please upgrade the package if you observe any issues.
1321

14-
1522
Overview
1623
========
1724

0 commit comments

Comments
 (0)