Viewing contents of file '../idllib/contrib/buie/altoha.pro'
;+
; NAME:
; altoha
; PURPOSE: (one line)
; Convert an object altitude to its hour angle.
; DESCRIPTION:
; CATEGORY:
; Astronomy
; CALLING SEQUENCE:
; altoha,alt,dec,lat,ha,type
; INPUTS:
; alt - Altitude of object above horizon in radians
; dec - Declination of object in radians
; lat - Latitude of observatory in radians
; OPTIONAL INPUT PARAMETERS:
; KEYWORD INPUT PARAMETERS:
; OUTPUTS:
; ha - hour angle for object (< 0 is East, > 0 is West)
; type - indicates the success of the conversion
; -1 object is always below ALT
; 0 conversion ok, HA valid
; 1 object is always above ALT
; KEYWORD OUTPUT PARAMETERS:
; COMMON BLOCKS:
; SIDE EFFECTS:
; RESTRICTIONS:
; PROCEDURE:
; MODIFICATION HISTORY:
; 94/05/07 - Written by Marc W. Buie, Lowell Observatory
;-
pro altoha,alt,dec,lat,ha,type
cosha = (sin(alt)-sin(dec)*sin(lat))/(cos(dec)*cos(lat))
if cosha gt 1.0d0 then $
type = -1 $
else if cosha lt -1.0d0 then $
type = 1 $
else $
type = 0
if type eq 0 then ha = acos(cosha)
end