Skip to content

Commit 39f1626

Browse files
Add find_rising() test to keep #996 fixed
This test is based on the example script in the issue. Fixes #996.
1 parent 01499b6 commit 39f1626

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

CHANGELOG.rst

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ Next version
3232
An advantage is that the new name is self-documenting: the name
3333
reminds the user that it is a 3-vector with Cartesian components.
3434

35+
* Fix: the :meth:`~skyfield.sgp4lib.EarthSatellite.find_events()` Earth
36+
satellite method was returning an empty list of events if the only
37+
event in the time period was a sole rising or setting. It should now
38+
find them successfully.
39+
3540
* Fix: bodies with Kepler orbits (like comets and asteroids) were
3641
incorrectly returning positions with only a single dimension if given
3742
a :class:`~skyfield.timelib.Time` that was an array but had only one

skyfield/tests/test_satellite_events.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def test_satellite_events_on_several_satellites():
1212
# 3) No double rises or double sets
1313

1414
def run_sat(name, line1, line2, number_events_expected):
15-
print(name)
1615
sat = EarthSatellite(line1, line2, name)
1716
t, y = sat.find_events(topos, t0, t1, horizon)
17+
print('{}: {} events'.format(name, len(t)))
1818

1919
assert len(t) == len(y)
2020
assert len(t) == number_events_expected
@@ -116,7 +116,20 @@ def run_sat(name, line1, line2, number_events_expected):
116116
90,
117117
)
118118

119-
# Issue #996: should detect rising without needing a culmination
119+
# Issue #996: detect setting even if we missed the culmination
120+
121+
t0 = ts.utc(2022, 1, 2, 3, 15)
122+
t1 = ts.utc(2022, 1, 2, 3, 45)
123+
topos = wgs84.latlon(-24.626331, -70.403964, 2369.34)
124+
horizon = 30.0
125+
run_sat(
126+
'O3B PFM',
127+
'1 39191U 13031D 21365.68950013 -.00000013 00000-0 00000-0 0 9995',
128+
'2 39191 000.0397 004.0913 0002586 278.0623 077.8173 05.00115674155430',
129+
1,
130+
)
131+
132+
# Issue #996 (comment): detect rising without a culmination
120133

121134
t0 = ts.utc(2024, 8, 26, 8, 38)
122135
t1 = t0 + 5.0/24.0

0 commit comments

Comments
 (0)