How to determine how long Earth Satellite has been eclipsed?
See original GitHub issueI have a long history with PyEphem but I’m still getting used to Skyfield, and have been working on transitioning for years 😃
I have a simple PyEphem script which will tell me whether a satellite is currently eclipsed, and in either case, how long it has been in its current state. I want to use this for the sake of checking the thermals and battery voltages of a satellite currently on-orbit (having sun timing context is useful for making sure these values are nominal).
In PyEphem, the script looks like (abbreviated):
rise_time, rise_azimuth, max_alt_time, max_alt, set_time, set_azimuth=groundstation.next_pass(satellite)
initial_eclipse_status = satellite.eclipsed
while(satellite.eclipsed == initial_eclipse_status):
#Step back one second and recompute, until we find a change.
eclipse_time -= ephem.second
satellite.compute(eclipse_time)
time_since_eclipse_change = rise_time - eclipse_time
Now the initial eclipse status and the time difference tells me everything I’m looking for.
In Skyfield, I can’t seem to find any such method for stepping back in time until it changes. The closest I can do is:
sf_risetime_past_hour = ts.utc(*list(sf_risetime.tt_calendar()[:-1]),range(-3600,0,60))
illum_array = sf_satellite.at(sf_risetime_past_hour).is_sunlit(eph)
print(illum_array)
So once I know a rise time, I can step back for the past hour and check for any changes, but this is a little more clunky, and if the last change in eclipse was over an hour ago (my PyEphem solution is telling me that a particular pass I’m interested in will have been sunlit for 274 minutes continously), I learn nothing. Is there a way to do the Skyfield solution in a manner which would be as flexible as PyEphem?
Issue Analytics
- State:
- Created 3 years ago
- Comments:21 (15 by maintainers)
Top GitHub Comments
Go ahead and close the issue.
Thanks everyone for the massive learning experience! I got way more than I bargained for 😃
Thanks for all of the great diagrams, @glangford!
@tj-murphy — At this point is this issue answered to your satisfaction, or do you have further lingering questions we could address?