How do I specify the Royal Observatory at Greenwich as a PyEphem observer?

100 Views Asked by At

The PyEphem package provides the ability generate an Observer instance by providing the name of a city to the ephem.city() utility function, but seems to lack a way of specifying the Royal Observatory at Greenwich as a city.

Is there a name recognized by PyEphem that corresponds to the Royal Observatory at Greenwich? Is there a list somewhere of the cities that PyEphem recognizes?

1

There are 1 best solutions below

1
On

You are correct — the Royal Greenwich Observatory is not a city and not available through the city() function. Instead, you will have to create its location manually:

gw = ephem.Observer()
gw.lat = '51:28:36.7'

(Note that you do not have to set the lon of the Observer because observers start out with zero as their latitude and longitude if you are not more specific.)