EarthSatellite rise and set of next pass

Bug #572402 reported by Mr.Peanut
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
PyEphem
Won't Fix
Undecided
Unassigned

Bug Description

I am getting inconsistent results for rising and setting times for the EarthSatellite type. I am running the code from an Idle window. Each time I run it, I get varying results. In addition the setting the observer horizon is not working perhaps due to the rising/setting time weirdness. Please see my code below.

import ephem
import os
from math import ceil

def readTLE(TLEfile, satellite) :
    print TLEfile, satellite
    if os.path.isfile(TLEfile) :
# logging.info('TLE file: %s' % TLEfile)
        f = open(TLEfile,'r')
        for line in f :
            if line.strip() == satellite :
                TLE = [ line.strip() ]
                TLE.append(f.next().strip())
                TLE.append(f.next().strip())
                break
    else:
# logging.warn('TLE file: %s not found. Aborting.' % TLEfile)
        return
    f.close()
    return TLE

TLE = readTLE('C:/Project/meris_transfer/calc_orbit_number/resource.txt','ENVISAT')
#print TLE
envisat = ephem.readtle(TLE[0], TLE[1], TLE[2])
halifax = ephem.Observer()
halifax.lat, halifax.long = '44:39:00', '63:34:00'
halifax.horizon = '00:00'
np = halifax.next_pass(envisat)
#print np
#print envisat._orbit, envisat._epoch
orbit_number = int(ceil((np[0]-envisat._epoch) * (501/35) + envisat._orbit))
print orbit_number
rising_time, setting_time = np[0], np[4]
print rising_time, setting_time
envisat.compute(rising_time)
rise_eclipsed = envisat.eclipsed
envisat.compute(setting_time)
set_eclipsed = envisat.eclipsed
iseclipsed = rise_eclipsed and set_eclipsed
print iseclipsed

Revision history for this message
Mr.Peanut (seamus-spam) wrote :

(Latest pyephem version, Python 2.6.5, WinXP)

And deleting ephem, halifax and TLE in the Ide Python shell window, between successive executions from the Idle code window, makes no difference.

Revision history for this message
Mr.Peanut (seamus-spam) wrote :

In fact, sometimes the setting time precedes the rising time!

Revision history for this message
Dan CaJacob (dan-wph05) wrote :

I have also noticed this bug. Has there been any work on it? I will probably take a look at the source tonight, because I would really like to use this package for some projects I am working on.

Revision history for this message
Kevin Warren (warrenkm) wrote :

I'm seeing the same thing regarding the setting before rising problem. It's fairly rare but it does happen. It seems to be most likely when the satellite is in a pass or just leaving a pass (visible).

Revision history for this message
François Steinmetz (francois-steinmetz) wrote :

I have also encountered this bug :
1) I define an earth satellite using TLE and an observer, and find the satellite next_pass()
2) I set the new observer date to the previously found set_time, in order to find another next_pass()
3) In this case, this bug happens (I get inconsistent rise, transit and set times)
4) If in 2), I define the new date as "set_time + 5 min" (ie, obs.date = float(set_time) + 5./(24.*60.)), the results are consistent

Revision history for this message
Brandon Rhodes (brandon-rhodes) wrote :

The earth satellite rise and set logic is an independent part of "libastro" that I have never yet been able to improve upon, despite its inconsistencies in output — the problem of finding when a fast-moving object intersects the horizon are more complex than when a well-behaved slow-moving planet or comet does! I have opened a bug for this on GitHub to track my progress, and will close this old issue here on LaunchPad since I am not using it for PyEphem any more:

https://github.com/brandon-rhodes/pyephem/issues/2

Changed in pyephem:
status: New → Fix Released
status: Fix Released → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.