Skip to content

Commit

Permalink
Fix #466 by correcting from_satrec() epoch formula
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-rhodes committed Oct 31, 2020
1 parent 9a718e7 commit 4bcdecb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Changelog
=========

1.32 — Future
-------------

* Fix: the ``.epoch`` attribute of Earth satellite objects that were
built using :meth:`~skyfield.sgp4lib.EarthSatellite.from_satrec()`
was, alas, a half-day off.
`#466 <https://github.com/skyfielders/python-skyfield/issues/466>`_

1.31 — 2020 October 24
----------------------

Expand Down
2 changes: 1 addition & 1 deletion skyfield/documentation/earth-satellites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ call this special constructor:
.. testoutput::

Satellite number: 5
Epoch: A.D. 2000-Jun-27 06:50:24.0000 UT
Epoch: A.D. 2000-Jun-27 18:50:24.0000 UT

The result should be a satellite object that behaves
exactly as though it had been loaded from TLE lines.
1 change: 1 addition & 0 deletions skyfield/sgp4lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def from_satrec(cls, satrec, ts):
# be unified to always use epochyr and epochdays.
whole, fraction = divmod(satrec.jdsatepoch, 1.0)
year, month, day = compute_calendar_date(whole)
day += 0.5 # convert integer Julian day into Julian date float
self.epoch = ts.utc(year, month, day + fraction + satrec.jdsatepochF)

self._setup(satrec)
Expand Down

0 comments on commit 4bcdecb

Please sign in to comment.