[AstroPy] Hour Angle from location and alt/az

John K. Parejko parejkoj at uw.edu
Fri Nov 4 20:04:25 EDT 2016

Hello astropythians,

I’m trying to work around a distinct lack of UT1 and LST in some telescope file headers, and was wondering if there’s a straight-forward astropy way to get a source’s Hour Angle from the alt/az, ra/dec, and telescope location. I can build an altaz SkyCoord, but I’m not sure what to do with it from there:

loc = coord.EarthLocation.from_geodetic(long, lat, elevation)
sky = coord.SkyCoord(az, alt, location=loc, frame='altaz', unit='deg’)

I can’t transform this to ICRS:

ipdb> sky.transform_to(coord.ICRS)
*** TypeError: unsupported operand type(s) for -: 'NoneType' and ‘float’

and there’s not an “hour_angle” method that I can see in either of those.

Per the internet[1], one should be able to get HA from alt/az and dec directly (modulo refraction corrections):

HA = asin(- sin(az)*cos(alt) / cos(dec))

I can do that, but I was hoping for a nice and tidy astropy method.


1: http://star-www.st-and.ac.uk/~fv/webnotes/chapter7.htm

John Parejko
parejkoj at uw.edu
Department of Physics and Astronomy
University of Washington
Seattle, WA

More information about the AstroPy mailing list