Feature request: JplHorizons to support packed asteroid number
- Dominant language
- Python
- Stars
- 791
- Forks
- 451
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 4
Description
Many asteroid catalogs contain either packed numbers or designations (or both): https://www.minorplanetcenter.net/iau/info/PackedDes.html
jplhorizons does support packed asteroid designations (which is good), but not packed asteroid numbers. Sample code to reproduce the problem:
```
>>> import astroquery
>>> print(astroquery.version.version)
>>> from astroquery.jplhorizons import Horizons
>>> compressed = 'q3791'
>>> hor = Horizons( id=compressed, location="@JWST", epochs={'start':'2021-04-01', 'stop':'2022-04-01', 'step':'1d'} )
>>> eph = hor.ephemerides()
0.3.9
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in ()
4 compressed = 'q3791'
5 hor = Horizons( id=compressed, location="@JWST", epochs={'start':'2021-04-01', 'stop':'2022-04-01', 'step':'1d'} )
----> 6 eph = hor.ephemerides()
~/anaconda3/envs/miricle/lib/python3.5/site-packages/astroquery/utils/class_or_instance.py in f(*args, **kwds)
23 def f(*args, **kwds):
24 if obj is not None:
---> 25 return self.fn(obj, *args, **kwds)
26 else:
27 return self.fn(cls, *args, **kwds)
~/anaconda3/envs/miricle/lib/python3.5/site-packages/astroquery/utils/process_asyncs.py in newmethod(self, *args, **kwargs)
27 if kwargs.get('get_query_payload') or kwargs.get('field_help'):
28 return response
---> 29 result = self._parse_result(response, verbose=verbose)
30 self.table = result
31 return result
~/anaconda3/envs/miricle/lib/python3.5/site-packages/astroquery/jplhorizons/core.py in _parse_result(self, response, verbose)
1223 return None
1224 else:
-> 1225 data = self._parse_horizons(response.text)
1226
1227 return data
~/anaconda3/envs/miricle/lib/python3.5/site-packages/astroquery/jplhorizons/core.py in _parse_horizons(self, src)
1096 "No matches found" in src[idx + 1]):
1097 raise ValueError(('Unknown target ({:s}). Maybe try '
-> 1098 'different id_type?').format(self.id))
1099 # catch any unavailability of ephemeris data
1100 if "No ephemeris for target" in line:
ValueError: Unknown target (q3791). Maybe try different id_type?
```
The Horizons web interface does support compressed numbers and correctly resolves q3791 to 523791 (2015 HT171).
jplhorizons does support packed designations. E.g., replace 'q3791' in the code above with 'K10F92H' (resolves to 2010 FH92)
Contributor guide
Research direction
Start with the astroquery.jplhorizons.Horizons entry point and reproduce the sample using id='q3791' and ephemerides(). Compare this with the working packed-designation example; done means packed asteroid numbers such as q3791 resolve successfully through the JPL Horizons interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100