;+ ; NAME: ; DIST2ZA ; PURPOSE: ; Calculating zenith angle from horizontal zenith distance ; at an assumed altitude. ; CATEGORY: ; ; CALLING SEQUENCE: ; result = DIST2ZA( DIST, H [, /DEGREES] [, RADIUS=radius] ) ; INPUTS: ; DIST: Distance (in km) from the local zenith of something, ; e.g., an emission feature. ; H: Assumed emission height in km. ; OPTIONAL INPUTS: ; None. ; KEYWORD PARAMETERS: ; /DEGREES: If set, zenith angle is output in degrees. ; RADIUS: Desired local radius of spheroidal body from which ; emission feature was observed (default = 6371.2 km). ; OUTPUTS: ; result: Zenith angle of emission feature (Same sign as DIST). ; OPTIONAL OUTPUTS: ; None. ; COMMON BLOCKS: ; None. ; SIDE EFFECTS: ; None. ; RESTRICTIONS: ; Assumed height must be positive. ; PROCEDURE: ; Simple plane geometry: sine law and expansion of sine of ; a sum of angles. ; EXAMPLE: ; ; SEE ALSO: ; ZA2DIST.PRO, RELC.PRO ; MODIFICATION HISTORY: ; Written by: D P Steele, ISR, 13 Oct 1994. ;- FUNCTION dist2za,dist,h,degrees=degrees,radius=radius IF N_PARAMS() EQ 0 THEN BEGIN doc_library,'dist2za' RETURN,-1 ENDIF IF N_PARAMS() EQ 1 THEN BEGIN MESSAGE,'Supply an assumed height (km).' RETURN,-1 ENDIF IF MIN([h]) LT 0 THEN BEGIN MESSAGE,'Assumed height(s) must be positive.' RETURN,-1 ENDIF IF N_ELEMENTS(radius) GT 1 THEN rad=radius ELSE rad=6371. radp=rad+h g=dist/radp IF KEYWORD_SET(degrees) THEN f=!RADEG ELSE f=1. RETURN,f*ATAN(SIN(g)/(COS(g)-rad/radp)) END