For a given Observer
location and time, position (Alt, Az)
and position angle alpha
, how can I compute the corresponding position angle in the Galactic (GLON, GLAT)
coordinate system using PyEphem?

- 2,790
- 2
- 18
- 23
-
An observer location and time should, by itself, provide a unique "up" direction: the zenith-point that stands directly above that longitude and latitude at exactly that time and date. What, then, do you mean by talking about a separate “alpha” vector which is a different “up” direction? – Brandon Rhodes Aug 02 '12 at 01:00
-
I mentioned the "up direction" just as one example where `alpha=0`. I removed this example since I agree it was more confusing than helpful. What I want is a general function for any position angle `alpha = 0 .. 360 deg`. – Christoph Aug 02 '12 at 05:39
2 Answers
GOOD question! Because the "libastro" library on which PyEphem is based is intended only for displaying stars and planets on the screen and solving for events like conjunctions and eclipses, it does not seem to have any functions for dealing with position angles — the most that PyEphem has at the moment is a separation()
function that deals with the magnitude, not the angle, of the vector between two coordinates — and that function was written specifically for PyEphem, and is not actually part of "libastro"!
Could you create a bug at the following link to remind me to add this to PyEphem for the next version? Thanks!
https://github.com/brandon-rhodes/pyephem/issues?state=open
Meanwhile I will look to see whether some other astronomy package might be able to do the position angle computation for you — I did see angle libraries being discussed recently on the "astropy" mailing list, so I will let you know what I find.

- 83,755
- 16
- 106
- 147
-
1Thanks for considering to add this functionality. Here's the [github ticket](https://github.com/brandon-rhodes/pyephem/issues/1). – Christoph Aug 13 '12 at 13:38
I'm very not familiar with PyEphem, but this might help you. He is asking the opposite of what you are, but by reversing the algorithm, you will probably be able to succeed.

- 1
- 1

- 417
- 1
- 4
- 20
-
The other question you mention is for transforming a point, here I am asking how to transform a [position angle](http://en.wikipedia.org/wiki/Position_angle) – Christoph Aug 01 '12 at 20:16
-
Oops, I didn't realize that. Could you potentially create a point along the given position angle and transform that point, then use that to find the position angle in the Galactic coordinate system? – Shivam Sarodia Aug 01 '12 at 20:17
-
Yes, probably transforming a second point is the way to implement it. But it is not obvious what a good choice for the second point is (i.e. one that will work for any `Alt, Az, Alpha` and give numerically stable results) and how to measure the angle in the Galactic system. Probably [the posang.pro IDL routine](http://idlastro.gsfc.nasa.gov/ftp/pro/astro/posang.pro) is half of the solution to this problem. – Christoph Aug 02 '12 at 05:41