astropy / astroquery

Functions and classes to access online data resources. Maintainers: @keflavich and @bsipocz and @ceb8
http://astroquery.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
696 stars 397 forks source link

doc example fails with KeyError 'ObsSub-LON' #1741

Closed michaelaye closed 4 years ago

michaelaye commented 4 years ago
>>> from astroquery.jplhorizons import Horizons
>>> obj = Horizons(id='Ceres', location='568',
...                epochs={'start':'2010-01-01', 'stop':'2010-03-01',
...                        'step':'10d'})
>>> eph = obj.ephemerides()
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-16-c96bac856542> in <module>
      3                epochs={'start':'2010-01-01', 'stop':'2010-03-01',
      4                        'step':'10d'})
----> 5 eph = obj.ephemerides()

~/miniconda3/envs/py37/lib/python3.7/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)

~/miniconda3/envs/py37/lib/python3.7/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

~/miniconda3/envs/py37/lib/python3.7/site-packages/astroquery/jplhorizons/core.py in _parse_result(self, response, verbose)
   1282             return None
   1283         else:
-> 1284             data = self._parse_horizons(response.text)
   1285 
   1286         return data

~/miniconda3/envs/py37/lib/python3.7/site-packages/astroquery/jplhorizons/core.py in _parse_horizons(self, src)
   1245         rename = []
   1246         for col in data.columns:
-> 1247             data[col].unit = column_defs[col][1]
   1248             if data[col].name != column_defs[col][0]:
   1249                 rename.append(data[col].name)

KeyError: 'ObsSub-LON'

astroquery version 0.4

bsipocz commented 4 years ago

I'll tag a new release later this week week, in the meantime please upgrade astroquery to 0.4.1 as there has been some serverside changes in Horizon meaning v0.4 is not expected to work any more.

pip install --pre -U astroquery

michaelaye commented 4 years ago

Works with 0.4.1.dev0, thanks!