Skip to content

next_pass throws ValueError when called during an ongoing pass (sometimes) #164

@kerel-fs

Description

@kerel-fs

🐞 Problem
The function next_pass invoked with singlepass=True (default since pyephem 3.7.7.0) throws an ValueError when there is an ongoing pass at observer.time sometimes (i.e. not for all datetimes during an onging pass, but for some, thanks @adamkalis for figuring this out!).

ValueError: this software is having trouble with those satellite parameters
Example code

from datetime import datetime, timedelta
import ephem

tle = ['SATHYABAMASAT',
       '1 41600U 16040B   19310.17193730  .00001455  00000-0  63216-4 0  9994',
       '2 41600  97.3537  10.1403 0012192 255.4467 104.5418 15.23822105187350']
station = {"altitude": 100,
           "lat": 42.0,
           "lon": 32.0}

timestamp_str = '2019-11-06T20:01:28Z'

timestamp = datetime.strptime(timestamp_str, '%Y-%m-%dT%H:%M:%SZ')

observer = ephem.Observer()
observer.lat = str(station['lat'])
observer.lon = str(station['lon'])
observer.elevation = station['altitude']
observer.date = timestamp 

satellite = ephem.readtle(*tle)

d = observer.next_pass(satellite, True) # throws ValueError

Expected output: The pass details of the following pass (i.e. the next pass after the currently ongoing one has finished).

Pass details (calculated using sattools/pass)

rise time rise az tt t az t altitude set time set az
2019-11-06T19:58:51 204 20:03:55 267 17 20:09:03 330
2019-11-07T07:25:53 20 07:31:32 98 38 07:37:07 176

References

Best regards,
kerel

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions