;+
; NAME:
;	HORIZONANGLE
;
; PURPOSE:
;	Compute the Xray tangent angle as a function of spacecraft altitude
;
; CATEGORY:
;	MATH, EPHEMERIS, BATSE
;
; CALLING SEQUENCE:
;	Result = HORIZONANGLE( Sc_rad)
;
; INPUTS:
;	Sc_rad - the spacecraft radius in km measured from the center of the Earth
;
; OUTPUTS:
;	The result is the tangle angle for that spacecraft radius.
;
; PROCEDURE:
;	The horizon angle is the angle formed by the Earth-Spacecraft-Source directions
;	when the source is just visible in hard X-rays above the horizon. 
;
; EXAMPLE:
;	hangle = HORIZONANGLE( Sc_rad)
;
; MODIFICATION HISTORY:
; 	Version 2, ras, 29-mar-1995 Documented
;-
FUNCTION HORIZONANGLE, Sc_rad
;for s/c radius in km return horizon angle
;The horizon angle is the angle formed by the Earth-Spacecraft-Source directions
;when the source is just visible in hard X-rays above the horizon. 
;
;	for h=493.+6378. ;height of s/c in km
;	hangle=  69.985    
;
re=6378.      				;radius of Earth in km
tanheight=78. 				;tangent height of earth atmos. in km for X-rays
hangle=!radeg*asin( (re+tanheight)/(sc_rad)) 

return, hangle 
end

