Skip to content

Commit

Permalink
Merge pull request #242 from mkelley/fix-siderealtime-crash
Browse files Browse the repository at this point in the history
Do not require any returned columns from JPL Horizons, except time.
  • Loading branch information
mkelley committed Mar 28, 2020
2 parents e719a07 + 60fc517 commit 58f3d6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sbpy/data/ephem.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ def from_horizons(cls, targetids, id_type='smallbody',
scale='ut1', format='jd').utc.jd
all_eph['epoch'] = Time(all_eph['datetime_jd'], format='jd',
scale='utc')
all_eph['siderealtime'].unit = u.Unit('hour')
if 'siderealtime' in all_eph.colnames:
all_eph['siderealtime'].unit = u.Unit('hour')

all_eph.remove_column('datetime_jd')
all_eph.remove_column('datetime_str')
Expand Down
11 changes: 11 additions & 0 deletions sbpy/data/tests/test_ephem_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ def test_output_epochs(self):
except IERSRangeError:
pass

def test_minimum_working_columns(self):
"""Avoid assuming any particular columns are returned.
Regression test for #242.
"""
e = Ephem.from_horizons(1, quantities='1') # just RA, Dec
assert len(e) == 1
e = Ephem.from_horizons(1, quantities='19') # just rh and delta-rh
assert len(e) == 1


@pytest.mark.remote_data
class TestEphemFromMPC:
Expand Down

0 comments on commit 58f3d6e

Please sign in to comment.