Ray Roberts
Ray Roberts

Reputation: 23

ephem Sidereal Time Python

The example given in Ephem works fine, what the problem is using the observers exact longitude which is not shown in the examples.

Instead of using a general location of a city, I need to use the exact longitude of the observer.

import ephem
madrid = ephem.city('Madrid')
madrid.date = '1978/10/3 11:32'
print(madrid.sidereal_time())

Upvotes: 1

Views: 1697

Answers (1)

Brandon Rhodes
Brandon Rhodes

Reputation: 89415

Create your own Observer instead of using a pre-built one from the city() function, and set its longitude and latitude yourself:

import ephem
gatech = ephem.Observer()
gatech.lon, gatech.lat = '-84.39733', '33.775867'
gatech.date = '1978/10/3 11:32'
print(gatech.sidereal_time())

You can read more about creating your own observer objects by reading about “Computations for Particular Observers” in the documentation:

http://rhodesmill.org/pyephem/tutorial.html#computations-for-particular-observers

Upvotes: 1

Related Questions